52 lines
1.6 KiB
HTML
52 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width">
|
|
<script src="../../../resources/js-test.js"></script>
|
|
<script src="../../../resources/ui-helper.js"></script>
|
|
</head>
|
|
<body>
|
|
<p id="description"></p>
|
|
<div id="console"></div>
|
|
<div id="test" style="height: 4096px; width: 256px; background-color: blue"></div>
|
|
<script>
|
|
window.jsTestIsAsync = true;
|
|
|
|
// This is used to detect if scrolling is completely broken.
|
|
const INITIAL_Y_OFFSET = 256;
|
|
|
|
function done()
|
|
{
|
|
document.body.removeChild(document.getElementById("test"));
|
|
finishJSTest();
|
|
}
|
|
|
|
async function runTest()
|
|
{
|
|
await UIHelper.callFunctionAndWaitForScrollToFinish(() => window.scrollTo(0, INITIAL_Y_OFFSET));
|
|
shouldBe("window.scrollY", "INITIAL_Y_OFFSET");
|
|
|
|
// Scroll to the end of the document.
|
|
await UIHelper.callFunctionAndWaitForScrollToFinish(() => {
|
|
if (window.testRunner)
|
|
UIHelper.keyDown("downArrow", ["metaKey"]);
|
|
});
|
|
shouldBeGreaterThanOrEqual("window.scrollY", "INITIAL_Y_OFFSET + 1");
|
|
|
|
|
|
// Scroll to the beginning of the document.
|
|
await UIHelper.callFunctionAndWaitForScrollToFinish(() => {
|
|
if (window.testRunner)
|
|
UIHelper.keyDown("upArrow", ["metaKey"]);
|
|
});
|
|
shouldBeZero("window.scrollY");
|
|
|
|
done();
|
|
}
|
|
|
|
description("Test key commands to scroll to the end of the document and then to the beginning of the document. To run this test by hand, reload the page then press <kbd>Command</kbd> + <kbd>Down Arrow</kbd> and then press <kbd>Command</kbd> + <kbd>Up Arrow</kbd>.");
|
|
runTest();
|
|
</script>
|
|
</body>
|
|
</html>
|