mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'
This commit is contained in:
parent
ace9b32b1c
commit
df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions
|
@ -0,0 +1,95 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<title>
|
||||
Updating the scroll-snap-type of the root element should make it resnap accordingly.
|
||||
This is another vairant of changing-scroll-snap-type.html for the root element.
|
||||
</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#re-snap" />
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
div {
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
html {
|
||||
overflow: hidden;
|
||||
scroll-snap-type: none;
|
||||
}
|
||||
|
||||
#y-target {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
top: 100px;
|
||||
left: 0;
|
||||
background-color: green;
|
||||
scroll-snap-align: start none;
|
||||
}
|
||||
|
||||
#x-target {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
top: 0;
|
||||
left: 100px;
|
||||
background-color: red;
|
||||
scroll-snap-align: none start;
|
||||
}
|
||||
|
||||
.area {
|
||||
width: 1000vw;
|
||||
height: 1000vh;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="area"></div>
|
||||
<div id="x-target"></div>
|
||||
<div id="y-target"></div>
|
||||
|
||||
<script>
|
||||
const x_target = document.getElementById("x_target");
|
||||
const y_target = document.getElementById("y_target");
|
||||
const scroller = document.documentElement;
|
||||
|
||||
function cleanup() {
|
||||
scroller.style.setProperty("scroll-snap-type", "none");
|
||||
}
|
||||
|
||||
test(t => {
|
||||
t.add_cleanup(cleanup);
|
||||
scroller.scrollTo(0,0);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
|
||||
scroller.style.setProperty("scroll-snap-type", "y mandatory");
|
||||
assert_equals(scroller.scrollTop, 100);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
}, "Changing the scroller's snap type to y should make it resnap on the y-axis.");
|
||||
|
||||
test(t => {
|
||||
t.add_cleanup(cleanup);
|
||||
scroller.scrollTo(0,0);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
|
||||
scroller.style.setProperty("scroll-snap-type", "x mandatory");
|
||||
assert_equals(scroller.scrollLeft, 100);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
}, "Changing the scroller's snap type to x should make it resnap on the x-axis.");
|
||||
|
||||
|
||||
test(t => {
|
||||
t.add_cleanup(cleanup);
|
||||
scroller.scrollTo(0,0);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
|
||||
scroller.style.setProperty("scroll-snap-type", "x mandatory");
|
||||
assert_equals(scroller.scrollLeft, 100);
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
|
||||
scroller.style.setProperty("scroll-snap-type", "y mandatory");
|
||||
assert_equals(scroller.scrollTop, 100);
|
||||
}, "Changing the scroller's snap type axis should make it resnap.");
|
||||
</script>
|
||||
</html>
|
|
@ -0,0 +1,66 @@
|
|||
<!DOCTYPE html>
|
||||
<title>
|
||||
Not re-snap once after a scroll operation has finished without snapping
|
||||
because the scroll destination was outside of the snap proximity threshold.
|
||||
</title>
|
||||
<!-- This test assumes that all major browsers' default scroll-snap proximity
|
||||
thresholds are greater than 200px. -->
|
||||
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#re-snap" />
|
||||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1780154">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<style>
|
||||
div {
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#scroller {
|
||||
height: 600px;
|
||||
width: 600px;
|
||||
overflow: hidden;
|
||||
scroll-snap-type: y proximity;
|
||||
}
|
||||
|
||||
.snap {
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
background-color: green;
|
||||
scroll-snap-align: start;
|
||||
}
|
||||
|
||||
.area {
|
||||
width: 2000px;
|
||||
height: 2000px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="scroller">
|
||||
<div class="area"></div>
|
||||
<div class="snap" style="top: 0px;"></div>
|
||||
<div class="snap" style="top: 500px;"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
test(() => {
|
||||
// The initial snap position is at (0, 0).
|
||||
assert_equals(scroller.scrollTop, 0);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
|
||||
// Scroll to a position where it's outside of the scroll-snap proximity
|
||||
// threshold, so that it won't trigger snapping.
|
||||
scroller.scrollTo(0, 250);
|
||||
|
||||
assert_equals(scroller.scrollTop, 250);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
|
||||
// Changing the initial snap target position, but still it's outside of the
|
||||
// threshold.
|
||||
document.querySelectorAll(".snap")[0].style.top = "10px";
|
||||
|
||||
// Not re-snap to the last snap point.
|
||||
assert_equals(scroller.scrollTop, 250);
|
||||
assert_equals(scroller.scrollLeft, 0);
|
||||
}, "Not re-snap once after a scroll operation has finished without snapping " +
|
||||
"because the scroll destination was outside of the snap proximity threshold.");
|
||||
</script>
|
|
@ -74,7 +74,7 @@ const x_target = document.getElementById("x-axis-target");
|
|||
const y_target = document.getElementById("y-axis-target");
|
||||
const scroller = document.getElementById("scroller");
|
||||
|
||||
test(() => {
|
||||
test(t => {
|
||||
// The scroller should be snapped to the two closest points on first layout.
|
||||
assert_equals(scroller.scrollTop, 200);
|
||||
assert_equals(scroller.scrollLeft, 200);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue