blob: 1472f2b0f7dc9d5c3e7cb7b0e5dd9b27d0694df3 [file] [log] [blame]
<!DOCTYPE html> <!-- webkit-test-runner [ MockScrollbarsEnabled=false AsyncOverflowScrollingEnabled=true ] -->
<html>
<head>
<style>
body {
height: 1000px;
}
.scroller {
margin: 10px;
width: 200px;
height: 200px;
border: 1px solid black;
overflow: auto;
}
.contents {
width: 100%;
height: 200%;
}
</style>
<script src="../../../../resources/js-test-pre.js"></script>
<script src="../../../../resources/ui-helper.js"></script>
<script>
jsTestIsAsync = true;
if (window.internals)
internals.setUsesOverlayScrollbars(true);
async function doTest()
{
description('Test maybegin and cancelled on overflow');
if (!window.internals) {
finishJSTest();
return;
}
const scroller = document.querySelector('.scroller');
const scrollerBounds = scroller.getBoundingClientRect();
const x = scrollerBounds.left + 10;
const y = scrollerBounds.top + 10;
debug('Initial state');
debug(internals.verticalScrollbarState(scroller));
debug('MayBegin should show the scrollbar');
await UIHelper.mouseWheelMayBeginAt(x, y);
await UIHelper.waitForCondition(() => {
let state = internals.verticalScrollbarState(scroller);
let visible = state.indexOf('visible_thumb') != -1;
if (visible)
testPassed('Scrollbar state: ' + state);
return visible;
});
debug('Cancelled should hide the scrollbar');
await UIHelper.mouseWheelCancelAt(x, y);
await UIHelper.waitForCondition(() => {
let state = internals.verticalScrollbarState(scroller);
let hidden = state.indexOf('visible_thumb') == -1;
if (hidden)
testPassed('Scrollbar state: ' + state);
return hidden;
});
finishJSTest();
}
window.addEventListener('load', () => {
doTest();
}, false);
</script>
</head>
<body>
<div class="scroller">
<div class="contents"></div>
</div>
<div id="console"></div>
<script src="../../../../resources/js-test-post.js"></script>
</body>
</html>