OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
dominicc (has gone to gerrit)
2014/04/25 02:39:45
I think you need a test for imports like
A import
| |
2 <html> | |
3 <head> | |
4 <script src="../../../resources/testharness.js"></script> | |
5 <script src="../../../resources/testharnessreport.js"></script> | |
6 <script src="resources/import-custom-element-helper.js"></script> | |
7 </head> | |
8 <body> | |
9 <script> | |
10 var hello = registerTestingCustomElement('x-hello'); | |
11 | |
12 var t1 = async_test('Instantiate custom elements in async imports.'); | |
dominicc (has gone to gerrit)
2014/04/25 02:39:45
I had no idea the test harness could interleave te
| |
13 var t2 = async_test('Resolve custom elements in async imports later.'); | |
14 var latch = new ImportTestLatch(function() { | |
15 t1.step(function() { | |
16 assert_equals('hello-1', hello.ids[0]); | |
17 assert_array_equals(['hello-2', 'hello-3', 'hello-4', 'hello-5', 'hello- 6', 'hello-7', 'hello-8', 'hello-p34-1', 'hello-p34-2', 'hello-p56-1', 'hello-p5 6-2'], | |
18 hello.ids.slice(1).sort()); | |
19 | |
20 assert_true(hello.ids.indexOf('hello-p34-1') < hello.ids.indexOf('hello- 3')); | |
21 assert_true(hello.ids.indexOf('hello-3') < hello.ids.indexOf('hello-p34- 2')); | |
22 assert_true(hello.ids.indexOf('hello-3') < hello.ids.indexOf('hello-7')) ; | |
23 | |
24 // Even though parent-2 is loaded in async, its content should follow th e order. | |
25 assert_true(hello.ids.indexOf('hello-p56-1') < hello.ids.indexOf('hello- 5')); | |
26 assert_true(hello.ids.indexOf('hello-5') < hello.ids.indexOf('hello-p56- 2')); | |
27 | |
28 t1.done(); | |
29 }); | |
30 | |
31 t2.step(function() { | |
32 var bye = registerTestingCustomElement('x-bye'); | |
33 | |
34 assert_equals('bye-1', bye.ids[0]); | |
35 assert_array_equals(['bye-2', 'bye-3', 'bye-4', 'bye-5', 'bye-6', 'bye-7 ', 'bye-8', 'bye-p34-1', 'bye-p34-2', 'bye-p56-1', 'bye-p56-2'], | |
36 bye.ids.slice(1).sort()); | |
37 assert_true(bye.ids.indexOf('bye-p34-1') < bye.ids.indexOf('bye-3')); | |
38 assert_true(bye.ids.indexOf('bye-3') < bye.ids.indexOf('bye-p34-2')); | |
39 assert_true(bye.ids.indexOf('bye-3') < bye.ids.indexOf('bye-7')); | |
40 assert_true(bye.ids.indexOf('bye-p56-1') < bye.ids.indexOf('bye-5')); | |
41 assert_true(bye.ids.indexOf('bye-5') < bye.ids.indexOf('bye-p56-2')); | |
42 | |
43 t2.done(); | |
44 }); | |
45 }, 6); | |
dominicc (has gone to gerrit)
2014/04/25 02:39:45
Might be nice to use an explaining variable for th
| |
46 </script> | |
47 <link rel="import" href="resources/custom-element-hello-1.html" onload="latch.lo aded()"> | |
48 <link rel="import" href="resources/custom-element-hello-2.html" async onload="la tch.loaded()"> | |
49 <link rel="import" href="resources/custom-element-hello-parent-34.html" onload=" latch.loaded()"> | |
50 <link rel="import" href="resources/custom-element-hello-parent-56.html" async on load="latch.loaded()"> | |
51 <link rel="import" href="resources/custom-element-hello-7.html" onload="latch.lo aded()"> | |
52 <script> | |
53 (function() { | |
54 var link = document.createElement('link'); | |
55 link.href = 'resources/custom-element-hello-8.html'; | |
56 link.rel = 'import'; | |
57 link.onload = latch.loaded.bind(latch); | |
58 document.head.appendChild(link); | |
59 })(); | |
60 </script> | |
61 </body> | |
62 </html> | |
OLD | NEW |