From 17b47b38b973f15f5b3617f493bb2c7d245175f1 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 17 Nov 2026 10:12:33 +0100 Subject: [PATCH] test(places): wait for the new tag's tick, not only the tag The tag reaches the trip's list before the form ticks it, so the button could be found in the moment between and read as not pressed. --- client/src/components/Planner/PlaceFormModal.tags.test.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/src/components/Planner/PlaceFormModal.tags.test.tsx b/client/src/components/Planner/PlaceFormModal.tags.test.tsx index 214d0032e..9aeb2ece4 100644 --- a/client/src/components/Planner/PlaceFormModal.tags.test.tsx +++ b/client/src/components/Planner/PlaceFormModal.tags.test.tsx @@ -87,10 +87,8 @@ describe('PlaceFormModal, the tags', () => { await user.type(field, 'Viewpoint{Enter}'); - expect(await within(tagGroup()).findByRole('button', { name: 'Viewpoint' })).toHaveAttribute( - 'aria-pressed', - 'true' - ); + // The tag reaches the trip first and is ticked a beat later, so wait for the tick itself. + await waitFor(() => expect(tagSwitch('Viewpoint')).toHaveAttribute('aria-pressed', 'true')); expect(sent).toMatchObject({ name: 'Viewpoint' }); expect(field).toHaveValue(''); expect(useTripStore.getState().tripTags.map((tag) => tag.name)).toEqual(['Monument', 'Viewpoint', 'Zone']);