-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug: 1122774 Change-Id: I95c5907ec95513550ac5522f6f4ff3a128613eba Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2844512 Commit-Queue: Kevin Ellis <[email protected]> Reviewed-by: Robert Flack <[email protected]> Cr-Commit-Position: refs/heads/master@{#875272} GitOrigin-RevId: 8bf44bf1845d1b0249b3eb4cf5147c052c436318
- Loading branch information
1 parent
51aec53
commit aeee286
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
67 changes: 67 additions & 0 deletions
67
blink/web_tests/fast/scroll-snap/snaps-after-wheel-scrolling-single-tick.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!DOCTYPE html> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script src="../../resources/gesture-util.js"></script> | ||
<!-- crbug.com/1122774 --> | ||
<style> | ||
#scroll-container { | ||
scroll-snap-type: y mandatory; | ||
width: 600px; | ||
height: 400px; | ||
background-color: skyblue; | ||
overflow-y: auto; | ||
} | ||
|
||
#scroll-container > div { | ||
scroll-snap-align: center; | ||
width: 100%; | ||
height: 400px; | ||
} | ||
|
||
#scroll-container > div:nth-child(even) { | ||
background-color: seagreen; | ||
} | ||
|
||
#scroll-container > div:nth-child(odd) { | ||
background-color: snow; | ||
} | ||
</style> | ||
|
||
<div id="scroll-container"> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
</div> | ||
|
||
|
||
<script> | ||
promise_test (async t => { | ||
const scrollDelta = 10; | ||
const isPreciseDelta = false; | ||
const xPos = 50; | ||
const yPos = 50; | ||
const scrollDirection = 'down'; | ||
const speed_in_pixels_per_s = 100; | ||
const scroller = document.getElementById('scroll-container'); | ||
|
||
const scrollTop = () => { return scroller.scrollTop; } | ||
const scrollPromise = waitForScrollEvent(scroller); | ||
|
||
await mouseMoveTo(xPos, yPos); | ||
await smoothScroll(scrollDelta, xPos, yPos, GestureSourceType.MOUSE_INPUT, | ||
scrollDirection, speed_in_pixels_per_s, isPreciseDelta); | ||
await scrollPromise; | ||
|
||
// Using a time based wait rather than waiting until a condition is met in | ||
// order to catch a secondary scroll snap triggered after gesture-scroll-end. | ||
await waitForAnimationEndTimeBased(scrollTop); | ||
assert_equals(scrollTop(), 400, 'Failed to stop at the first snap target'); | ||
}, 'mouse wheel does not skip over snap targets'); | ||
</script> |