blob: fbfec2418369ed6cd19a64a290b01f1c4ecea7eb [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<style>
body {
height: 2000px;
}
</style>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description('Tests that programmatic scrolling works at page load time.');
var scrollEventCount = 0;
window.addEventListener('scroll', function(e) {
++scrollEventCount;
debug('Received scroll event ' + scrollEventCount);
}, false);
// window.scrollTo(0, 0);
function onPageLoad()
{
window.scrollTo(0, 10);
setTimeout(() => {
requestAnimationFrame(() => {
shouldBe('scrollEventCount', '1');
shouldBe('window.scrollY', '10');
finishJSTest();
});
}, 10); // Scroll events are async.
};
window.addEventListener('load', onPageLoad, false);
var successfullyParsed = true;
var jsTestIsAsync = true;
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>