Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Unified Diff: tests/html/custom_elements_test.dart

Issue 22967006: Adding polyfill support for custom elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..43c1bf32fa71c31c3d2fd6ad494ccfdd922adfde 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,20 @@ String get nextTag => 'x-type${nextTagId++}';
class NotAnElement {}
+loadPolyfills() {
+ 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();
+ setUp(loadPolyfills);
+
group('register', () {
test('register', () {
var tag = nextTag;
@@ -90,6 +102,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 +113,7 @@ main() {
});
document.register(tag, CustomType);
+ Platform.upgradeCustomElements(dom);
var postElement = dom.children[0];
expect(postElement, isNotNull);
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698