| 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 final globalSetup = customElementsReady.then((_) { |
| 20 useHtmlConfiguration(); | |
| 21 setUp(() => customElementsReady.then((_) { | |
| 22 registerDartType('x-a', XAWrapper); | 20 registerDartType('x-a', XAWrapper); |
| 23 registerDartType('x-b', XBWrapper, extendsTag: 'div'); | 21 registerDartType('x-b', XBWrapper, extendsTag: 'div'); |
| 24 registerDartType('x-c', XCWrapper); | 22 registerDartType('x-c', XCWrapper); |
| 25 })); | 23 }); |
| 24 |
| 25 main() { |
| 26 useHtmlConfiguration(); |
| 27 setUp(() => globalSetup); |
| 26 | 28 |
| 27 test('interop is supported', () { | 29 test('interop is supported', () { |
| 28 expect(isSupported, isTrue); | 30 expect(isSupported, isTrue); |
| 29 }); | 31 }); |
| 30 | 32 |
| 31 test('previously created elements are not upgraded', () { | 33 test('previously created elements are not upgraded', () { |
| 32 var a = document.querySelector('x-a'); | 34 var a = document.querySelector('x-a'); |
| 33 expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement'); | 35 expect(a is HtmlElement, isTrue, reason: 'x-a is HtmlElement'); |
| 34 expect(a is XAWrapper, isFalse, reason: 'x-a should not be upgraded yet'); | 36 expect(a is XAWrapper, isFalse, reason: 'x-a should not be upgraded yet'); |
| 35 expect(_readX(a), 0); | 37 expect(_readX(a), 0); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 XAWrapper.created() : super.created(); | 88 XAWrapper.created() : super.created(); |
| 87 } | 89 } |
| 88 | 90 |
| 89 class XBWrapper extends DivElement with Wrapper { | 91 class XBWrapper extends DivElement with Wrapper { |
| 90 XBWrapper.created() : super.created(); | 92 XBWrapper.created() : super.created(); |
| 91 } | 93 } |
| 92 | 94 |
| 93 class XCWrapper extends HtmlElement with Wrapper { | 95 class XCWrapper extends HtmlElement with Wrapper { |
| 94 XCWrapper.created() : super.created(); | 96 XCWrapper.created() : super.created(); |
| 95 } | 97 } |
| OLD | NEW |