OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src='../../../resources/testharness.js'></script> | 2 <script src='../../../resources/testharness.js'></script> |
3 <script src='../../../resources/testharnessreport.js'></script> | 3 <script src='../../../resources/testharnessreport.js'></script> |
4 <style id="style1"> | 4 <style id="style1"> |
5 ::slotted { display: block; } /* invalid - no parameter */ | 5 ::slotted { display: block; } /* invalid - no parameter */ |
6 ::slotted() { display: block; } /* invalid - empty parameter */ | 6 ::slotted() { display: block; } /* invalid - empty parameter */ |
7 ::slotted(*) { display: block; } | 7 ::slotted(*) { display: block; } |
8 *::slotted(*) { display: block; } | 8 *::slotted(*) { display: block; } |
9 ::slotted(div) { display: block; } /* expects universal selector (*) on the left
in cssText */ | 9 ::slotted(div) { display: block; } /* expects universal selector (*) on the left
in cssText */ |
10 ::slotted( div) { display: block; } /* allow a space on left */ | 10 ::slotted( div) { display: block; } /* allow a space on left */ |
(...skipping 22 matching lines...) Expand all Loading... |
33 ::slotted(::slotted(div)) { color: red; } /* invalid */ | 33 ::slotted(::slotted(div)) { color: red; } /* invalid */ |
34 </style> | 34 </style> |
35 <script> | 35 <script> |
36 'use strict'; | 36 'use strict'; |
37 test(() => { | 37 test(() => { |
38 var style1 = document.getElementById('style1'); | 38 var style1 = document.getElementById('style1'); |
39 var cssRules = style1.sheet.cssRules; | 39 var cssRules = style1.sheet.cssRules; |
40 | 40 |
41 var expectedCSSTexts = [ | 41 var expectedCSSTexts = [ |
42 "::slotted(*) { display: block; }", | 42 "::slotted(*) { display: block; }", |
43 "*::slotted(*) { display: block; }", | 43 "::slotted(*) { display: block; }", |
44 "::slotted(div) { display: block; }", | 44 "::slotted(div) { display: block; }", |
45 "::slotted(div) { display: block; }", | 45 "::slotted(div) { display: block; }", |
46 "::slotted(div) { display: block; }", | 46 "::slotted(div) { display: block; }", |
47 ".foo::slotted(div) { color: blue; }", | 47 ".foo::slotted(div) { color: blue; }", |
48 "#id::slotted(*) { color: blue; }", | 48 "#id::slotted(*) { color: blue; }", |
49 "[attr=\"foo\"]::slotted(*) { color: blue; }", | 49 "[attr=\"foo\"]::slotted(*) { color: blue; }", |
50 ".foo .bar::slotted(div) { color: blue; }", | 50 ".foo .bar::slotted(div) { color: blue; }", |
51 "slot::slotted(.green) { color: green; }", | 51 "slot::slotted(.green) { color: green; }", |
52 "slot::slotted(#green) { color: green; }", | 52 "slot::slotted(#green) { color: green; }", |
53 "slot::slotted([green=\"green\"]) { color: green; }", | 53 "slot::slotted([green=\"green\"]) { color: green; }", |
54 "slot::slotted(div.green) { color: green; }", | 54 "slot::slotted(div.green) { color: green; }", |
55 "div ::slotted(div) { color: red; }", | 55 "div ::slotted(div) { color: red; }", |
56 "div + slot::slotted(div) { color: red; }", | 56 "div + slot::slotted(div) { color: red; }", |
57 "span::slotted(*) { color: red; }" | 57 "span::slotted(*) { color: red; }" |
58 ]; | 58 ]; |
59 | 59 |
60 for (var i = 0; i < expectedCSSTexts.length; ++i) | 60 for (var i = 0; i < expectedCSSTexts.length; ++i) |
61 assert_equals(cssRules.item(i).cssText, expectedCSSTexts[i]); | 61 assert_equals(cssRules.item(i).cssText, expectedCSSTexts[i]); |
62 assert_equals(cssRules.length, expectedCSSTexts.length); | 62 assert_equals(cssRules.length, expectedCSSTexts.length); |
63 | 63 |
64 }, "Test for cssText of '::slotted' rule."); | 64 }, "Test for cssText of '::slotted' rule."); |
65 </script> | 65 </script> |
OLD | NEW |