Index: pkg/template_binding/test/template_binding_test.dart |
diff --git a/pkg/template_binding/test/template_binding_test.dart b/pkg/template_binding/test/template_binding_test.dart |
index c2ac5a959303de8c13a974f6ac00612cb0837628..4757ac0e996a7fafa1597263ae75e3442087fd9f 100644 |
--- a/pkg/template_binding/test/template_binding_test.dart |
+++ b/pkg/template_binding/test/template_binding_test.dart |
@@ -157,15 +157,22 @@ templateInstantiationTests() { |
// and would cause the template to not be expanded. |
var m = toObservable({ 'predicate': null, 'bound': 1 }); |
var template = div.firstChild; |
- templateBind(template).model = m; |
+ bool errorSeen = false; |
+ runZoned(() { |
+ templateBind(template).model = m; |
+ }, onError: (e, s) { |
+ expect(e, isNoSuchMethodError); |
+ errorSeen = true; |
+ }); |
return new Future(() { |
expect(div.nodes.length, 1); |
m['predicate'] = 1; |
- }).then(endOfMicrotask).then((_) { |
- expect(div.nodes.length, 2); |
- expect(div.lastChild.text, 'value:'); |
+ expect(errorSeen, isFalse); |
+ }).then(nextMicrotask).then((_) { |
+ expect(errorSeen, isTrue); |
+ expect(div.nodes.length, 1); |
m['bound'] = toObservable({ 'value': 2 }); |
@@ -234,14 +241,18 @@ templateInstantiationTests() { |
// undefined, and would cause the template to not be expanded. |
var m = toObservable({ 'predicate': 1, 'bound': 1 }); |
var template = div.firstChild; |
- templateBind(template).model = m; |
+ bool errorSeen = false; |
+ runZoned(() { |
+ templateBind(template).model = m; |
+ }, onError: (e, s) { |
+ expect(e, isNoSuchMethodError); |
+ errorSeen = true; |
+ }); |
return new Future(() { |
- expect(div.nodes.length, 2); |
- expect(div.lastChild.text, 'value:'); |
- |
+ expect(div.nodes.length, 1); |
m['bound'] = toObservable({ 'value': 2 }); |
- |
+ expect(errorSeen, isTrue); |
}).then(endOfMicrotask).then((_) { |
expect(div.nodes.length, 2); |
expect(div.lastChild.text, 'value:2'); |
@@ -2199,6 +2210,33 @@ templateInstantiationTests() { |
}); |
}); |
+ test('CreateInstance - sync error', () { |
+ var div = createTestHtml('<template>{{foo}}</template>'); |
+ var outer = templateBind(div.nodes.first); |
+ var model = 1; // model is missing 'foo' should throw. |
+ expect(() => outer.createInstance(model, new TestBindingSyntax()), |
+ throwsA(isNoSuchMethodError)); |
+ }); |
+ |
+ test('CreateInstance - async error', () { |
+ var div = createTestHtml( |
+ '<template>' |
+ '<template bind="{{b}}">' |
+ '{{ foo }}:{{ replaceme }}' |
+ '</template>' |
+ '</template>'); |
+ var outer = templateBind(div.nodes.first); |
+ var model = toObservable({'b': 1}); // missing 'foo' should throw. |
+ |
+ bool seen = false; |
+ runZoned(() => outer.createInstance(model, new TestBindingSyntax()), |
+ onError: (e) { |
+ expect(e, isNoSuchMethodError); |
+ seen = true; |
+ }); |
+ return new Future(() { expect(seen, isTrue); }); |
+ }); |
+ |
test('Repeat - svg', () { |
var div = createTestHtml( |
'<svg width="400" height="110">' |