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.
This commit is contained in:
Maurice
2026-11-17 10:12:33 +01:00
parent 494c848ec9
commit 17b47b38b9
@@ -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']);