Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html |
| diff --git a/third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html b/third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..74d2e86ff7aca944b1593b4bee3b53f160785396 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/custom-elements/imports/imports-and-synchronous-create.html |
| @@ -0,0 +1,46 @@ |
| +<!DOCTYPE html> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +'use strict'; |
|
kochi
2016/08/22 07:37:35
Conversion to async-style is not yet done for this
|
| +setup({ explicit_done: true }); |
| +let reactions = []; |
| +customElements.define('x-x', class extends HTMLElement { |
| + constructor() { |
| + super(); |
| + reactions.push({ type: 'constructor', element: this }); |
| + } |
| +}); |
| +test(() => { |
| + assert_equals(reactions.length, 0); |
| +}, 'Should not have parsed <x-x> yet'); |
| +</script> |
| + |
| +<x-x></x-x> |
| + |
| +<script> |
| +'use strict'; |
| +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> |