blob: cf2014d69e4e9f204f35fca823c9b518ee2b4fe7 [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<meta name="viewport" content="width=device-width initial-scale=1 user-scalable=no">
<title>This tests that we fire dblclick event on double tap when the content is replaced</title>
<script src="../../../../resources/ui-helper.js"></script>
<style>
#doubleTapThis {
width: 400px;
height: 400px;
border: 1px solid green;
}
#newDoubleTapThis {
width: 400px;
height: 400px;
border: 1px solid green;
}
</style>
<script>
async function test() {
if (!window.testRunner || !testRunner.runUIScript)
return;
testRunner.waitUntilDone();
testRunner.dumpAsText();
let rect = doubleTapThis.getBoundingClientRect();
let x = rect.left + rect.width / 2;
let y = rect.top + rect.height / 2;
await UIHelper.humanSpeedDoubleTapAt(x, y);
}
</script>
</head>
<body onload="test()">
<div id=doubleTapThis>PASS if 'double click' text is shown below.</div>
<pre id=result></pre>
<script>
doubleTapThis.addEventListener('click', function (e) {
doubleTapThis.remove();
let newDoubleTapThis = document.createElement("div");
newDoubleTapThis.id="newDoubleTapThis";
document.body.insertBefore(newDoubleTapThis, result);
newDoubleTapThis.addEventListener('dblclick', function (e) {
result.innerHTML = result.innerHTML + "[double click]";
if (window.testRunner)
setTimeout("testRunner.notifyDone()", 0);
});
});
</script>
</body>
</html>