Chromium Code Reviews| 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> |