fix(testability): throw if no testability available

this implements the same behavior for dart that is already implemented in the typescript version
This commit is contained in:
Michael Goderbauer 2015-08-11 22:01:20 -07:00 committed by Hank Duan
parent 218b037d98
commit 08dbe87819
1 changed files with 3 additions and 0 deletions

View File

@ -93,6 +93,9 @@ class GetTestability {
static addToWindow(TestabilityRegistry registry) {
js.context['getAngularTestability'] = _jsify((Element elem) {
Testability testability = registry.findTestabilityInTree(elem);
if (testability == null) {
throw 'Could not find testability for element.';
}
return _jsify(new PublicTestability(testability));
});
js.context['getAllAngularTestabilities'] = _jsify(() {