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