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

Side by Side Diff: pkg/mdv/test/custom_element_bindings_test.dart

Issue 17552019: Reorganize mdv and observe packages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merged Created 7 years, 6 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
« no previous file with comments | « pkg/mdv/test/binding_syntax_test.dart ('k') | pkg/mdv/test/element_bindings_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 custom_element_bindings_test; 5 library custom_element_bindings_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:mdv_observe/mdv_observe.dart'; 9 import 'package:mdv/mdv.dart' as mdv;
10 import 'package:observe/observe.dart';
10 import 'package:unittest/html_config.dart'; 11 import 'package:unittest/html_config.dart';
11 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
12 import 'mdv_observe_utils.dart'; 13 import 'observe_utils.dart';
13 14
14 main() { 15 main() {
16 mdv.initialize();
15 useHtmlConfiguration(); 17 useHtmlConfiguration();
16 group('Custom Element Bindings', customElementBindingsTest); 18 group('Custom Element Bindings', customElementBindingsTest);
17 } 19 }
18 20
19 sym(x) => new Symbol(x); 21 sym(x) => new Symbol(x);
20 22
21 customElementBindingsTest() { 23 customElementBindingsTest() {
22 var testDiv; 24 var testDiv;
23 25
24 setUp(() { 26 setUp(() {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 115
114 test('template bind uses overridden custom element bind', () { 116 test('template bind uses overridden custom element bind', () {
115 117
116 var model = toSymbolMap({'a': new Point(123, 444), 'b': new Monster(100)}); 118 var model = toSymbolMap({'a': new Point(123, 444), 'b': new Monster(100)});
117 119
118 var div = createTestHtml('<template bind>' 120 var div = createTestHtml('<template bind>'
119 '<my-custom-element my-point="{{a}}" scary-monster="{{b}}">' 121 '<my-custom-element my-point="{{a}}" scary-monster="{{b}}">'
120 '</my-custom-element>' 122 '</my-custom-element>'
121 '</template>'); 123 '</template>');
122 124
123 TemplateElement.instanceCreated.listen((fragment) { 125 mdv.instanceCreated.listen((fragment) {
124 for (var e in fragment.queryAll('my-custom-element')) { 126 for (var e in fragment.queryAll('my-custom-element')) {
125 new MyCustomElement.attach(e); 127 new MyCustomElement.attach(e);
126 } 128 }
127 }); 129 });
128 130
129 div.query('template').model = model; 131 div.query('template').model = model;
130 deliverChangeRecords(); 132 deliverChangeRecords();
131 133
132 var element = div.nodes[1]; 134 var element = div.nodes[1];
133 135
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 }); 203 });
202 return; 204 return;
203 } 205 }
204 real.bind(name, model, path); 206 real.bind(name, model, path);
205 } 207 }
206 208
207 void unbind(String name) { 209 void unbind(String name) {
208 switch (name) { 210 switch (name) {
209 case 'my-point': 211 case 'my-point':
210 if (_sub1 != null) { 212 if (_sub1 != null) {
211 print('!!! unbind $name');
212 _sub1.cancel(); 213 _sub1.cancel();
213 _sub1 = null; 214 _sub1 = null;
214 } 215 }
215 return; 216 return;
216 case 'scary-monster': 217 case 'scary-monster':
217 if (_sub2 != null) { 218 if (_sub2 != null) {
218 print('!!! unbind $name');
219 _sub2.cancel(); 219 _sub2.cancel();
220 _sub2 = null; 220 _sub2 = null;
221 } 221 }
222 return; 222 return;
223 } 223 }
224 real.unbind(name); 224 real.unbind(name);
225 } 225 }
226 226
227 void unbindAll() { 227 void unbindAll() {
228 unbind('my-point'); 228 unbind('my-point');
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 279
280 void clear() => _map.clear(); 280 void clear() => _map.clear();
281 void forEach(void f(K key, V value)) => _map.forEach(f); 281 void forEach(void f(K key, V value)) => _map.forEach(f);
282 Iterable<K> get keys => _map.keys; 282 Iterable<K> get keys => _map.keys;
283 Iterable<V> get values => _map.values; 283 Iterable<V> get values => _map.values;
284 int get length => _map.length; 284 int get length => _map.length;
285 bool get isEmpty => _map.isEmpty; 285 bool get isEmpty => _map.isEmpty;
286 bool get isNotEmpty => _map.isNotEmpty; 286 bool get isNotEmpty => _map.isNotEmpty;
287 } 287 }
OLDNEW
« no previous file with comments | « pkg/mdv/test/binding_syntax_test.dart ('k') | pkg/mdv/test/element_bindings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698