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

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

Issue 19663011: Custom Syntax's are now enabled via template.bindingDelegate = (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: restore @Experimental Created 7 years, 5 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/element_bindings_test.dart ('k') | pkg/mdv/test/node_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 observe_utils; 5 library observe_utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html';
8 import 'package:observe/observe.dart'; 9 import 'package:observe/observe.dart';
9 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
10 11
11 toSymbolMap(Map map) { 12 toSymbolMap(Map map) {
12 var result = new ObservableMap.linked(); 13 var result = new ObservableMap.linked();
13 map.forEach((key, value) { 14 map.forEach((key, value) {
14 if (value is Map) value = toSymbolMap(value); 15 if (value is Map) value = toSymbolMap(value);
15 result[new Symbol(key)] = value; 16 result[new Symbol(key)] = value;
16 }); 17 });
17 return result; 18 return result;
18 } 19 }
19 20
21 recursivelySetTemplateModel(element, model, [delegate]) {
22 for (var node in element.queryAll('*')) {
23 if (node.isTemplate) {
24 node.bindingDelegate = delegate;
25 node.model = model;
26 }
27 }
28 }
29
30 dispatchEvent(type, target) {
31 target.dispatchEvent(new Event(type, cancelable: false));
32 }
33
20 class FooBarModel extends ObservableBase { 34 class FooBarModel extends ObservableBase {
21 @observable var foo; 35 @observable var foo;
22 @observable var bar; 36 @observable var bar;
23 37
24 FooBarModel([this.foo, this.bar]); 38 FooBarModel([this.foo, this.bar]);
25 } 39 }
26 40
27 class FooBarNotifyModel extends ChangeNotifierBase implements FooBarModel { 41 class FooBarNotifyModel extends ChangeNotifierBase implements FooBarModel {
28 var _foo; 42 var _foo;
29 var _bar; 43 var _bar;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } finally { 87 } finally {
74 performMicrotaskCheckpoint(); 88 performMicrotaskCheckpoint();
75 } 89 }
76 }, onRunAsync: (callback) => _pending.add(callback)); 90 }, onRunAsync: (callback) => _pending.add(callback));
77 }; 91 };
78 } 92 }
79 93
80 observeTest(name, testCase) => test(name, wrapMicrotask(testCase)); 94 observeTest(name, testCase) => test(name, wrapMicrotask(testCase));
81 95
82 solo_observeTest(name, testCase) => solo_test(name, wrapMicrotask(testCase)); 96 solo_observeTest(name, testCase) => solo_test(name, wrapMicrotask(testCase));
OLDNEW
« no previous file with comments | « pkg/mdv/test/element_bindings_test.dart ('k') | pkg/mdv/test/node_bindings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698