summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scroll-snap-2
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /testing/web-platform/tests/css/css-scroll-snap-2
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-scroll-snap-2')
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/resources/common.js10
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-after-layout-change.tentative.html12
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-ensures-dom-order.html2
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-root-scroll.tentative.html2
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-scroll.tentative.html2
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-with-proximity-strictness.tentative.html4
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-after-layout-change.tentative.html4
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-root-scroll.tentative.html2
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-scroll.tentative.html2
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-root-scroll.tentative.html12
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-scroll.tentative.html12
11 files changed, 33 insertions, 31 deletions
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/resources/common.js b/testing/web-platform/tests/css/css-scroll-snap-2/resources/common.js
index 1a2edab90b..a641553bea 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/resources/common.js
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/resources/common.js
@@ -8,7 +8,8 @@ function checkSnapEventSupport(event_type) {
}
}
-function assertSnapEvent(evt, expected_ids) {
+// This function is deprecated. It tests a deprecated SnapEvent interface.
+function assertSnapEventDeprecated(evt, expected_ids) {
assert_equals(evt.bubbles, false, "snap events don't bubble");
assert_false(evt.cancelable, "snap events are not cancelable.");
const actual = Array.from(evt.snapTargets, el => el.id).join(",");
@@ -16,6 +17,7 @@ function assertSnapEvent(evt, expected_ids) {
assert_equals(actual, expected, "snap event supplied expected targets");
}
+// This function is deprecated. It tests a deprecated SnapEvent interface.
// This function holds logic intended to be used by tests for scroll snap
// events.
// |test_data| should contain:
@@ -29,7 +31,7 @@ function assertSnapEvent(evt, expected_ids) {
// should be after scrolling function has been
// executed.
// |event_type|: should be "snapchanged" or "snapchanging".
-async function test_snap_event(test, test_data, event_type) {
+async function test_snap_event_deprecated(test, test_data, event_type) {
checkSnapEventSupport(event_type);
await waitForScrollReset(test, test_data.scroller);
@@ -40,7 +42,7 @@ async function test_snap_event(test, test_data, event_type) {
await test_data.scrolling_function();
let evt = await event_promise;
- assertSnapEvent(evt, test_data.expected_snap_targets);
+ assertSnapEventDeprecated(evt, test_data.expected_snap_targets);
assert_approx_equals(test_data.scroller.scrollTop,
test_data.expected_scroll_offsets.y, 1,
"vertical scroll offset mismatch.");
@@ -50,7 +52,7 @@ async function test_snap_event(test, test_data, event_type) {
}
async function test_snapchanged(test, test_data) {
- await test_snap_event(test, test_data, "snapchanged");
+ await test_snap_event_deprecated(test, test_data, "snapchanged");
}
function waitForEventUntil(event_target, event_type, wait_until) {
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-after-layout-change.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-after-layout-change.tentative.html
index 293400edda..4272412073 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-after-layout-change.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-after-layout-change.tentative.html
@@ -81,7 +81,7 @@
inner_snap_area.style.height =
`${scroller.clientHeight + inner_snap_area.clientHeight - 10}px`;
const evt = await snapchanged_promise;
- assertSnapEvent(evt, [outer_snap_area.id, inner_snap_area.id]);
+ assertSnapEventDeprecated(evt, [outer_snap_area.id, inner_snap_area.id]);
target_snap_position = inner_snap_area.offsetTop +
inner_snap_area.offsetHeight - scroller.clientHeight;
assert_equals(scroller.scrollTop, target_snap_position,
@@ -107,7 +107,7 @@
inner_snap_area.style.height =
`${scroller.clientHeight + inner_snap_area.clientHeight + 10}px`;
const evt = await snapchanged_promise;
- assertSnapEvent(evt, [outer_snap_area.id, inner_snap_area.id]);
+ assertSnapEventDeprecated(evt, [outer_snap_area.id, inner_snap_area.id]);
assert_equals(scroller.scrollTop, target_snap_position,
"scroller maintains offset which is now covering within inner area");
}, "snapchanged fires after snap area is snapped to upon layout change " +
@@ -119,11 +119,11 @@
let snapchanged_promise = waitForSnapChangedEvent(scroller, false);
scroller.style.scrollSnapType = "none";
let evt = await snapchanged_promise;
- assertSnapEvent(evt, []);
+ assertSnapEventDeprecated(evt, []);
snapchanged_promise = waitForSnapChangedEvent(scroller, false);
scroller.style.scrollSnapType = "y mandatory";
evt = await snapchanged_promise;
- assertSnapEvent(evt, [outer_snap_area.id]);
+ assertSnapEventDeprecated(evt, [outer_snap_area.id]);
}, "snapchanged fires when container stops snapping");
promise_test(async(t) => {
@@ -133,12 +133,12 @@
inner_snap_area.style.scrollSnapAlign = "none";
outer_snap_area.style.scrollSnapAlign = "none";
let evt = await snapchanged_promise;
- assertSnapEvent(evt, []);
+ assertSnapEventDeprecated(evt, []);
snapchanged_promise = waitForSnapChangedEvent(scroller, false);
inner_snap_area.style.scrollSnapAlign = "start";
outer_snap_area.style.scrollSnapAlign = "start";
evt = await snapchanged_promise;
- assertSnapEvent(evt, [outer_snap_area.id]);
+ assertSnapEventDeprecated(evt, [outer_snap_area.id]);
}, "snapchanged fires when snap container no longer has snap areas");
</script>
</body>
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-ensures-dom-order.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-ensures-dom-order.html
index 10bc73b622..f87b6137f1 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-ensures-dom-order.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-ensures-dom-order.html
@@ -72,7 +72,7 @@
});
scroller.insertBefore(snap_point_3, snap_point_2);
const evt_seen = await snapchanged_promise;
- assertSnapEvent(evt_seen,
+ assertSnapEventDeprecated(evt_seen,
[snap_point_1.id, snap_point_3.id, snap_point_2.id]);
}, "snapchanged lists snapTargets in DOM order.");
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-root-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-root-scroll.tentative.html
index 2e33c3c970..7c7b48152e 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-root-scroll.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-root-scroll.tentative.html
@@ -110,7 +110,7 @@
scroller.scrollTo(scroll_left_target, scroll_top_target);
evt = await snapchanged_promise;
- assertSnapEvent(evt, [snap_point_2.id]);
+ assertSnapEventDeprecated(evt, [snap_point_2.id]);
assert_approx_equals(scroller.scrollTop, snap_point_2.offsetTop, 1,
"scroller snaps to the top of snap_point_2");
assert_approx_equals(scroller.scrollLeft, snap_point_2.offsetLeft, 1,
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-scroll.tentative.html
index 6082e09013..1fb56212a3 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-scroll.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-programmatic-scroll.tentative.html
@@ -115,7 +115,7 @@
scroller.scrollTo(scroll_left_target, scroll_top_target);
evt = await snapchanged_promise;
- assertSnapEvent(evt, [snap_point_2.id]);
+ assertSnapEventDeprecated(evt, [snap_point_2.id]);
assert_approx_equals(scroller.scrollTop, snap_point_2.offsetTop, 1,
"scroller snaps to the top of snap_point_2");
assert_approx_equals(scroller.scrollLeft, snap_point_2.offsetLeft, 1,
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-with-proximity-strictness.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-with-proximity-strictness.tentative.html
index cb55054e6f..6a874e82f2 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-with-proximity-strictness.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-with-proximity-strictness.tentative.html
@@ -61,7 +61,7 @@
// to outside the proximity range and are no longer snapped.
let evt = await snapchanged_promise;
assert_equals(scroller.scrollTop, 250);
- assertSnapEvent(evt, []);
+ assertSnapEventDeprecated(evt, []);
evt = null;
snapchanged_promise = waitForSnapChangedEvent(scroller);
@@ -73,7 +73,7 @@
assert_equals(scroller.scrollTop, 0);
// snapchanged should fire as we've moved from outside the proximity range
// to inside the proximity range and are once again snapped.
- assertSnapEvent(evt, [target.id]);
+ assertSnapEventDeprecated(evt, [target.id]);
}, "Snapchanged fires when scrolling outside proximity range.");
</script>
</body>
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-after-layout-change.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-after-layout-change.tentative.html
index 5474b7ddce..ff307981e8 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-after-layout-change.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-after-layout-change.tentative.html
@@ -102,7 +102,7 @@
// assert snapchanging that should have already happened.
await scroll_promise;
- assertSnapEvent(snap_evt, [box2.id]);
+ assertSnapEventDeprecated(snap_evt, [box2.id]);
evt_promise = waitForSnapEvent(scroller, "snapchanging", false);
// Change layout while pointer is still down.
@@ -111,7 +111,7 @@
box2.style.left = box3_prev_left;
box3.style.left = box2_prev_left;
snap_evt = await evt_promise;
- assertSnapEvent(snap_evt, [box3.id]);
+ assertSnapEventDeprecated(snap_evt, [box3.id]);
}, "snapchanging fires after layout change");
</script>
</body>
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-root-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-root-scroll.tentative.html
index d031811c17..7044cfac96 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-root-scroll.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-root-scroll.tentative.html
@@ -80,7 +80,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "snapchanging fires on programmatic scrolls that changes a scroller's" +
" snap targets.");
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-scroll.tentative.html
index 5a0de1deb3..86946b84e9 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-scroll.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-programmatic-scroll.tentative.html
@@ -87,7 +87,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "snapchanging fires on programmatic scrolls that changes a scroller's" +
" snap targets.");
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-root-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-root-scroll.tentative.html
index 29d0239e2d..a9b003e6c5 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-root-scroll.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-root-scroll.tentative.html
@@ -92,7 +92,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "touch scrolling fires snapchanging.");
// Wheel scroll test.
@@ -110,7 +110,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "mouse wheel scroll triggers snapchanging.");
// Scrollbar drag test.
@@ -136,7 +136,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "scrollbar dragging fires snapchanging.");
// Keyboard test.
@@ -154,7 +154,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "keyboard scroll triggers snapchanging.");
// Touch scroll test: peek at snap_area_2 and then drag back to
@@ -183,8 +183,8 @@
.send();
let evts = await evts_promise;
assert_equals(evts.length, 2, "2 snapchanging events are seens");
- assertSnapEvent(evts[0], [snap_area_2.id]);
- assertSnapEvent(evts[1], [snap_area_1.id]);
+ assertSnapEventDeprecated(evts[0], [snap_area_2.id]);
+ assertSnapEventDeprecated(evts[1], [snap_area_1.id]);
}, "snapchanging fires as scroll moves through different snap targets.");
// snapchanging doesn't fire test.
diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-scroll.tentative.html
index 2c1f9742b6..28ca96ec93 100644
--- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-scroll.tentative.html
+++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanging/snapchanging-on-user-scroll.tentative.html
@@ -81,7 +81,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "touch scrolling fires snapchanging.");
// Wheel scroll test.
@@ -100,7 +100,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "mouse wheel scroll triggers snapchanging.");
// Scrollbar drag test.
@@ -127,7 +127,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "scrollbar dragging fires snapchanging.");
// Keyboard test.
@@ -145,7 +145,7 @@
y: snap_area_2.offsetTop
}
};
- await test_snap_event(t, test_data, "snapchanging");
+ await test_snap_event_deprecated(t, test_data, "snapchanging");
}, "keyboard scroll triggers snapchanging.");
// Touch scroll test: peek at snap_area_2 and then drag back to
@@ -174,8 +174,8 @@
.send();
let evts = await evts_promise;
assert_equals(evts.length, 2, "2 snapchanging events are seens");
- assertSnapEvent(evts[0], [snap_area_2.id]);
- assertSnapEvent(evts[1], [snap_area_1.id]);
+ assertSnapEventDeprecated(evts[0], [snap_area_2.id]);
+ assertSnapEventDeprecated(evts[1], [snap_area_1.id]);
}, "snapchanging fires as scroll moves through different snap targets.");
// snapchanging doesn't fire test.