blob: 5a17dfcabea7b52ee35cbc1e24f8d0e243672f08 [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
<html>
<head>
<style>
body {
height: 2000px;
}
.scroller {
width: 620px;
height: 120px;
border: 1px solid black;
overflow-x: scroll;
scroll-snap-type: x mandatory;
}
.contents {
width: 200%;
}
.box {
scroll-snap-align: start;
width: 100px;
height: 100px;
margin: 10px;
background-color: blue;
display: inline-block;
}
.scroller.changed .box {
width: 110px;
}
</style>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../../resources/ui-helper.js"></script>
<script>
var jsTestIsAsync = true;
var scroller;
var beforeChangeScrollLeft;
async function scrollTest()
{
if (!window.eventSender) {
finishJSTest();
return;
}
eventSender.monitorWheelEvents();
eventSender.mouseMoveTo(20, 20);
eventSender.mouseScrollByWithWheelAndMomentumPhases(-1, 0, "began", "none");
eventSender.mouseScrollByWithWheelAndMomentumPhases(-20, 0, "changed", "none");
await UIHelper.waitForEvent(scroller, 'scroll');
await UIHelper.animationFrame();
beforeChangeScrollLeft = scroller.scrollLeft;
shouldBeTrue('beforeChangeScrollLeft > 0');
scroller.classList.add('changed');
await UIHelper.animationFrame();
shouldBe('beforeChangeScrollLeft', 'scroller.scrollLeft');
eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
await UIHelper.waitForScrollCompletion();
finishJSTest();
}
window.addEventListener('load', () => {
scroller = document.querySelector('.scroller');
setTimeout(scrollTest, 0);
}, false);
</script>
</head>
<body>
<div class="scroller">
<div class="contents">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
</div>
<div id="console"></div>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>