From 411a6052feac019b66a6c8cfdf91ef19f6513b7e Mon Sep 17 00:00:00 2001 From: elmocito <42518790+elmocito@users.noreply.github.com> Date: Tue, 6 Oct 2026 13:41:07 +0200 Subject: [PATCH] test(planner): stabilize day auto-scroll tests --- client/src/components/Planner/DayPlanSidebar.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/src/components/Planner/DayPlanSidebar.test.tsx b/client/src/components/Planner/DayPlanSidebar.test.tsx index 58b49957c..ecaa3fdc1 100644 --- a/client/src/components/Planner/DayPlanSidebar.test.tsx +++ b/client/src/components/Planner/DayPlanSidebar.test.tsx @@ -194,6 +194,7 @@ const emptyDataTransfer = { setData: vi.fn(), effectAllowed: '', getData: vi.fn( beforeEach(() => { resetAllStores() vi.clearAllMocks() + Element.prototype.scrollTo = vi.fn() mockPermissions.canEdit = true mockPermissions.denied.clear() // clearAllMocks keeps implementations, so tests that swap the router out would @@ -1374,6 +1375,8 @@ describe('DayPlanSidebar', () => { render() await waitFor(() => expect(onSelectDay).toHaveBeenCalledWith(days[1].id, true)) + await act(async () => { await new Promise(resolve => requestAnimationFrame(() => resolve())) }) + expect(Element.prototype.scrollTo).toHaveBeenCalled() }) it('FE-PLANNER-DAYPLAN-196: a trip that is not running is left alone', async () => {