blob: 2c8197cd95fa313a63347346cde2d99d154f404b [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<head>
<script src="../../../resources/basic-gestures.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<style>
body {
margin: 0;
}
#target {
font-size: 100px;
}
#clickTarget {
width: 100px;
height: 100px;
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
async function run()
{
if (!window.testRunner)
return;
function didChangeSelection()
{
result.textContent = window.getSelection().toString()
}
document.addEventListener("selectionchange", didChangeSelection);
var clickTarget = document.getElementById("clickTarget");
var target = document.getElementById("target");
window.getSelection().setBaseAndExtent(target, 0, target, 6);
await UIHelper.activateElement(clickTarget);
setTimeout(async function () {
// The test is done, but we need to tap again to ensure we don't
// hang the next test with a double tap.
document.removeEventListener("selectionchange", didChangeSelection);
await UIHelper.tapAt(10, 500);
testRunner.notifyDone();
}, 0);
}
</script>
</head>
<body onload="run()">
<div id="target">WebKit</div>
<div id="clickTarget"></div>
<pre>The selected text is: "<span id="result"></span>"</pre>
<p>This test verifies that the DOM selection is dismissed when tapping on an element that does not listen to click events.</p>
</body>
</html>