blob: 05f5128a43bcfe7512b36d6880807d1fd19d4e43 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
#textarea {
font-size: 18px;
width: 400px;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<br><br><br>
<textarea id="textarea" rows="6">
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p</textarea>
<p>This tests autoscroll in text area correctly shows selection highlight.
To manually test, scroll the text area down to the end.
Slowly drag up your mouse starting from the line closest to the upper edge of the text area.
Once the contents of the text area get scrolled a little,
the selection should not jump down to the end.</p>
<div id="log"></div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
// The text area displays 6 lines of text. We scroll down to the end
// and start dragging the cursor up from the first line that appears (the k line).
// Therefore, the selection should contain the letter k.
var textarea = document.getElementById("textarea");
textarea.scrollTop = textarea.scrollHeight;
if (window.eventSender) {
var x = textarea.offsetLeft + textarea.offsetWidth / 2;
var y = textarea.offsetTop + 1;
eventSender.dragMode = false;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseMoveTo(x, 0);
eventSender.mouseUp();
var log = document.getElementById("log");
var selectedText = window.getSelection().toString();
if (selectedText.indexOf("k") != -1)
log.innerText = "PASSED the selection did not jump down.";
else
log.innerText = "FAILED the selection jumped down.";
}
</script>
</body>
</html>