| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css"> | |
| 4 <script src="../../../fast/js/resources/js-test-pre.js"></script> | |
| 5 <style> | |
| 6 button { | |
| 7 border: 0; | |
| 8 } | |
| 9 </style> | |
| 10 </head> | |
| 11 <body> | |
| 12 | |
| 13 <p id="description"></p> | |
| 14 | |
| 15 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 16 <button id="target">Target</button> | |
| 17 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 18 | |
| 19 <div id="console"></div> | |
| 20 | |
| 21 <script> | |
| 22 description("Tests that scrolling an element to a specific point successfully sc
rolls the main window."); | |
| 23 | |
| 24 function runTest() { | |
| 25 var target = document.getElementById("target"); | |
| 26 | |
| 27 if (window.accessibilityController) { | |
| 28 target.focus(); | |
| 29 var targetAccessibleObject = accessibilityController.focusedElement; | |
| 30 } | |
| 31 | |
| 32 // Reset the initial scroll position (since calling focus() can scroll the p
age too). | |
| 33 window.scrollTo(0, 0); | |
| 34 shouldBe("window.pageYOffset", "0"); | |
| 35 | |
| 36 // Scroll to various locations and check. | |
| 37 if (window.accessibilityController) | |
| 38 targetAccessibleObject.scrollToGlobalPoint(0, 0); | |
| 39 shouldBe("target.getBoundingClientRect().top", "0"); | |
| 40 if (window.accessibilityController) | |
| 41 targetAccessibleObject.scrollToGlobalPoint(0, 300); | |
| 42 shouldBe("target.getBoundingClientRect().top", "300"); | |
| 43 if (window.accessibilityController) | |
| 44 targetAccessibleObject.scrollToGlobalPoint(0, 3000); | |
| 45 shouldBe("target.getBoundingClientRect().top", "3000"); | |
| 46 | |
| 47 finishJSTest(); | |
| 48 } | |
| 49 | |
| 50 runTest(); | |
| 51 | |
| 52 </script> | |
| 53 | |
| 54 <script src="../../../fast/js/resources/js-test-post.js"></script> | |
| 55 </body> | |
| 56 </html> | |
| OLD | NEW |