summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-view-transitions/input-blocked-when-rendering-suppressed.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-view-transitions/input-blocked-when-rendering-suppressed.html')
-rw-r--r--testing/web-platform/tests/css/css-view-transitions/input-blocked-when-rendering-suppressed.html75
1 files changed, 75 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-view-transitions/input-blocked-when-rendering-suppressed.html b/testing/web-platform/tests/css/css-view-transitions/input-blocked-when-rendering-suppressed.html
new file mode 100644
index 0000000000..7f550c8655
--- /dev/null
+++ b/testing/web-platform/tests/css/css-view-transitions/input-blocked-when-rendering-suppressed.html
@@ -0,0 +1,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>