OLD | NEW |
| (Empty) |
1 <html> | |
2 <link rel="import" href="../resources/dump-as-text.html" /> | |
3 <link rel="import" href="../resources/chai.html" /> | |
4 <body> | |
5 This test ensures that is visible in following script block. | |
6 <script> | |
7 window.callbacksCalled = []; | |
8 | |
9 function fooCreatedFunction() { | |
10 assert.deepEqual(window.callbacksCalled, []); | |
11 window.callbacksCalled.push(this.tagName); | |
12 this.appendChild(document.createElement("x-bar")); | |
13 assert.deepEqual(window.callbacksCalled, ['x-foo', 'x-bar']); | |
14 } | |
15 | |
16 function barCreatedFunction() { | |
17 assert.deepEqual(window.callbacksCalled, ['x-foo']); | |
18 window.callbacksCalled.push(this.tagName); | |
19 } | |
20 | |
21 document.registerElement("x-foo", { prototype: Object.create(HTMLElement.prototy
pe, { createdCallback: { value: fooCreatedFunction } }) }); | |
22 document.registerElement("x-bar", { prototype: Object.create(HTMLElement.prototy
pe, { createdCallback: { value: barCreatedFunction } }) }); | |
23 </script> | |
24 <script> | |
25 document.createElement("x-foo"); | |
26 assert.deepEqual(window.callbacksCalled, ['x-foo', 'x-bar']); | |
27 </script> | |
28 </body> | |
29 </html> | |
OLD | NEW |