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..e1c22ab1cd3e0068583241a0c74244af16d587d1 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/custom-elements/imports/imports-create.html |
| @@ -0,0 +1,45 @@ |
| +<!DOCTYPE html> |
|
dominicc (has gone to gerrit)
2016/08/19 04:54:11
I'm not sure from the name what this test is about
kochi
2016/08/19 10:51:47
The counterpart of this test is imports-upgrade.ht
kochi
2016/08/22 07:37:34
Renamed to imports-and-synchronous-crate.html.
|
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<script> |
| +'use strict'; |
| +setup({ explicit_done: true }); |
|
dominicc (has gone to gerrit)
2016/08/19 04:54:10
When there are multiple tests in a file it would b
|
| +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> |
| +test(() => { |
| + assert_equals(reactions.length, 1); |
|
dominicc (has gone to gerrit)
2016/08/19 04:54:11
I think it is better to keep related assertions to
|
| +}, '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'); |
|
dominicc (has gone to gerrit)
2016/08/19 04:54:11
It's a bit hard to keep track of what's going on a
|
| + |
| + 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'); |
|
dominicc (has gone to gerrit)
2016/08/19 04:54:11
So... per the above comment... the test would be m
|
| + |
| + done(); |
| +}; |
| +</script> |