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

Unified Diff: third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html

Issue 2132343002: Make Custom Elements V1 work in HTML imports documents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: imports-create tests checks the order of constructors Created 4 years, 5 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
Index: third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html
diff --git a/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html b/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html
new file mode 100644
index 0000000000000000000000000000000000000000..422ac2c98ed1183950dbe05292be353f6a16421a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
dominicc (has gone to gerrit) 2016/07/19 01:57:39 I don't see any tests for: - deep import trees -
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+'use strict'
+setup({ explicit_done: true });
+let reactions = [];
+customElements.define('x-x', class extends HTMLElement {
+ constructor() {
+ super();
+ reactions.push({ type: 'constructor', element: this });
+ console.log("constructor", this);
+ }
+});
+test(() => {
+ assert_equals(reactions.length, 0);
+}, 'Should not have parsed <x-x> yet');
+</script>
+
+<x-x></x-x>
+
+<script>
+test(() => {
+ assert_equals(reactions.length, 1);
+}, 'Parser should invoke the custom element constructor');
+
+let import1 = document.createElement('link');
+import1.rel = 'import';
+import1.href = 'resources/import-custom.html';
+document.head.appendChild(import1);
+
+import1.onload = () => {
+ test(() => {
+ assert_equals(reactions.length, 2);
+ }, 'import should invoke the custom element constructor');
+
+ let elementsInMaster = document.getElementsByTagName('x-x');
+ let elementsInImport = import1.import.getElementsByTagName('x-x');
+ test(() => {
+ assert_equals(reactions[0].element, elementsInMaster[0]);
+ assert_equals(reactions[1].element, elementsInImport[0]);
+ }, 'Constructor should run in the order elements are created');
+
+ done();
+};
+</script>

Powered by Google App Engine
This is Rietveld 408576698