Skip to content

Commit 54cd7f5

Browse files
committed
Update ShortUrlsFilteringBar to cover tags mode and exclude tags mode
1 parent ff226da commit 54cd7f5

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

test/short-urls/ShortUrlsFilteringBar.test.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,18 @@ describe('<ShortUrlsFilteringBar />', () => {
185185
await waitFor(() => expect(paramFromCurrentQuery('tags')).toEqual('foo'));
186186
});
187187

188+
it('updates query params when tags mode changes', async () => {
189+
const { user } = setUp();
190+
191+
await user.click(screen.getByRole('button', { name: 'With tags...' }));
192+
193+
await user.click(await screen.findByRole('button', { name: 'Any' }));
194+
await waitFor(() => expect(paramFromCurrentQuery('tagsMode')).toEqual('any'));
195+
196+
await user.click(await screen.findByRole('button', { name: 'All' }));
197+
await waitFor(() => expect(paramFromCurrentQuery('tagsMode')).toEqual('all'));
198+
});
199+
188200
it.each([true, false])('shows exclude tags dropdown if supported', (filterByExcludedTagSupported) => {
189201
setUp({ filterByExcludedTagSupported });
190202

@@ -206,4 +218,16 @@ describe('<ShortUrlsFilteringBar />', () => {
206218

207219
await waitFor(() => expect(paramFromCurrentQuery('excludeTags')).toEqual('bar'));
208220
});
221+
222+
it('updates query params when excluded tags mode changes', async () => {
223+
const { user } = setUp({ filterByExcludedTagSupported: true });
224+
225+
await user.click(screen.getByRole('button', { name: 'Without tags...' }));
226+
227+
await user.click(await screen.findByRole('button', { name: 'Any' }));
228+
await waitFor(() => expect(paramFromCurrentQuery('excludeTagsMode')).toEqual('any'));
229+
230+
await user.click(await screen.findByRole('button', { name: 'All' }));
231+
await waitFor(() => expect(paramFromCurrentQuery('excludeTagsMode')).toEqual('all'));
232+
});
209233
});

0 commit comments

Comments
 (0)