blob: 22066912ba7fdce17037cb4a6e1d093e5c06a53b [file] [log] [blame]
<!DOCTYPE html>
<title>Default passive document level touchmove event listener test</title>
<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/gesture-util.js"></script>
<body onload=runTest()>
<div id="touchDiv">
</div>
</body>
<style>
#touchDiv {
width: 100px;
height: 100px;
}
</style>
<script>
var touch_div = document.getElementById("touchDiv");
var rect = touch_div.getBoundingClientRect();
var x = rect.left + rect.width / 2;
var y = rect.top + rect.height / 2;
var cancelable = true;
var touch_move_arrived = false;
document.addEventListener("touchmove", function (event) {
cancelable = event.cancelable;
touch_move_arrived = true;
event.preventDefault();
});
function injectInput() {
return smoothScroll(10, x, y, GestureSourceType.TOUCH_INPUT, "down");
}
function runTest() {
promise_test (async () => {
await waitForCompositorCommit();
await injectInput();
await waitFor(()=> { return touch_move_arrived; });
assert_false(cancelable);
}, "Touchmove events are non-cancelable since the event listener is treated as passive.");
}
</script>