TypeScript @angular-core.TestabilityRegistry类(方法)实例源码

下面列出了TypeScript @angular-core.TestabilityRegistry 类(方法)源码代码实例,从而了解它的用法。

作者:AnthonyPAlice    项目:angula   
findTestabilityInTree(registry: TestabilityRegistry, elem: any, findInAncestors: boolean):
     Testability|null {
   if (elem == null) {
     return null;
   }
   const t = registry.getTestability(elem);
   if (t != null) {
     return t;
   } else if (!findInAncestors) {
     return null;
   }
   if (getDOM().isShadowRoot(elem)) {
     return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
   }
   return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
 }

作者:AnthonyPAlice    项目:angula   
global['getAngularTestability'] = (elem: any, findInAncestors: boolean = true) => {
   const testability = registry.findTestabilityInTree(elem, findInAncestors);
   if (testability == null) {
     throw new Error('Could not find testability for element.');
   }
   return testability;
 };

作者:Coco-wa    项目:angula   
global.getAngularTestability = (elem: any, findInAncestors: boolean = true) => {
   var testability = registry.findTestabilityInTree(elem, findInAncestors);
   if (testability == null) {
     throw new Error('Could not find testability for element.');
   }
   return new PublicTestability(testability);
 };

作者:AnthonyPAlice    项目:angula   
global['getAllAngularRootElements'] = () => registry.getAllRootElements();

作者:Coco-wa    项目:angula   
global.getAllAngularRootElements = () => registry.getAllRootElements();

作者:Coco-wa    项目:angula   
global.getAllAngularTestabilities = () => {
   var testabilities = registry.getAllTestabilities();
   return testabilities.map((testability) => { return new PublicTestability(testability); });
 };

作者:AlmogShau    项目:angula   
global.getAllAngularTestabilities = () => registry.getAllTestabilities();

作者:JanStureNielse    项目:angula   
global.getAllAngularTestabilities = () => { return registry.getAllTestabilities(); };


问题


面经


文章

微信
公众号

扫码关注公众号