OLD | NEW |
1 <html> | 1 <html> |
2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
3 <script> | 3 <script> |
| 4 window.jsTestIsAsync = true; |
| 5 |
4 function getCenterFor(element) | 6 function getCenterFor(element) |
5 { | 7 { |
6 var rect = element.getBoundingClientRect(); | 8 var rect = element.getBoundingClientRect(); |
7 return { x : parseInt((rect.left + rect.right) / 2) , y : parseInt((rect.top +
rect.bottom) / 2)}; | 9 return { x : parseInt((rect.left + rect.right) / 2) , y : parseInt((rect.top +
rect.bottom) / 2)}; |
8 } | 10 } |
9 | 11 |
10 function runTest() | 12 function runTest() |
11 { | 13 { |
12 if (!window.testRunner) | 14 if (!window.testRunner) |
13 return; | 15 return; |
14 if (!window.eventSender) | 16 if (!window.eventSender) |
15 return; | 17 return; |
16 | 18 |
17 testRunner.waitUntilDone(); | 19 testRunner.waitUntilDone(); |
18 testRunner.dumpAsText(); | 20 testRunner.dumpAsText(); |
19 | 21 |
20 alert("Scroll position " + document.scrollingElement.scrollTop); | 22 alert("Scroll position " + document.scrollingElement.scrollTop); |
21 center = getCenterFor(document.getElementById("sp")); | 23 center = getCenterFor(document.getElementById("sp")); |
22 eventSender.mouseMoveTo(center.x, center.y); | 24 eventSender.mouseMoveTo(center.x, center.y); |
23 eventSender.mouseDown(); | 25 eventSender.mouseDown(); |
24 eventSender.mouseUp(); | 26 eventSender.mouseUp(); |
25 eventSender.keyDown("downArrow"); | 27 eventSender.keyDown("downArrow"); |
26 setTimeout(verifyScrolling, 15); | |
27 } | |
28 | 28 |
29 function verifyScrolling() | |
30 { | |
31 debug("Scroll position is more than 0"); | 29 debug("Scroll position is more than 0"); |
32 shouldBe("document.scrollingElement.scrollTop > 0", "true"); | 30 shouldBecomeEqual("document.scrollingElement.scrollTop > 0", "true", finishJST
est); |
33 testRunner.notifyDone(); | |
34 } | 31 } |
35 | 32 |
36 </script> | 33 </script> |
37 <style> | 34 <style> |
38 </style> | 35 </style> |
39 <body onload="runTest();"> | 36 <body onload="runTest();"> |
40 <input type="radio" id="myradio">Click the text below and then try to scroll.<br
> | 37 <input type="radio" id="myradio">Click the text below and then try to scroll.<br
> |
41 <div id="console"></div> | 38 <div id="console"></div> |
42 <br><br><br><br><br><br><br><br><br><br> | 39 <br><br><br><br><br><br><br><br><br><br> |
43 <span tabindex=1 id="sp">My span</span> | 40 <span tabindex=1 id="sp">My span</span> |
44 <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br> | 41 <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br> |
45 </body> | 42 </body> |
46 </html> | 43 </html> |
47 | 44 |
OLD | NEW |