2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
10 .t6 ~ .sibling { background-color: rgb(0, 128, 0); }
12 #r3 { width: 10px; height: 10px }
16 <div class="sibling"></div>
22 <div class="sibling"></div>
29 <div class="sibling"></div>
35 <div id="r4" class="sibling">
50 <div id="r6" class="sibling">
56 document.body.offsetTop;
59 assert_true(!!window.internals, "This test only works with internals exposed present");
60 assert_equals(getComputedStyle(r1).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
63 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
64 assert_equals(getComputedStyle(r1).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
65 }, "Adjacent with universal selector");
68 assert_true(!!window.internals, "This test only works with internals exposed present");
69 assert_equals(getComputedStyle(r2).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
72 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc");
73 assert_equals(getComputedStyle(r2).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
74 }, "Indirect adjacent with universal selector");
77 assert_true(!!window.internals, "This test only works with internals exposed present");
78 assert_true(!!window.eventSender, "This test only works with eventSender present");
80 eventSender.mouseMoveTo(r3.offsetLeft + 1, r3.offsetTop + 1);
81 assert_equals(getComputedStyle(r3).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
84 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 3, "Subtree style recalc");
85 assert_equals(getComputedStyle(r3).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
86 }, "Adjacent with universal :hover selector");
89 assert_true(!!window.internals, "This test only works with internals exposed present");
90 assert_equals(getComputedStyle(r4).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
93 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc");
94 assert_equals(getComputedStyle(r4).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
95 }, "Class change affecting selector for sibling class");
98 assert_true(!!window.internals, "This test only works with internals exposed present");
99 assert_equals(getComputedStyle(r5).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
102 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 4, "Subtree style recalc");
103 assert_equals(getComputedStyle(r5).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
104 }, "Class change affecting all sibling subtrees through a universal selector");
107 assert_true(!!window.internals, "This test only works with internals exposed present");
108 assert_equals(getComputedStyle(r6).backgroundColor, "rgba(0, 0, 0, 0)", "Background color should initially be transparent");
111 assert_equals(internals.updateStyleAndReturnAffectedElementCount(), 5, "Subtree style recalc");
112 assert_equals(getComputedStyle(r6).backgroundColor, "rgb(0, 128, 0)", "Background color is green after class change");
113 }, "Class change affecting all sibling subtrees through an indirect adjacent combinator");