blob: a85086a392c5ce73feae4cec6fcc9b0612e22f21 [file] [edit]
<!DOCTYPE html>
<html>
<head>
<style>
body {
height: 5000px;
background-image: repeating-linear-gradient(transparent, silver 500px);
}
</style>
<script src="../../../resources/ui-helper.js"></script>
<script src="../../../resources/js-test.js"></script>
<script>
jsTestIsAsync = true;
description('When canceling an animated scroll, we should not trigger a scroll from zero.');
window.addEventListener('load', async () => {
const startingScrollOffset = 400;
window.scrollTo(0, startingScrollOffset);
window.addEventListener('scroll', () => {
if (window.scrollY < startingScrollOffset)
testFailed(`We should never see a scroll offset less than ${startingScrollOffset} - saw ${window.scrollY}`);
}, false);
setTimeout(() => {
window.scrollTo({ top: 500, behavior: 'smooth' });
}, 10);
await UIHelper.startMonitoringWheelEvents();
setTimeout(() => {
window.scrollTo({ top: 520, behavior: 'smooth' });
}, 60);
await UIHelper.waitForScrollCompletion();
finishJSTest();
}, false);
</script>
</head>
<body>
<div class="scroller">
<div class="content"></div>
</div>
<div id="console"></div>
</body>
</html>