blob: 2e5398119c91c953bba4f548e6a17d67f7fb879a (
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
|
<!DOCTYPE html>
<html>
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Tests that :active state is changed on a scrollable container without any touch event listeners</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/paint_listener.js"></script>
<script src="apz_test_utils.js"></script>
<script src="apz_test_native_event_utils.js"></script>
<style>
#scrollable {
height: 50vh;
width: 50vw;
background: yellow;
overflow: scroll;
}
#scrollabletarget {
height: 200vh;
width: 200vh;
background: green;
}
#scrollabletarget:active {
background: red;
}
</style>
<div id="scrollable">
<div id="scrollabletarget">
</div>
</div>
<script>
async function test() {
ok(!scrollabletarget.matches(":active"), "should not be active initially");
await synthesizeNativeTap(scrollabletarget, 50, 50);
// In JS there's no way to ensure `APZStateChange::eStartTouch` notification
// has been processed. So we wait for `:active` state change here.
await SimpleTest.promiseWaitForCondition(
() => scrollabletarget.matches(":active"),
"Waiting for :active state change");
ok(scrollabletarget.matches(":active"), "should be active");
}
waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
</script>
</html>
|