From 08dbe87819b298c595bed32c32060f09d716c46c Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Tue, 11 Aug 2015 22:01:20 -0700 Subject: [PATCH] fix(testability): throw if no testability available this implements the same behavior for dart that is already implemented in the typescript version --- modules/angular2/src/core/testability/get_testability.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/angular2/src/core/testability/get_testability.dart b/modules/angular2/src/core/testability/get_testability.dart index 1f65e830c1..450f753da5 100644 --- a/modules/angular2/src/core/testability/get_testability.dart +++ b/modules/angular2/src/core/testability/get_testability.dart @@ -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(() {