feat(testability): Expose function getAllAngularTestabilities
This commit is contained in:
parent
71ea19902a
commit
7b94bbf3e4
|
@ -26,6 +26,7 @@ interface BrowserNodeGlobal {
|
|||
Reflect: any;
|
||||
zone: Zone;
|
||||
getAngularTestability: Function;
|
||||
getAllAngularTestabilities: Function;
|
||||
setTimeout: Function;
|
||||
clearTimeout: Function;
|
||||
setInterval: Function;
|
||||
|
|
|
@ -86,5 +86,11 @@ class GetTestability {
|
|||
Testability testability = registry.findTestabilityInTree(elem);
|
||||
return _jsify(new PublicTestability(testability));
|
||||
});
|
||||
js.context['getAllAngularTestabilities'] = _jsify(() {
|
||||
List<Testability> testabilities = registry.getAllTestabilities();
|
||||
List<PublicTestability> publicTestabilities =
|
||||
testabilities.map((testability) => new PublicTestability(testability));
|
||||
return _jsify(publicTestabilities);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,5 +23,9 @@ export class GetTestability {
|
|||
}
|
||||
return new PublicTestability(testability);
|
||||
};
|
||||
global.getAllAngularTestabilities = function(): List<PublicTestability> {
|
||||
var testabilities = registry.getAllTestabilities();
|
||||
return testabilities.map((testability) => { return new PublicTestability(testability); });
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,8 @@ export class TestabilityRegistry {
|
|||
this._applications.set(token, testability);
|
||||
}
|
||||
|
||||
getAllTestabilities(): List<Testability> { return MapWrapper.values(this._applications); }
|
||||
|
||||
findTestabilityInTree(elem: Node): Testability {
|
||||
if (elem == null) {
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue