mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-23 05:21:15 +00:00
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:
@@ -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']);
|
||||
|
||||
Reference in New Issue
Block a user