From 9d5aee5cba18d924aab092b0a61c9113b2dded0f Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sat, 24 Oct 2026 16:30:37 -0700 Subject: [PATCH] test(DateInput): the wheel pinch-zoom spec opens its minute wheel at a fixed time The spec's story has a bottom-sheet TimeInput with no value, so its Minute wheel opens on the current minute, and the minute list ends at 59. The one-finger case drags the wheel up 120 px and asserted that it scrolled more than 60 px, so a run in the last minutes of an hour failed: from :57 the column can scroll only two 28 px rows before it reaches row 59 (1596 to 1652, the pr-a11y failure on #8123), and from :59 none at all. The spec now pins the clock to 10:30 before the story loads, polls scrollTop instead of sleeping 600 ms, and asks for at least one row, measured from the rendered option. --- .../WheelPinchZoom.a11y.chromium.spec.ts | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/core/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts b/packages/core/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts index c6357324b83b5..4b4cc826603b9 100644 --- a/packages/core/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts +++ b/packages/core/src/DateInput/__tests__/WheelPinchZoom.a11y.chromium.spec.ts @@ -42,6 +42,13 @@ test.use({ deviceScaleFactor: 3, }); +// The story's bottom-sheet TimeInput has no value, so its Minute wheel opens on +// the current minute, and the minute list ends at 59: a run near the end of an +// hour has no rows left to scroll. A fixed clock opens it on :30. +test.beforeEach(async ({page}) => { + await page.clock.setFixedTime(new Date(2026, 0, 1, 10, 30)); +}); + const sleep = async (ms: number) => new Promise(resolve => setTimeout(resolve, ms)); @@ -149,10 +156,15 @@ test('one finger dragged up a wheel still scrolls it and leaves the page at scal type: 'touchEnd', touchPoints: [], }); - await sleep(600); - - expect(await wheel.evaluate(el => el.scrollTop)).toBeGreaterThan( - scrollTopBefore + 60, - ); + // From :30 the drag has rows to go. The column snaps to its rows: this asks + // that one finger scrolled it by at least one row, and left the page at + // scale 1. + const row = await wheel + .locator('[role="option"]') + .first() + .evaluate(el => el.getBoundingClientRect().height); + await expect + .poll(async () => wheel.evaluate(el => el.scrollTop), {timeout: 5000}) + .toBeGreaterThanOrEqual(scrollTopBefore + row); expect(await pageScale(page)).toBe(1); });