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 // TODO(sigmund): delete this file after issue 19322 is resolved. | 5 // TODO(sigmund): delete this file after issue 19322 is resolved. |
6 // This test is a trimmed down version of interop_test. interop_test is | 6 // This test is a trimmed down version of interop_test. interop_test is |
7 // currently failing in dart2js because of bug/19322, so we have this copy | 7 // currently failing in dart2js because of bug/19322, so we have this copy |
8 // that excludes the causes of failure to get some test coverage in .js. | 8 // that excludes the causes of failure to get some test coverage in .js. |
9 library web_components.interop2_test; | 9 library web_components.interop2_test; |
10 | 10 |
11 import 'dart:html'; | 11 import 'dart:html'; |
12 import 'dart:async'; | 12 import 'dart:async'; |
13 import 'dart:js' show context, JsObject; | 13 import 'dart:js' show context, JsObject; |
14 import 'package:unittest/html_config.dart'; | 14 import 'package:unittest/html_config.dart'; |
15 import 'package:unittest/unittest.dart'; | 15 import 'package:unittest/unittest.dart'; |
16 import 'package:web_components/interop.dart'; | 16 import 'package:web_components/interop.dart'; |
17 import 'package:web_components/polyfill.dart'; | 17 import 'package:web_components/polyfill.dart'; |
18 | 18 |
19 main() { | 19 main() { |
20 useHtmlConfiguration(); | 20 useHtmlConfiguration(); |
21 registerDartType('x-a', XAWrapper); | 21 setUp(() => customElementsReady.then((_) { |
Jennifer Messerly
2014/06/10 00:04:17
won't this try and register elements repeatedly at
Siggi Cherem (dart-lang)
2014/06/10 00:12:13
Yep, you are right. I'll send a fix shortly. I thi
| |
22 registerDartType('x-b', XBWrapper, extendsTag: 'div'); | 22 registerDartType('x-a', XAWrapper); |
23 registerDartType('x-c', XCWrapper); | 23 registerDartType('x-b', XBWrapper, extendsTag: 'div'); |
24 | 24 registerDartType('x-c', XCWrapper); |
25 setUp(() => customElementsReady); | 25 })); |
26 | 26 |
27 test('interop is supported', () { | 27 test('interop is supported', () { |
28 expect(isSupported, isTrue); | 28 expect(isSupported, isTrue); |
29 }); | 29 }); |
30 | 30 |
31 test('previously created elements are not upgraded', () { | 31 test('previously created elements are not upgraded', () { |
32 var a = document.querySelector('x-a'); | 32 var a = document.querySelector('x-a'); |
33 expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement'); | 33 expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement'); |
34 expect(a is XAWrapper, isFalse, reason: 'x-a should not be upgraded yet'); | 34 expect(a is XAWrapper, isFalse, reason: 'x-a should not be upgraded yet'); |
35 expect(_readX(a), 0); | 35 expect(_readX(a), 0); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 XAWrapper.created() : super.created(); | 86 XAWrapper.created() : super.created(); |
87 } | 87 } |
88 | 88 |
89 class XBWrapper extends DivElement with Wrapper { | 89 class XBWrapper extends DivElement with Wrapper { |
90 XBWrapper.created() : super.created(); | 90 XBWrapper.created() : super.created(); |
91 } | 91 } |
92 | 92 |
93 class XCWrapper extends HtmlElement with Wrapper { | 93 class XCWrapper extends HtmlElement with Wrapper { |
94 XCWrapper.created() : super.created(); | 94 XCWrapper.created() : super.created(); |
95 } | 95 } |
OLD | NEW |