Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: pkg/template_binding/test/template_binding_test.dart

Issue 213713002: Reapply change that makes path-observer more agressive with property lookups. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/template_binding/test/node_bind_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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">'
« no previous file with comments | « pkg/template_binding/test/node_bind_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698