OLD | NEW |
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.custom_element_bindings_test; | 5 library template_binding.test.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:custom_element/polyfill.dart'; |
9 import 'package:template_binding/template_binding.dart'; | 10 import 'package:template_binding/template_binding.dart'; |
10 import 'package:observe/observe.dart' show toObservable; | 11 import 'package:observe/observe.dart' show toObservable; |
11 import 'package:unittest/html_config.dart'; | 12 import 'package:unittest/html_config.dart'; |
12 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
13 import 'utils.dart'; | 14 import 'utils.dart'; |
14 | 15 |
15 Future _registered; | 16 Future _registered; |
16 | 17 |
17 main() { | 18 main() { |
18 useHtmlConfiguration(); | 19 useHtmlConfiguration(); |
19 | 20 |
20 _registered = loadCustomElementPolyfill().then((_) { | 21 _registered = loadCustomElementPolyfill().then((_) { |
21 document.register('my-custom-element', MyCustomElement); | 22 document.register('my-custom-element', MyCustomElement); |
22 document.register('with-attrs-custom-element', WithAttrsCustomElement); | 23 document.register('with-attrs-custom-element', WithAttrsCustomElement); |
23 }); | 24 }); |
24 | 25 |
25 group('Custom Element Bindings', customElementBindingsTest); | 26 group('Custom Element Bindings', customElementBindingsTest); |
26 } | 27 } |
27 | 28 |
28 Future loadCustomElementPolyfill() { | |
29 if (!document.supportsRegister) { | |
30 var script = new ScriptElement() | |
31 ..src = '/packages/custom_element/custom-elements.debug.js'; | |
32 document.head.append(script); | |
33 return document.on['WebComponentsReady'].first; | |
34 } | |
35 return new Future.value(); | |
36 } | |
37 | |
38 customElementBindingsTest() { | 29 customElementBindingsTest() { |
39 setUp(() { | 30 setUp(() { |
40 document.body.append(testDiv = new DivElement()); | 31 document.body.append(testDiv = new DivElement()); |
41 return _registered; | 32 return _registered; |
42 }); | 33 }); |
43 | 34 |
44 tearDown(() { | 35 tearDown(() { |
45 testDiv.remove(); | 36 testDiv.remove(); |
46 testDiv = null; | 37 testDiv = null; |
47 }); | 38 }); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 | 237 |
247 void addAll(Map<K, V> other) => _map.addAll(other); | 238 void addAll(Map<K, V> other) => _map.addAll(other); |
248 void clear() => _map.clear(); | 239 void clear() => _map.clear(); |
249 void forEach(void f(K key, V value)) => _map.forEach(f); | 240 void forEach(void f(K key, V value)) => _map.forEach(f); |
250 Iterable<K> get keys => _map.keys; | 241 Iterable<K> get keys => _map.keys; |
251 Iterable<V> get values => _map.values; | 242 Iterable<V> get values => _map.values; |
252 int get length => _map.length; | 243 int get length => _map.length; |
253 bool get isEmpty => _map.isEmpty; | 244 bool get isEmpty => _map.isEmpty; |
254 bool get isNotEmpty => _map.isNotEmpty; | 245 bool get isNotEmpty => _map.isNotEmpty; |
255 } | 246 } |
OLD | NEW |