blob: 7b07c5d8378b2a6ffa92ccf9e1c5d5822111be8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
<!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;
promise_test(async function(t) {
await SpecialPowers.pushPrefEnv({
set: [
["ui.useOverlayScrollbars", 1],
["ui.scrollbarFadeDuration", 200],
]
});
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");
let {resolve, promise} = Promise.withResolvers();
{
let expectedEvents = 2;
for (let scrollbar of scrollbars) {
SpecialPowers.wrap(scrollbar).addEventListener("transitionend", function() {
assert_true(expectedEvents > 0, "Should see an expected transition");
if (--expectedEvents) {
resolve();
}
});
}
}
await promise;
await new Promise(r => requestAnimationFrame(r));
// FIXME: This doesn't seem to be done automatically by the test harness in WPT
await SpecialPowers.popPrefEnv();
});
</script>
|