OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <div id="console"></div> | 7 <div id="console"></div> |
8 <!-- These elements should not be selected in ShadowRoot's querySelector. --> | 8 <!-- These elements should not be selected in ShadowRoot's querySelector. --> |
9 <div id="foo"></div> | 9 <div id="foo"></div> |
10 <div class="foo"></div> | 10 <div class="foo"></div> |
11 <foo></foo> | 11 <foo></foo> |
12 <script> | 12 <script> |
13 description("Tests for ShadowRoot JS APIs. Can only run within DRT"); | 13 description("Tests for ShadowRoot JS APIs. Can only run within DRT"); |
14 | 14 |
15 if (window.testRunner) | 15 if (window.testRunner) |
16 testRunner.dumpAsText(); | 16 testRunner.dumpAsText(); |
| 17 |
| 18 shouldBeUndefined("window.ShadowRoot"); |
| 19 shouldBeDefined("window.WebKitShadowRoot"); |
| 20 shouldThrow("new window.WebKitShadowRoot(document.createElement('div'))"); |
| 21 |
17 var shadowHost = document.createElement('div'); | 22 var shadowHost = document.createElement('div'); |
18 document.body.appendChild(shadowHost); | 23 document.body.appendChild(shadowHost); |
19 var shadowRoot = shadowHost.webkitCreateShadowRoot(); | 24 var shadowRoot = shadowHost.webkitCreateShadowRoot(); |
20 | 25 |
| 26 shouldBeTrue("shadowRoot instanceof window.WebKitShadowRoot"); |
| 27 |
21 var div1 = document.createElement("div"); | 28 var div1 = document.createElement("div"); |
22 div1.setAttribute("id", "div1"); | 29 div1.setAttribute("id", "div1"); |
23 shadowRoot.appendChild(div1); | 30 shadowRoot.appendChild(div1); |
24 | 31 |
25 var div2 = document.createElement("div"); | 32 var div2 = document.createElement("div"); |
26 div2.setAttribute("id", "div2"); | 33 div2.setAttribute("id", "div2"); |
27 div2.classList.add("class2"); | 34 div2.classList.add("class2"); |
28 shadowRoot.appendChild(div2); | 35 shadowRoot.appendChild(div2); |
29 | 36 |
30 // Tests for Document should cover most cases for the following APIs. | 37 // Tests for Document should cover most cases for the following APIs. |
(...skipping 20 matching lines...) Expand all Loading... |
51 shouldBe("shadowRoot.querySelectorAll('foo')", "[]"); | 58 shouldBe("shadowRoot.querySelectorAll('foo')", "[]"); |
52 | 59 |
53 var youngerShadowRoot = shadowHost.webkitCreateShadowRoot(); | 60 var youngerShadowRoot = shadowHost.webkitCreateShadowRoot(); |
54 shouldNotBe("youngerShadowRoot", "shadowRoot"); | 61 shouldNotBe("youngerShadowRoot", "shadowRoot"); |
55 | 62 |
56 | 63 |
57 </script> | 64 </script> |
58 <script src="../../js/resources/js-test-post.js"></script> | 65 <script src="../../js/resources/js-test-post.js"></script> |
59 </body> | 66 </body> |
60 </html> | 67 </html> |
OLD | NEW |