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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<!DOCTYPE html>
<html>
<title>Shared transitions: ensure input is discarded when rendering is suppressed</title>
<link rel="help" href="https://github.com/WICG/view-transitions">
<link rel="author" href="mailto:khushalsagar@chromium.org">
<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>
div {
width: 100px;
height: 100px;
background: blue;
contain: paint;
}
</style>
<div id=first></div>
<script>
async function runTest(resolve, reject) {
window.addEventListener('mousedown', (event) => {
let point = event.clientX + "," + event.clientY;
if (event.clientX == 20 && event.clientY == 20)
resolve();
else
reject(point);
});
let transition = document.startViewTransition(() => {
return new Promise(async (inner_resolve) => {
new test_driver.Actions()
.setContext(window)
.addPointer("finger1", "touch")
.pointerMove(10, 10, {origin: "viewport", sourceName: "finger1"})
.pointerDown({sourceName: "finger1"})
.pointerUp({sourceName: "finger1"})
.send();
// Use a timeout to ensure the input has been queued up. await
// times out because the event is discarded.
step_timeout(inner_resolve, 1000);
});
});
await transition.finished;
await new test_driver.Actions()
.setContext(window)
.addPointer("finger1", "touch")
.pointerMove(20, 20, {origin: "viewport", sourceName: "finger1"})
.pointerDown({sourceName: "finger1"})
.pointerUp({sourceName: "finger1"})
.send();
}
promise_test(async t => {
assert_implements(document.startViewTransition, "Missing document.startViewTransition");
return new Promise(async (resolve, reject) => {
// Dispatch an event before starting the test to finish init logic in
// synthetic input dispatch.
await new test_driver.Actions()
.setContext(window)
.addPointer("finger1", "touch")
.pointerMove(0, 0, {origin: "viewport", sourceName: "finger1"})
.pointerDown({sourceName: "finger1"})
.pointerUp({sourceName: "finger1"})
.send();
runTest(resolve, reject);
});
}, "Input when rendering suppressed is ignored");
</script>
|