OLD | NEW |
---|---|
(Empty) | |
1 <!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.
| |
2 <script src="../../resources/testharness.js"></script> | |
3 <script src="../../resources/testharnessreport.js"></script> | |
4 <script> | |
5 'use strict'; | |
6 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
| |
7 let reactions = []; | |
8 customElements.define('x-x', class extends HTMLElement { | |
9 constructor() { | |
10 super(); | |
11 reactions.push({ type: 'constructor', element: this }); | |
12 } | |
13 }); | |
14 test(() => { | |
15 assert_equals(reactions.length, 0); | |
16 }, 'Should not have parsed <x-x> yet'); | |
17 </script> | |
18 | |
19 <x-x></x-x> | |
20 | |
21 <script> | |
22 test(() => { | |
23 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
| |
24 }, 'Parser should invoke the custom element constructor'); | |
25 | |
26 let import1 = document.createElement('link'); | |
27 import1.rel = 'import'; | |
28 import1.href = 'resources/import-custom.html'; | |
29 document.head.appendChild(import1); | |
30 | |
31 import1.onload = () => { | |
32 test(() => { | |
33 assert_equals(reactions.length, 2); | |
34 }, '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
| |
35 | |
36 let elementsInMaster = document.getElementsByTagName('x-x'); | |
37 let elementsInImport = import1.import.getElementsByTagName('x-x'); | |
38 test(() => { | |
39 assert_equals(reactions[0].element, elementsInMaster[0]); | |
40 assert_equals(reactions[1].element, elementsInImport[0]); | |
41 }, '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
| |
42 | |
43 done(); | |
44 }; | |
45 </script> | |
OLD | NEW |