diff options
Diffstat (limited to 'testing/web-platform/tests/css/css-scroll-snap-2/snapchanged')
7 files changed, 24 insertions, 115 deletions
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 4272412073..a3ba05fdf5 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; - assertSnapEventDeprecated(evt, [outer_snap_area.id, inner_snap_area.id]); + assertSnapEvent(evt, { block: inner_snap_area, inline: null }); 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; - assertSnapEventDeprecated(evt, [outer_snap_area.id, inner_snap_area.id]); + assertSnapEvent(evt, { block: inner_snap_area, inline: null }); 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; - assertSnapEventDeprecated(evt, []); + assertSnapEvent(evt, { block: null, inline: null }); snapchanged_promise = waitForSnapChangedEvent(scroller, false); scroller.style.scrollSnapType = "y mandatory"; evt = await snapchanged_promise; - assertSnapEventDeprecated(evt, [outer_snap_area.id]); + assertSnapEvent(evt, { block: outer_snap_area, inline: null }); }, "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; - assertSnapEventDeprecated(evt, []); + assertSnapEvent(evt, { block: null, inline: null }); snapchanged_promise = waitForSnapChangedEvent(scroller, false); inner_snap_area.style.scrollSnapAlign = "start"; outer_snap_area.style.scrollSnapAlign = "start"; evt = await snapchanged_promise; - assertSnapEventDeprecated(evt, [outer_snap_area.id]); + assertSnapEvent(evt, { block: outer_snap_area, inline: null }); }, "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 deleted file mode 100644 index f87b6137f1..0000000000 --- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-ensures-dom-order.html +++ /dev/null @@ -1,95 +0,0 @@ -<!DOCTYPE html> -<html> - -<head> - <link rel="help" href="https://drafts.csswg.org/css-scroll-snap-2/#snap-events" /> - <script src="/resources/testharness.js"></script> - <script src="/resources/testharnessreport.js"></script> - <script src="/dom/events/scrolling/scroll_support.js"></script> - <script src="/css/css-scroll-snap-2/resources/common.js"></script> - <script src="/web-animations/testcommon.js"></script> - <style> - #scroller { - overflow-y: scroll; - scroll-snap-type: y mandatory; - width: 500px; - height: 500px; - background-color: white; - position: relative; - } - .space_filler { - display: inline-block; - width: 40%; - height: 30%; - background-color: green; - } - .snap_area { - scroll-snap-align: start; - background-color: yellow; - position: absolute; - width: 40%; - height: 30%; - } - - #snap_point_1 { - left: 1px; - } - #snap_point_2 { - left: 80%; - } - #snap_point_3 { - left: 40%; - scroll-snap-align: start; - background-color: yellow; - position: absolute; - width: 40%; - height: 30%; - } - </style> -</head> -<body> - <div id="scroller"> - <div class="space_filler"></div> - <div class="space_filler"></div> - <div class="space_filler"></div> - <div class="space_filler"></div> - <div class="space_filler"></div> - <div class="space_filler"></div> - <div class="space_filler"></div> - <div class="space_filler"></div> - <div id="snap_point_1" class="snap_area"><h1>1</h1></div> - <div id="snap_point_2" class="snap_area"><h1>2</h1></div> - </div> - <script> - promise_test(async (t) => { - checkSnapEventSupport("snapchanged"); - await waitForCompositorCommit(); - const snapchanged_promise = waitForSnapChangedEvent(scroller, false); - const snap_point_3 = document.createElement("div"); - snap_point_3.id = "snap_point_3"; - t.add_cleanup(() => { - snap_point_3.remove(); - }); - scroller.insertBefore(snap_point_3, snap_point_2); - const evt_seen = await snapchanged_promise; - assertSnapEventDeprecated(evt_seen, - [snap_point_1.id, snap_point_3.id, snap_point_2.id]); - }, "snapchanged lists snapTargets in DOM order."); - - promise_test(async (t) => { - checkSnapEventSupport("snapchanged"); - await waitForCompositorCommit(); - const unreached_func = t.unreached_func("snapchanged shouldn't fire " + - "since the scroller is snapped to the same elements despite the " + - "dom order change."); - t.add_cleanup(() => { - scroller.removeEventListener("snapchanged", unreached_func); - }) - scroller.addEventListener("snapchanged", unreached_func); - scroller.insertBefore(snap_point_2, snap_point_1); - await waitForCompositorCommit(); - }, "DOM order change doesn't trigger snapchanged if snapped targets " + - "don't change."); - </script> -</body> -</html> 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 7c7b48152e..98ec2e5d75 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 @@ -69,7 +69,7 @@ scrolling_function: () => { scroller.scrollTo(snap_point_2.offsetLeft, snap_point_2.offsetTop); }, - expected_snap_targets: [snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_2 }, expected_scroll_offsets: { x: snap_point_2.offsetLeft, y: snap_point_2.offsetTop, @@ -110,7 +110,7 @@ scroller.scrollTo(scroll_left_target, scroll_top_target); evt = await snapchanged_promise; - assertSnapEventDeprecated(evt, [snap_point_2.id]); + assertSnapEvent(evt, { block: snap_point_2, inline: snap_point_2 }); 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 1fb56212a3..9dff856f34 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 @@ -76,7 +76,7 @@ scrolling_function: () => { scroller.scrollTo(snap_point_2.offsetLeft, snap_point_2.offsetTop); }, - expected_snap_targets: [snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_2 }, expected_scroll_offsets: { x: snap_point_2.offsetLeft, y: snap_point_2.offsetTop, @@ -115,7 +115,7 @@ scroller.scrollTo(scroll_left_target, scroll_top_target); evt = await snapchanged_promise; - assertSnapEventDeprecated(evt, [snap_point_2.id]); + assertSnapEvent(evt, { block: snap_point_2, inline: snap_point_2 }) 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-user-root-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-user-root-scroll.tentative.html index 5405d778bf..127376caa2 100644 --- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-user-root-scroll.tentative.html +++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-user-root-scroll.tentative.html @@ -64,6 +64,8 @@ <div id="snap_point_3" class="snap_point"></div> <script> const scroller = document.scrollingElement; + const snap_point_2 = document.getElementById("snap_point_2"); + const snap_point_1 = document.getElementById("snap_point_1"); const offset_to_snap_point_2 = { x: snap_point_2.offsetLeft, y: snap_point_2.offsetTop @@ -82,7 +84,7 @@ scrolling_function: async () => { await snap_event_touch_scroll_helper(start_pos, end_pos); }, - expected_snap_targets: [snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_2 }, expected_scroll_offsets: { x: offset_to_snap_point_2.x, y: offset_to_snap_point_2.y, @@ -102,7 +104,7 @@ offset_to_snap_point_2.y, { origin: scroller }).send(); }, - expected_snap_targets: [snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_2 }, expected_scroll_offsets: { x: offset_to_snap_point_2.x, y: offset_to_snap_point_2.y, @@ -132,7 +134,7 @@ await snap_event_scrollbar_drag_helper(scroller, scrollbar_width, drag_amt); }, - expected_snap_targets: [snap_point_1.id, snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_1 }, expected_scroll_offsets: { x: 0, y: offset_to_snap_point_2.y, @@ -150,7 +152,7 @@ window.test_driver.send_keys(document.documentElement, '\ue015'/*ArrowDown*/); }, - expected_snap_targets: [snap_point_1.id, snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_1 }, expected_scroll_offsets: { x: 0, y: offset_to_snap_point_2.y, diff --git a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-user-scroll.tentative.html b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-user-scroll.tentative.html index 4f36200722..91194642b5 100644 --- a/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-user-scroll.tentative.html +++ b/testing/web-platform/tests/css/css-scroll-snap-2/snapchanged/snapchanged-on-user-scroll.tentative.html @@ -71,6 +71,8 @@ </div> <script> const scroller = document.getElementById("scroller"); + const snap_point_1 = document.getElementById("snap_point_1"); + const snap_point_2 = document.getElementById("snap_point_2"); const offset_to_snap_point_2 = { x: snap_point_2.offsetLeft, y: snap_point_2.offsetTop @@ -89,7 +91,7 @@ scrolling_function: async () => { await snap_event_touch_scroll_helper(start_pos, end_pos); }, - expected_snap_targets: [snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_2 }, expected_scroll_offsets: { x: offset_to_snap_point_2.x, y: offset_to_snap_point_2.y, @@ -109,7 +111,7 @@ offset_to_snap_point_2.y, { origin: scroller }).send(); }, - expected_snap_targets: [snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_2 }, expected_scroll_offsets: { x: offset_to_snap_point_2.x, y: offset_to_snap_point_2.y, @@ -136,7 +138,7 @@ scrollbar_to_scroller_ratio; await snap_event_scrollbar_drag_helper(scroller, scrollbar_width, drag_amt); }, - expected_snap_targets: [snap_point_1.id, snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_1 }, expected_scroll_offsets: { x: 0, y: offset_to_snap_point_2.y, @@ -154,7 +156,7 @@ scroller.focus(); window.test_driver.send_keys(scroller, '\ue015'/*ArrowDown*/); }, - expected_snap_targets: [snap_point_1.id, snap_point_2.id], + expected_snap_targets: { block: snap_point_2, inline: snap_point_1 }, expected_scroll_offsets: { x: 0, y: offset_to_snap_point_2.y, 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 6a874e82f2..96cab33739 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); - assertSnapEventDeprecated(evt, []); + assertSnapEvent(evt, { block: null, inline: null }); 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. - assertSnapEventDeprecated(evt, [target.id]); + assertSnapEvent(evt, { block: target, inline: null }); }, "Snapchanged fires when scrolling outside proximity range."); </script> </body> |