Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
|
dominicc (has gone to gerrit)
2014/04/24 07:28:33
I think you want way more tests at this point. For
| |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="../../../resources/testharness.js"></script> | |
| 5 <script src="../../../resources/testharnessreport.js"></script> | |
| 6 </head> | |
| 7 <body> | |
| 8 <script> | |
| 9 | |
| 10 Hello = function() {}; | |
| 11 Hello.ids = []; | |
| 12 Hello.prototype = Object.create(HTMLElement.prototype); | |
| 13 Hello.prototype.createdCallback = function() { Hello.ids.push(this.id); } | |
| 14 document.registerElement('x-hello', Hello); | |
|
dominicc (has gone to gerrit)
2014/04/24 07:28:33
Why is Hello in PascalCase? It's not the real cons
| |
| 15 | |
| 16 var numLoadedImports = 0; | |
| 17 | |
| 18 function importLoaded() | |
| 19 { | |
| 20 numLoadedImports++; | |
| 21 if (numLoadedImports == 3) | |
| 22 test(); | |
| 23 } | |
| 24 | |
| 25 var t1 = async_test('Instantiate custom elements in Async imports'); | |
|
dominicc (has gone to gerrit)
2014/04/24 07:28:33
Async -> async
next line too
| |
| 26 var t2 = async_test('Resolve custom elements in Async imports later'); | |
| 27 | |
| 28 function test() | |
| 29 { | |
|
dominicc (has gone to gerrit)
2014/04/24 07:28:33
Open brace goes on the previous line. Below too.
| |
| 30 t1.step(function() | |
| 31 { | |
| 32 assert_array_equals(['hello-1', 'hello-2', 'hello-3'], Hello.ids.sort()) ; | |
|
dominicc (has gone to gerrit)
2014/04/24 07:28:33
You must be able to write a tighter assertion than
| |
| 33 t1.done(); | |
| 34 }); | |
| 35 | |
| 36 t2.step(function() | |
| 37 { | |
| 38 Bye = function() {}; | |
|
dominicc (has gone to gerrit)
2014/04/24 07:28:33
Since this is essentially the same as Hello, you c
| |
| 39 Bye.ids = []; | |
| 40 Bye.prototype = Object.create(HTMLElement.prototype); | |
| 41 Bye.prototype.createdCallback = function() { Bye.ids.push(this.id); } | |
| 42 document.registerElement('x-bye', Bye); | |
| 43 | |
| 44 assert_array_equals(['bye-1', 'bye-2', 'bye-3'], Bye.ids.sort()); | |
| 45 t2.done(); | |
| 46 }); | |
| 47 } | |
| 48 </script> | |
| 49 <link rel="import" href="resources/custom-element-hello-1.html" onload="importLo aded()"> | |
| 50 <link rel="import" href="resources/custom-element-hello-2.html" async onload="im portLoaded()"> | |
| 51 <script> | |
| 52 (function() | |
| 53 { | |
| 54 var link = document.createElement('link'); | |
| 55 link.href = ('resources/custom-element-hello-3.html'); | |
| 56 link.rel = 'import'; | |
| 57 link.onload = importLoaded; | |
| 58 document.head.appendChild(link); | |
| 59 })(); | |
| 60 </script> | |
| 61 </body> | |
| 62 </html> | |
| OLD | NEW |