Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / autoscroll-in-textarea.html
blob05f5128a43bcfe7512b36d6880807d1fd19d4e43
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 #textarea {
6 font-size: 18px;
7 width: 400px;
8 margin: 0;
9 padding: 0;
11 </style>
12 </head>
13 <body>
14 <br><br><br>
15 <textarea id="textarea" rows="6">
31 p</textarea>
33 <p>This tests autoscroll in text area correctly shows selection highlight.
34 To manually test, scroll the text area down to the end.
35 Slowly drag up your mouse starting from the line closest to the upper edge of the text area.
36 Once the contents of the text area get scrolled a little,
37 the selection should not jump down to the end.</p>
38 <div id="log"></div>
40 <script>
41 if (window.testRunner)
42 testRunner.dumpAsText();
44 // The text area displays 6 lines of text. We scroll down to the end
45 // and start dragging the cursor up from the first line that appears (the k line).
46 // Therefore, the selection should contain the letter k.
47 var textarea = document.getElementById("textarea");
48 textarea.scrollTop = textarea.scrollHeight;
49 if (window.eventSender) {
50 var x = textarea.offsetLeft + textarea.offsetWidth / 2;
51 var y = textarea.offsetTop + 1;
52 eventSender.dragMode = false;
53 eventSender.mouseMoveTo(x, y);
54 eventSender.mouseDown();
55 eventSender.mouseMoveTo(x, 0);
56 eventSender.mouseUp();
58 var log = document.getElementById("log");
59 var selectedText = window.getSelection().toString();
60 if (selectedText.indexOf("k") != -1)
61 log.innerText = "PASSED the selection did not jump down.";
62 else
63 log.innerText = "FAILED the selection jumped down.";
65 </script>
66 </body>
67 </html>