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