1
0
Fork 0
firefox/testing/web-platform/mozilla/tests/css/css-overflow/scrollbar-events.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

46 lines
1.5 KiB
HTML

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1866773">
<style>
#container {
width: 100px;
height: 100px;
border: 1px;
}
#child {
height: 200px;
}
</style>
<div id="container">
<div id="child"></div>
</div>
<script>
let container = document.getElementById("container");
let child = document.getElementById("child");
let InspectorUtils = SpecialPowers.wrap(window).InspectorUtils;
const kDuration = 200;
promise_test(async function(t) {
await SpecialPowers.pushPrefEnv({
set: [
["ui.useOverlayScrollbars", 1],
["ui.scrollbarFadeDuration", kDuration],
]
});
for (let type of ["transitionstart", "transitionend"]) {
container.addEventListener(type, t.unreached_func(`Shouldn't see ${type} event on #container`));
}
// This creates scrollbars and triggers activation.
container.style.overflow = "scroll";
container.getBoundingClientRect();
let scrollbars = InspectorUtils.getChildrenForNode(container, true, true).filter(child => SpecialPowers.wrap(child).nodeName.toLowerCase() == "scrollbar");
assert_equals(scrollbars.length, 2, "Should have two scrollbars");
await new Promise(r => t.step_timeout(r, kDuration));
await new Promise(r => requestAnimationFrame(r));
assert_true(true, "No scrollbar event should've happened by now");
// FIXME: This doesn't seem to be done automatically by the test harness in WPT
await SpecialPowers.popPrefEnv();
});
</script>