|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=586662 |
|
5 --> |
|
6 |
|
7 <head> |
|
8 <title>Test for Bug 586662</title> |
|
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
12 </head> |
|
13 |
|
14 <body> |
|
15 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=586662">Mozilla Bug 586662</a> |
|
16 <p id="display"><textarea onkeypress="this.style.overflow = 'hidden'"></textarea></p> |
|
17 <div id="content" style="display: none"> |
|
18 </div> |
|
19 |
|
20 <pre id="test"> |
|
21 <script type="application/javascript"> |
|
22 |
|
23 SimpleTest.waitForExplicitFinish(); |
|
24 SimpleTest.waitForFocus(function() { |
|
25 var t = document.querySelector("textarea"); |
|
26 t.focus(); |
|
27 synthesizeKey("a", {}); |
|
28 is(getComputedStyle(t, null).overflow, "hidden", "The event handler should be executed"); |
|
29 is(t.value, "a", "The key entry should result in a character being added to the field"); |
|
30 |
|
31 var win = window.open("file_bug586662.html", "_blank", |
|
32 "width=600,height=600,scrollbars=yes"); |
|
33 SimpleTest.waitForFocus(function() { |
|
34 // Make sure that focusing the textarea will cause the page to scroll |
|
35 var ed = win.document.getElementById("editor"); |
|
36 ed.focus(); |
|
37 setTimeout(function() { |
|
38 isnot(win.scrollY, 0, "Page is scrolled down"); |
|
39 // Scroll back up |
|
40 win.scrollTo(0, 0); |
|
41 setTimeout(function() { |
|
42 is(win.scrollY, 0, "Page is scrolled back up"); |
|
43 // Make sure that typing something into the textarea will cause the |
|
44 // page to scroll down |
|
45 synthesizeKey("a", {}, win); |
|
46 setTimeout(function() { |
|
47 isnot(win.scrollY, 0, "Page is scrolled down again"); |
|
48 |
|
49 win.close(); |
|
50 SimpleTest.finish(); |
|
51 }, 0); |
|
52 }, 0); |
|
53 }, 0); |
|
54 }, win); |
|
55 }); |
|
56 |
|
57 </script> |
|
58 </pre> |
|
59 </body> |
|
60 </html> |