3 <script src=
"../resources/js-test.js"></script>
12 <p id=
"description"></p>
14 <div style=
"border: 1px solid #000; height: 5000px;">5000-pixel box
</div>
15 <button id=
"target">Target
</button>
16 <div style=
"border: 1px solid #000; height: 5000px;">5000-pixel box
</div>
18 <div id=
"console"></div>
21 description("Tests that scrolling an element to a specific point successfully scrolls the main window.");
24 var target
= document
.getElementById("target");
26 if (window
.accessibilityController
) {
28 var targetAccessibleObject
= accessibilityController
.focusedElement
;
31 // Reset the initial scroll position (since calling focus() can scroll the page too).
32 window
.scrollTo(0, 0);
33 shouldBe("window.pageYOffset", "0");
35 // Scroll to various locations and check.
36 if (window
.accessibilityController
)
37 targetAccessibleObject
.scrollToGlobalPoint(0, 0);
38 shouldBe("target.getBoundingClientRect().top", "0");
39 if (window
.accessibilityController
)
40 targetAccessibleObject
.scrollToGlobalPoint(0, 300);
41 shouldBe("target.getBoundingClientRect().top", "300");
42 if (window
.accessibilityController
)
43 targetAccessibleObject
.scrollToGlobalPoint(0, 3000);
44 shouldBe("target.getBoundingClientRect().top", "3000");