scroll-button-hover-remove.html (1728B)
1 <!doctype html> 2 <meta charset="utf-8"> 3 <title>CSS Test: ::scroll-button changes on hover via :hover and removes correctly</title> 4 <link rel="help" href="https://drafts.csswg.org/css-overflow-5/#scroll-buttons"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-actions.js"></script> 9 <script src="/resources/testdriver-vendor.js"></script> 10 <style> 11 body { 12 margin: 0; 13 } 14 15 #scroller { 16 width: 600px; 17 height: 300px; 18 overflow: auto; 19 white-space: nowrap; 20 } 21 22 #scroller:hover { 23 background-color: red; 24 } 25 26 .scroller::scroll-button(inline-end) { 27 content: ">"; 28 width: 100px; 29 height: 100px; 30 position: absolute; 31 top: 0; 32 left: 0; 33 background-color: green; 34 display: inline-block; 35 } 36 37 .scroller::scroll-button(inline-end):hover { 38 background-color: blue; 39 } 40 </style> 41 <div id="scroller" class="scroller"> 42 <div id="target"></div> 43 <div></div> 44 </div> 45 <script> 46 promise_test(async t => { 47 actions_promise = new test_driver.Actions() 48 .pointerMove(15, 15) 49 .send(); 50 await actions_promise; 51 assert_equals(getComputedStyle(scroller, "::scroll-button(inline-end)").backgroundColor, "rgb(0, 0, 255)", "::scroll-button changes on hover via :hover"); 52 assert_equals(getComputedStyle(scroller).backgroundColor, "rgb(255, 0, 0)", "scroller should be hovered when ::scroll-button is hovered"); 53 scroller.classList.remove("scroller"); 54 scroller.offsetTop; 55 assert_equals(getComputedStyle(scroller).backgroundColor, "rgb(255, 0, 0)", "scroller should be hovered when ::scroll-button is removed"); 56 }); 57 </script>