diff options
Diffstat (limited to 'testing/web-platform/tests/dom/events/non-cancelable-when-passive')
44 files changed, 1051 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-body.html new file mode 100644 index 0000000000..5574fe0acb --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-body.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>non-passive mousewheel event listener on body</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'mousewheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-div.html new file mode 100644 index 0000000000..6fbf692cd7 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-div.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>non-passive mousewheel event listener on div</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<style> + html, body { + overflow: hidden; + margin: 0; + } + #div { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: scroll; + } +</style> +<div class=remove-on-cleanup id=div> + <div style="height: 200vh"></div> +</div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('div'), + eventName: 'mousewheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-document.html new file mode 100644 index 0000000000..7d07393c69 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-document.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>non-passive mousewheel event listener on document</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'mousewheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-root.html new file mode 100644 index 0000000000..e85fbacaba --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-root.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>non-passive mousewheel event listener on root</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'mousewheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-window.html new file mode 100644 index 0000000000..29b09f8561 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-mousewheel-event-listener-on-window.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>non-passive mousewheel event listener on window</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'mousewheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-body.html new file mode 100644 index 0000000000..f417bdd0a6 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-body.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchmove event listener on body</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'touchmove', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-div.html new file mode 100644 index 0000000000..11c9345407 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-div.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchmove event listener on div</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('touchDiv'), + eventName: 'touchmove', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-document.html new file mode 100644 index 0000000000..8b95a8d492 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-document.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchmove event listener on document</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'touchmove', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-root.html new file mode 100644 index 0000000000..c41ab72bd8 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-root.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchmove event listener on root</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'touchmove', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-window.html new file mode 100644 index 0000000000..3d6675c566 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchmove-event-listener-on-window.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<link rel="help" href="https://github.com/WICG/interventions/issues/35"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'touchstart', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-body.html new file mode 100644 index 0000000000..f6e6ecb06d --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-body.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchstart event listener on body</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'touchstart', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-div.html new file mode 100644 index 0000000000..2e7c6e6b3b --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-div.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchstart event listener on div</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('touchDiv'), + eventName: 'touchstart', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-document.html new file mode 100644 index 0000000000..22fcbdc322 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-document.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchstart event listener on document</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'touchstart', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-root.html new file mode 100644 index 0000000000..56c51349a0 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-root.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchstart event listener on root</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'touchstart', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-window.html new file mode 100644 index 0000000000..4e9d424a9d --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-touchstart-event-listener-on-window.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>non-passive touchstart event listener on window</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'touchstart', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-body.html new file mode 100644 index 0000000000..070cadc291 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-body.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>non-passive wheel event listener on body</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'wheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-div.html new file mode 100644 index 0000000000..c49d18ac13 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-div.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<title>non-passive wheel event listener on div</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<style> + html, body { + overflow: hidden; + margin: 0; + } + #div { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: scroll; + } +</style> +<div class=remove-on-cleanup id=div> + <div style="height: 200vh"></div> +</div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('div'), + eventName: 'wheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-document.html new file mode 100644 index 0000000000..31a55cad43 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-document.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>non-passive wheel event listener on document</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'wheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-root.html new file mode 100644 index 0000000000..b7bacbfc7c --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-root.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>non-passive wheel event listener on root</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'wheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-window.html new file mode 100644 index 0000000000..c236059df4 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/non-passive-wheel-event-listener-on-window.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>non-passive wheel event listener on window</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'wheel', + passive: false, + expectCancelable: true, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-body.html new file mode 100644 index 0000000000..9db12cfbdc --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-body.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>passive mousewheel event listener on body</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'mousewheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-div.html new file mode 100644 index 0000000000..373670856b --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-div.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>passive mousewheel event listener on div</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<style> + html, body { + overflow: hidden; + margin: 0; + } + #div { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: scroll; + } +</style> +<div class=remove-on-cleanup id=div> + <div style="height: 200vh"></div> +</div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('div'), + eventName: 'mousewheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-document.html new file mode 100644 index 0000000000..71262280b6 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-document.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>passive mousewheel event listener on document</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'mousewheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-root.html new file mode 100644 index 0000000000..fc641d172e --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-root.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>passive mousewheel event listener on root</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'mousewheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-window.html new file mode 100644 index 0000000000..f60955c7c4 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-mousewheel-event-listener-on-window.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>passive mousewheel event listener on window</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<link rel="help" href="https://github.com/w3c/uievents/issues/331"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'mousewheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-body.html new file mode 100644 index 0000000000..2349bad258 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-body.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchmove event listener on body</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'touchmove', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-div.html new file mode 100644 index 0000000000..a61b34851e --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-div.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchmove event listener on div</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('touchDiv'), + eventName: 'touchmove', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-document.html new file mode 100644 index 0000000000..b49971b5b0 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-document.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchmove event listener on document</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'touchmove', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-root.html new file mode 100644 index 0000000000..b851704590 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-root.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchmove event listener on root</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'touchmove', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-window.html new file mode 100644 index 0000000000..351d6ace84 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchmove-event-listener-on-window.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchmove event listener on window</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'touchstart', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-body.html new file mode 100644 index 0000000000..c3d2b577fd --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-body.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchstart event listener on body</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'touchstart', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-div.html new file mode 100644 index 0000000000..103e7f0d23 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-div.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchstart event listener on div</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('touchDiv'), + eventName: 'touchstart', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-document.html new file mode 100644 index 0000000000..2e4de2405f --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-document.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchstart event listener on document</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'touchstart', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-root.html new file mode 100644 index 0000000000..0f52e9a16f --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-root.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchstart event listener on root</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'touchstart', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-window.html new file mode 100644 index 0000000000..c47af8101f --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-touchstart-event-listener-on-window.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>passive touchstart event listener on window</title> +<link rel="help" href="https://w3c.github.io/touch-events/#cancelability"> +<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> +<script src="resources/wait-for.js"></script> +<script src="resources/touching.js"></script> +<style> +#touchDiv { + width: 100px; + height: 100px; +} +</style> +<div id="touchDiv"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'touchstart', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-body.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-body.html new file mode 100644 index 0000000000..fe0869b022 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-body.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>passive wheel event listener on body</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.body, + eventName: 'wheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-div.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-div.html new file mode 100644 index 0000000000..e2ca6e795a --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-div.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<title>passive wheel event listener on div</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<style> + html, body { + overflow: hidden; + margin: 0; + } + #div { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + overflow: scroll; + } +</style> +<div class=remove-on-cleanup id=div> + <div style="height: 200vh"></div> +</div> +<script> + document.body.onload = () => runTest({ + target: document.getElementById('div'), + eventName: 'wheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-document.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-document.html new file mode 100644 index 0000000000..61b716f7bb --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-document.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>passive wheel event listener on document</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document, + eventName: 'wheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-root.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-root.html new file mode 100644 index 0000000000..6b383bc871 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-root.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>passive wheel event listener on root</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: document.documentElement, + eventName: 'wheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-window.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-window.html new file mode 100644 index 0000000000..a1e901f552 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/passive-wheel-event-listener-on-window.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<title>passive wheel event listener on window</title> +<link rel="help" href="https://w3c.github.io/uievents/#cancelability-of-wheel-events"> +<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> +<script src="resources/scrolling.js"></script> +<div class=remove-on-cleanup style="height: 200vh"></div> +<script> + document.body.onload = () => runTest({ + target: window, + eventName: 'wheel', + passive: true, + expectCancelable: false, + }); +</script> diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/scrolling.js b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/scrolling.js new file mode 100644 index 0000000000..88e10f5efd --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/scrolling.js @@ -0,0 +1,34 @@ +function raf() { + return new Promise((resolve) => { + // rAF twice. + window.requestAnimationFrame(() => { + window.requestAnimationFrame(resolve); + }); + }); +} + +async function runTest({target, eventName, passive, expectCancelable}) { + await raf(); + + let cancelable = null; + let arrived = false; + target.addEventListener(eventName, function (event) { + cancelable = event.cancelable; + arrived = true; + }, {passive:passive, once:true}); + + promise_test(async (t) => { + t.add_cleanup(() => { + document.querySelector('.remove-on-cleanup')?.remove(); + }); + const pos_x = Math.floor(window.innerWidth / 2); + const pos_y = Math.floor(window.innerHeight / 2); + const delta_x = 0; + const delta_y = 100; + + await new test_driver.Actions() + .scroll(pos_x, pos_y, delta_x, delta_y).send(); + await t.step_wait(() => arrived, `Didn't get event ${eventName} on ${target.localName}`); + assert_equals(cancelable, expectCancelable); + }); +} diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/touching.js b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/touching.js new file mode 100644 index 0000000000..620d26804b --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/touching.js @@ -0,0 +1,34 @@ +function waitForCompositorCommit() { + return new Promise((resolve) => { + // rAF twice. + window.requestAnimationFrame(() => { + window.requestAnimationFrame(resolve); + }); + }); +} + +function injectInput(touchDiv) { + return new test_driver.Actions() + .addPointer("touch_pointer", "touch") + .pointerMove(0, 0, {origin: touchDiv}) + .pointerDown() + .pointerMove(30, 30) + .pointerUp() + .send(); +} + +function runTest({target, eventName, passive, expectCancelable}) { + let touchDiv = document.getElementById("touchDiv"); + let cancelable = null; + let arrived = false; + target.addEventListener(eventName, function (event) { + cancelable = event.cancelable; + arrived = true; + }, {passive}); + promise_test(async () => { + await waitForCompositorCommit(); + await injectInput(touchDiv); + await waitFor(() => arrived); + assert_equals(cancelable, expectCancelable); + }); +} diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/wait-for.js b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/wait-for.js new file mode 100644 index 0000000000..0bf3e55834 --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/resources/wait-for.js @@ -0,0 +1,15 @@ +function waitFor(condition, MAX_FRAME = 500) { + return new Promise((resolve, reject) => { + function tick(frames) { + // We requestAnimationFrame either for MAX_FRAME frames or until condition is + // met. + if (frames >= MAX_FRAME) + reject(new Error(`Condition did not become true after ${MAX_FRAME} frames`)); + else if (condition()) + resolve(); + else + requestAnimationFrame(() => tick(frames + 1)); + } + tick(0); + }); +} diff --git a/testing/web-platform/tests/dom/events/non-cancelable-when-passive/synthetic-events-cancelable.html b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/synthetic-events-cancelable.html new file mode 100644 index 0000000000..4287770b8d --- /dev/null +++ b/testing/web-platform/tests/dom/events/non-cancelable-when-passive/synthetic-events-cancelable.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<title>Synthetic events are always cancelable by default</title> +<link rel="help" href="https://dom.spec.whatwg.org/#dictdef-eventinit"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +const eventsMap = { + wheel: 'WheelEvent', + mousewheel: 'WheelEvent', + touchstart: 'TouchEvent', + touchmove: 'TouchEvent', + touchend: 'TouchEvent', + touchcancel: 'TouchEvent', +} +function isCancelable(eventName, interfaceName) { + test(() => { + assert_implements(interfaceName in self, `${interfaceName} should be supported`); + let defaultPrevented = null; + addEventListener(eventName, event => { + event.preventDefault(); + defaultPrevented = event.defaultPrevented; + }); + const event = new self[interfaceName](eventName); + assert_false(event.cancelable, 'cancelable'); + const dispatchEventReturnValue = dispatchEvent(event); + assert_false(defaultPrevented, 'defaultPrevented'); + assert_true(dispatchEventReturnValue, 'dispatchEvent() return value'); + }, `Synthetic ${eventName} event with interface ${interfaceName} is not cancelable`); +} +for (const eventName in eventsMap) { + isCancelable(eventName, eventsMap[eventName]); + isCancelable(eventName, 'Event'); +} +</script> |