| 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 | |
| 17 <div id="outer_container" style="height: 100px; overflow: scroll"> | |
| 18 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 19 <div id="inner_container" style="height: 100px; overflow: scroll"> | |
| 20 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 21 <button id="target">Target</button> | |
| 22 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 23 </div> | |
| 24 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 25 </div> | |
| 26 | |
| 27 <div style="border: 1px solid #000; height: 5000px;">5000-pixel box</div> | |
| 28 | |
| 29 <div id="console"></div> | |
| 30 | |
| 31 <script> | |
| 32 description("Tests that scrolling an element to a specific point can successfull
y scroll multiple nested scrolling views'."); | |
| 33 | |
| 34 function runTest() { | |
| 35 window.outerContainer = document.getElementById("outer_container"); | |
| 36 window.innerContainer = document.getElementById("inner_container"); | |
| 37 window.target = document.getElementById("target"); | |
| 38 | |
| 39 if (window.accessibilityController) { | |
| 40 target.focus(); | |
| 41 var targetAccessibleObject = accessibilityController.focusedElement; | |
| 42 } | |
| 43 | |
| 44 // Reset the initial scroll positions (since calling focus() can scroll the
page too). | |
| 45 window.scrollTo(0, 0); | |
| 46 outerContainer.scrollTop = 0; | |
| 47 innerContainer.scrollTop = 0; | |
| 48 shouldBe("window.pageYOffset", "0"); | |
| 49 shouldBe("outerContainer.scrollTop", "0"); | |
| 50 shouldBe("innerContainer.scrollTop", "0"); | |
| 51 shouldBeGreaterThanOrEqual("target.getBoundingClientRect().top", "15000"); | |
| 52 | |
| 53 // Scroll to various locations and check. | |
| 54 | |
| 55 if (window.accessibilityController) | |
| 56 targetAccessibleObject.scrollToGlobalPoint(0, 0); | |
| 57 shouldBe("target.getBoundingClientRect().top", "0"); | |
| 58 | |
| 59 if (window.accessibilityController) | |
| 60 targetAccessibleObject.scrollToGlobalPoint(0, 300); | |
| 61 shouldBe("target.getBoundingClientRect().top", "300"); | |
| 62 | |
| 63 if (window.accessibilityController) | |
| 64 targetAccessibleObject.scrollToGlobalPoint(0, 3000); | |
| 65 shouldBe("target.getBoundingClientRect().top", "3000"); | |
| 66 | |
| 67 finishJSTest(); | |
| 68 } | |
| 69 | |
| 70 runTest(); | |
| 71 | |
| 72 </script> | |
| 73 | |
| 74 <script src="../../../fast/js/resources/js-test-post.js"></script> | |
| 75 </body> | |
| 76 </html> | |
| OLD | NEW |