mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Update web-platform-tests to revision 181f8381fe9373e027f4b5ba5d1439843ad2c2e6
This commit is contained in:
parent
0dda115609
commit
0355b8e70d
105 changed files with 2775 additions and 764 deletions
|
@ -0,0 +1,71 @@
|
|||
<!DOCTYPE html>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#scroll-snap-stop" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
div {
|
||||
position: absolute;
|
||||
}
|
||||
#scroller {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
overflow: scroll;
|
||||
scroll-snap-type: both mandatory;
|
||||
}
|
||||
#space {
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
width: 2100px;
|
||||
height: 2100px;
|
||||
}
|
||||
.target {
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
scroll-snap-align: start;
|
||||
}
|
||||
.origin {
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
.always-stop {
|
||||
left: 100px;
|
||||
top: 0px;
|
||||
scroll-snap-stop: always;
|
||||
}
|
||||
.closer {
|
||||
left: 200px;
|
||||
top: 0px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="scroller">
|
||||
<div id="space"></div>
|
||||
<div class="target origin"></div>
|
||||
<div class="target always-stop"></div>
|
||||
<div class="target closer"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
var scroller = document.getElementById("scroller");
|
||||
test(() => {
|
||||
scroller.scrollTo(0, 0);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
|
||||
scroller.scrollBy(300, 0);
|
||||
assert_equals(scroller.scrollLeft, 100);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
}, "A scroll with intended direction and end position should not pass a snap " +
|
||||
"area with scroll-snap-stop: always.")
|
||||
|
||||
test(() => {
|
||||
scroller.scrollTo(0, 0);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
|
||||
scroller.scrollTo(300, 0);
|
||||
assert_equals(scroller.scrollLeft, 200);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
}, "A scroll with intended end position should always choose the closest snap " +
|
||||
"position regardless of the scroll-snap-stop value.")
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue