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

Side by Side Diff: pkg/template_binding/test/node_bind_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, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library template_binding.test.node_bind_test; 5 library template_binding.test.node_bind_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 9
10 import 'package:observe/observe.dart' 10 import 'package:observe/observe.dart'
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 test('No Path', () { 63 test('No Path', () {
64 var text = new Text('hi'); 64 var text = new Text('hi');
65 var model = 1; 65 var model = 1;
66 nodeBind(text).bind('text', new PathObserver(model)); 66 nodeBind(text).bind('text', new PathObserver(model));
67 expect(text.text, '1'); 67 expect(text.text, '1');
68 }); 68 });
69 69
70 test('Path unreachable', () { 70 test('Path unreachable', () {
71 var text = testDiv.append(new Text('hi')); 71 var text = testDiv.append(new Text('hi'));
72 var model = 1; 72 var model = 1;
73 nodeBind(text).bind('text', new PathObserver(model, 'a')); 73 var pathObserver = new PathObserver(model, 'a');
74 expect(text.text, ''); 74 expect(() => nodeBind(text).bind('text', pathObserver), throws);
75 expect(text.text, 'hi');
75 }); 76 });
76 77
77 test('Observer is Model', () { 78 test('Observer is Model', () {
78 var text = new Text(''); 79 var text = new Text('');
79 var model = toObservable({'a': {'b': {'c': 1}}}); 80 var model = toObservable({'a': {'b': {'c': 1}}});
80 var observer = new PathObserver(model, 'a.b.c'); 81 var observer = new PathObserver(model, 'a.b.c');
81 nodeBind(text).bind('text', observer); 82 nodeBind(text).bind('text', observer);
82 expect(text.text, '1'); 83 expect(text.text, '1');
83 84
84 var binding = nodeBind(text).bindings['text']; 85 var binding = nodeBind(text).bindings['text'];
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 }).then(endOfMicrotask).then((_) { 720 }).then(endOfMicrotask).then((_) {
720 expect(select.value, 'X'); 721 expect(select.value, 'X');
721 expect(model['selected'], 'X'); 722 expect(model['selected'], 'X');
722 723
723 model['selected'] = 'a'; 724 model['selected'] = 'a';
724 }).then(endOfMicrotask).then((_) { 725 }).then(endOfMicrotask).then((_) {
725 expect(select.value, 'a'); 726 expect(select.value, 'a');
726 }); 727 });
727 }); 728 });
728 } 729 }
OLDNEW
« no previous file with comments | « pkg/template_binding/lib/src/template_iterator.dart ('k') | pkg/template_binding/test/template_binding_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698