Created
May 24, 2022 16:46
-
-
Save whsieh/0d3201cab31ac31ff4643c0faaefa8f5 to your computer and use it in GitHub Desktop.
textarea-scrolled-endline-caret.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="../../resources/ui-helper.js"></script> | |
<script> | |
async function test() | |
{ | |
if (window.testRunner) | |
testRunner.dumpAsText(); | |
var ta = document.getElementById('ta') | |
var res = document.getElementById('res'); | |
// Send caret to bottom of textarea | |
ta.focus(); | |
ta.setSelectionRange(ta.value.length, ta.value.length); | |
ta.blur(); | |
ta.focus(); | |
// click | |
if (window.eventSender) { | |
testRunner.waitUntilDone(); | |
await UIHelper.renderingUpdate(); | |
eventSender.mouseMoveTo(90, 20); | |
eventSender.mouseDown(); | |
eventSender.mouseUp(); | |
if (ta.selectionEnd == 17) | |
res.innerHTML = "Test Succeeded"; | |
else | |
res.innerHTML = "Test Failed: caret is at " + ta.selectionEnd; | |
testRunner.notifyDone(); | |
} else { | |
res.innerHTML = "Test can't run without event sender (part of DumpRenderTree). " | |
+ "To test manually, click at the middle of the line marked 9 and check that the caret appears after the 9."; | |
} | |
} | |
</script> | |
</head> | |
<body onload="test()"> | |
<textarea id="ta"> | |
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10</textarea> | |
<div id="res"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment