| 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 </head> | |
| 6 <body> | |
| 7 | |
| 8 <p id="description"></p> | |
| 9 | |
| 10 <button id="upper_target">Upper Target</button> | |
| 11 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 12 <button id="lower_target">Lower Target</button> | |
| 13 | |
| 14 <div id="console"></div> | |
| 15 | |
| 16 <script> | |
| 17 description("Tests that scrolling to make an element visible successfully scroll
s the main window."); | |
| 18 | |
| 19 function runTest() { | |
| 20 var upperTarget = document.getElementById("upper_target"); | |
| 21 var lowerTarget = document.getElementById("lower_target"); | |
| 22 | |
| 23 if (window.accessibilityController) { | |
| 24 lowerTarget.focus(); | |
| 25 var lowerTargetAccessibleObject = accessibilityController.focusedElement
; | |
| 26 upperTarget.focus(); | |
| 27 var upperTargetAccessibleObject = accessibilityController.focusedElement
; | |
| 28 } | |
| 29 | |
| 30 // Reset the initial scroll position (since calling focus() can scroll the p
age too). | |
| 31 window.scrollTo(0, 0); | |
| 32 shouldBe("window.pageYOffset", "0"); | |
| 33 | |
| 34 // Scroll to make lower target visible and check. | |
| 35 if (window.accessibilityController) | |
| 36 lowerTargetAccessibleObject.scrollToMakeVisible(); | |
| 37 window.minYOffset = lowerTarget.offsetTop + lowerTarget.offsetHeight - windo
w.innerHeight; | |
| 38 window.maxYOffset = lowerTarget.offsetTop; | |
| 39 shouldBe("window.pageYOffset >= minYOffset", "true"); | |
| 40 shouldBe("window.pageYOffset <= maxYOffset", "true"); | |
| 41 | |
| 42 // Scroll to make upper target visible and check. | |
| 43 if (window.accessibilityController) | |
| 44 upperTargetAccessibleObject.scrollToMakeVisible(); | |
| 45 window.minYOffset = upperTarget.offsetTop + upperTarget.offsetHeight - windo
w.innerHeight; | |
| 46 window.maxYOffset = upperTarget.offsetTop; | |
| 47 shouldBe("window.pageYOffset >= minYOffset", "true"); | |
| 48 shouldBe("window.pageYOffset <= maxYOffset", "true"); | |
| 49 | |
| 50 finishJSTest(); | |
| 51 } | |
| 52 | |
| 53 runTest(); | |
| 54 | |
| 55 </script> | |
| 56 | |
| 57 <script src="../../../fast/js/resources/js-test-post.js"></script> | |
| 58 </body> | |
| 59 </html> | |
| OLD | NEW |