Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-overflow/scroll-button-hover-remove.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8">
<title>CSS Test: ::scroll-button changes on hover via :hover and removes correctly</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<style>
body {
margin: 0;
}
#scroller {
width: 600px;
height: 300px;
overflow: auto;
white-space: nowrap;
}
#scroller:hover {
background-color: red;
}
.scroller::scroll-button(inline-end) {
content: ">";
width: 100px;
height: 100px;
position: absolute;
top: 0;
left: 0;
background-color: green;
display: inline-block;
}
.scroller::scroll-button(inline-end):hover {
background-color: blue;
}
</style>
<div id="scroller" class="scroller">
<div id="target"></div>
<div></div>
</div>
<script>
promise_test(async t => {
actions_promise = new test_driver.Actions()
.pointerMove(15, 15)
.send();
await actions_promise;
assert_equals(getComputedStyle(scroller, "::scroll-button(inline-end)").backgroundColor, "rgb(0, 0, 255)", "::scroll-button changes on hover via :hover");
assert_equals(getComputedStyle(scroller).backgroundColor, "rgb(255, 0, 0)", "scroller should be hovered when ::scroll-button is hovered");
scroller.classList.remove("scroller");
scroller.offsetTop;
assert_equals(getComputedStyle(scroller).backgroundColor, "rgb(255, 0, 0)", "scroller should be hovered when ::scroll-button is removed");
});
</script>