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_wrappers_test; | 5 library template_wrappers_test; |
6 | 6 |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:js' show context, JsObject; | 9 import 'dart:js' show context, JsObject; |
10 import 'package:unittest/html_config.dart'; | 10 import 'package:unittest/html_config.dart'; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 import 'package:web_components/interop.dart'; | 12 import 'package:web_components/interop.dart'; |
13 import 'package:web_components/polyfill.dart'; | 13 import 'package:web_components/polyfill.dart'; |
14 | 14 |
15 main() { | 15 main() { |
16 useHtmlConfiguration(); | 16 useHtmlConfiguration(); |
17 registerDartType('x-a', XAWrapper); | 17 setUp(() => customElementsReady.then((_) { |
Jennifer Messerly
2014/06/10 00:04:17
same here
Siggi Cherem (dart-lang)
2014/06/10 00:12:14
Done.
| |
18 registerDartType('x-b', XBWrapper, extendsTag: 'div'); | 18 registerDartType('x-a', XAWrapper); |
19 registerDartType('x-c', XCWrapper); | 19 registerDartType('x-b', XBWrapper, extendsTag: 'div'); |
20 | 20 registerDartType('x-c', XCWrapper); |
21 setUp(() => customElementsReady); | 21 })); |
22 | 22 |
23 test('interop is supported', () { | 23 test('interop is supported', () { |
24 expect(isSupported, isTrue); | 24 expect(isSupported, isTrue); |
25 }); | 25 }); |
26 | 26 |
27 test('previously created elements are not upgraded', () { | 27 test('previously created elements are not upgraded', () { |
28 var a = document.querySelector('x-a'); | 28 var a = document.querySelector('x-a'); |
29 expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement'); | 29 expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement'); |
30 expect(a is XAWrapper, isFalse, reason: 'x-a should not be upgraded yet'); | 30 expect(a is XAWrapper, isFalse, reason: 'x-a should not be upgraded yet'); |
31 expect(_readX(a), 0); | 31 expect(_readX(a), 0); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 XAWrapper.created() : super.created(); | 96 XAWrapper.created() : super.created(); |
97 } | 97 } |
98 | 98 |
99 class XBWrapper extends DivElement with Wrapper { | 99 class XBWrapper extends DivElement with Wrapper { |
100 XBWrapper.created() : super.created(); | 100 XBWrapper.created() : super.created(); |
101 } | 101 } |
102 | 102 |
103 class XCWrapper extends HtmlElement with Wrapper { | 103 class XCWrapper extends HtmlElement with Wrapper { |
104 XCWrapper.created() : super.created(); | 104 XCWrapper.created() : super.created(); |
105 } | 105 } |
OLD | NEW |