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="host">This div is a shadow host.</div> | 7 <div id="host">This div is a shadow host.</div> |
8 </body> | 8 </body> |
9 <script> | 9 <script> |
10 description("Test whether CSSHostRule API works correctly or not."); | 10 description("Test whether CSSHostRule API works correctly or not."); |
(...skipping 24 matching lines...) Expand all Loading... |
35 shouldBe("hostRule.cssRules[0].cssText", '"#host { border-color: green; }"'); | 35 shouldBe("hostRule.cssRules[0].cssText", '"#host { border-color: green; }"'); |
36 shouldBe("hostRule.cssRules[1].cssText", '"div { border-color: blue; }"'); | 36 shouldBe("hostRule.cssRules[1].cssText", '"div { border-color: blue; }"'); |
37 | 37 |
38 debug("After deleting the border rule with an id selector from @host @-rules:"); | 38 debug("After deleting the border rule with an id selector from @host @-rules:"); |
39 hostRule.deleteRule(0); | 39 hostRule.deleteRule(0); |
40 shouldBe("getComputedStyle(host).borderColor", '"rgb(0, 0, 255)"'); | 40 shouldBe("getComputedStyle(host).borderColor", '"rgb(0, 0, 255)"'); |
41 shouldBe("hostRule.cssRules.length", '1'); | 41 shouldBe("hostRule.cssRules.length", '1'); |
42 shouldBe("hostRule.cssText", '"@host { \\n div { border-color: blue; }\\n}"'); | 42 shouldBe("hostRule.cssText", '"@host { \\n div { border-color: blue; }\\n}"'); |
43 shouldBe("hostRule.cssRules[0].cssText", '"div { border-color: blue; }"'); | 43 shouldBe("hostRule.cssRules[0].cssText", '"div { border-color: blue; }"'); |
44 | 44 |
| 45 debug("Error cases"); |
| 46 shouldBe("hostRule.cssRules.length", '1'); |
| 47 shouldThrow("hostRule.insertRule('#host { border-color: green; }')", "'TypeError
: Not enough arguments'"); |
| 48 shouldBe("hostRule.cssRules.length", '1'); |
| 49 shouldThrow("hostRule.insertRule()", "'TypeError: Not enough arguments'"); |
| 50 shouldBe("hostRule.cssRules.length", '1'); |
| 51 shouldThrow("hostRule.deleteRule()", "'TypeError: Not enough arguments'"); |
| 52 shouldBe("hostRule.cssRules.length", '1'); |
| 53 |
45 </script> | 54 </script> |
46 <script src="../../js/resources/js-test-post.js"></script> | 55 <script src="../../js/resources/js-test-post.js"></script> |
47 </html> | 56 </html> |
OLD | NEW |