Skip to content

Commit 08dbe87

Browse files
goderbauerhankduan
authored andcommitted
fix(testability): throw if no testability available
this implements the same behavior for dart that is already implemented in the typescript version
1 parent 218b037 commit 08dbe87

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/angular2/src/core/testability/get_testability.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class GetTestability {
9393
static addToWindow(TestabilityRegistry registry) {
9494
js.context['getAngularTestability'] = _jsify((Element elem) {
9595
Testability testability = registry.findTestabilityInTree(elem);
96+
if (testability == null) {
97+
throw 'Could not find testability for element.';
98+
}
9699
return _jsify(new PublicTestability(testability));
97100
});
98101
js.context['getAllAngularTestabilities'] = _jsify(() {

0 commit comments

Comments
 (0)