Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Touch-action with sorted element</title>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<script type="application/javascript">
async function test() {
var target = document.getElementById("target");
let touchEndPromise = promiseTouchEnd(document.body);
// drag the page up to scroll down by 50px
ok(await synthesizeNativeTouchDrag(target, 10, 100, 0, -50),
"Synthesized native vertical drag, waiting for touch-end event...");
await touchEndPromise;
await promiseOnlyApzControllerFlushed();
is(window.scrollX, 0, "X scroll offset didn't change");
is(window.scrollY, 50, "Y scroll offset changed");
}
waitUntilApzStable()
.then(test)
.then(subtestDone);
</script>
</head>
<body style="border: solid 1px green">
<div id="spacer" style="height:2000px">
<div id="target" style="width:200px; height:200px; background-color:blue;"></div>
<div style="position: relative; width:200px; height:200px; background-color:red; touch-action:none; margin-top:-200px; z-index: -1;"></div>
</div>
</body>
</html>