blob: d5dc2aab64d18718e1031fcc64a282852f846e6d [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
<script src="../../../resources/ui-helper.js"></script>
<script src="../../../resources/js-test.js"></script>
<style>
html, body {
margin: 0;
width: 100%;
height: 100%;
}
input {
font-size: 320px;
display: block;
}
</style>
</head>
<body>
<input id="input" value="covfefe">
<script>
const input = document.getElementById("input");
jsTestIsAsync = true;
clicked = false;
selectionChanged = false;
description("This test verifies that tapping in a misspelled word selects the misspelled word, and does not cause " +
"the selection to collapse after a click event is dispatched. To manually test, tap the input field to bring up " +
"the keyboard, and then tap on a part of the word in the input field that is far away from the editing caret. As " +
"a result, the contents of the input should be selected and marked as a misspelled word.");
(async function() {
await UIHelper.activateAndWaitForInputSessionAt(100, 200);
input.addEventListener("click", () => clicked = true);
document.addEventListener("selectionchange", () => selectionChanged = true);
await UIHelper.tapAt(300, 200);
shouldBecomeEqual("clicked && selectionChanged", "true", () => {
shouldBe("input.selectionStart", "0");
shouldBe("input.selectionEnd", "7");
finishJSTest();
});
})();
</script>
</body>
</html>