Chromium Code Reviews| Index: tests/html/custom_elements_test.dart |
| diff --git a/tests/html/custom_elements_test.dart b/tests/html/custom_elements_test.dart |
| index 0843b18b1bb7a128f5e71d10f3af796c35612a39..83364c299dca5633967401b6207fcb324973a5ce 100644 |
| --- a/tests/html/custom_elements_test.dart |
| +++ b/tests/html/custom_elements_test.dart |
| @@ -3,9 +3,10 @@ |
| // BSD-style license that can be found in the LICENSE file. |
| library custom_elements_test; |
| -import '../../pkg/unittest/lib/unittest.dart'; |
| -import '../../pkg/unittest/lib/html_individual_config.dart'; |
| +import 'dart:async'; |
| import 'dart:html'; |
| +import 'package:unittest/html_individual_config.dart'; |
| +import 'package:unittest/unittest.dart'; |
| class CustomMixin { |
| var mixinMethodCalled; |
| @@ -35,9 +36,29 @@ String get nextTag => 'x-type${nextTagId++}'; |
| class NotAnElement {} |
| +loadPolyfills() { |
| + return new Future.sync(() { |
| + if (!MutationObserver.supported) { |
| + return HttpRequest.getString('/root_dart/pkg/mutation_observer/lib/' |
| + 'mutation_observer.min.js').then((code) { |
| + document.head.children.add(new ScriptElement()..text = code); |
| + }); |
| + } |
| + }).then((_) { |
| + if (!document.supportsRegister) { |
| + return HttpRequest.getString('/root_dart/pkg/custom_element/lib/' |
| + 'custom-elements.debug.js').then((code) { |
| + document.head.children.add(new ScriptElement()..text = code); |
| + }); |
| + } |
| + }); |
| +} |
| + |
| main() { |
| useHtmlIndividualConfiguration(); |
|
Jennifer Messerly
2013/08/20 19:09:59
does this need to be individual config? it slows t
|
| + setUp(loadPolyfills); |
| + |
| group('register', () { |
| test('register', () { |
| var tag = nextTag; |
| @@ -90,6 +111,7 @@ main() { |
| test('pre-registration construction', () { |
| var tag = nextTag; |
| var dom = new Element.html('<div><$tag></$tag></div>'); |
| + |
| var preElement = dom.children[0]; |
| expect(preElement, isNotNull); |
| expect(preElement is HtmlElement, isTrue); |
| @@ -100,6 +122,7 @@ main() { |
| }); |
| document.register(tag, CustomType); |
| + Platform.upgradeCustomElements(dom); |
| var postElement = dom.children[0]; |
| expect(postElement, isNotNull); |