|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=468167 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 468167</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468167">Mozilla Bug 468167</a> |
|
14 <p id="display"> |
|
15 <textarea id="ta" rows="10" cols="80"></textarea> |
|
16 </p> |
|
17 <pre id="test"> |
|
18 <script type="application/javascript"> |
|
19 |
|
20 /** Test for Bug 468167 **/ |
|
21 |
|
22 SimpleTest.waitForExplicitFinish(); |
|
23 SimpleTest.waitForFocus(runTests); |
|
24 |
|
25 function runTests() |
|
26 { |
|
27 var ta = document.getElementById("ta"); |
|
28 ta.focus(); |
|
29 is(ta.scrollTop, 0, "initially scrolled to top"); |
|
30 var s = ""; |
|
31 for (var i = 0; i < 40; ++i) { |
|
32 // three characters per line |
|
33 if (i < 10) |
|
34 s += "0"; |
|
35 s += i + "\n"; |
|
36 } |
|
37 ta.value = s; |
|
38 is(ta.scrollTop, 0, "scrolled to top after adding content"); |
|
39 ta.scrollTop = 9999; // scroll down as far as we can |
|
40 isnot(ta.scrollTop, 0, "scrolled down after scrolling down"); |
|
41 |
|
42 ta.setSelectionRange(0, 99); // 33 lines out of 40 |
|
43 |
|
44 // Send a backspace key event to delete the selection |
|
45 synthesizeKey("VK_BACK_SPACE", { }); |
|
46 |
|
47 is(ta.scrollTop, 0, "scrolled to top after deleting selection"); |
|
48 |
|
49 SimpleTest.finish(); |
|
50 } |
|
51 |
|
52 </script> |
|
53 </pre> |
|
54 </body> |
|
55 </html> |