Any Tag alone searches the library, and Zim search does not offer it (#960)

On the search page, choosing Any Tag without a search string left the
Dashboard showing: the page, the Files results and the Files count all waited
for a search string or tag names.

Zim search has no "any tag" search, and its tag picker's Any button left no
filter applied, so the picker no longer offers it.  Zim and Other counts are
only requested when there is a search string or tag names to count by.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-11-11 19:42:48 -07:00 • committed by Roland
parent f1d344d8a2
commit 30b2bf6df0
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
7 changed files with 92 additions and 10 deletions

View file

@ -1,6 +1,8 @@
import React from 'react';
import {render, screen} from '../test-utils';
import {ZimCatalogItemRow} from './Zim';
import {ZimCatalogItemRow, ZimSearchView} from './Zim';
import {TagsContext} from '../Tags';
import {tagsContextFixture} from '../test-fixtures';
import {Table} from './ui';
/*
@ -113,3 +115,18 @@ describe('the outdated Zims banner', () => {
expect(screen.getByText('zims/wikipedia_en_all_maxi_2024-01.zim')).toBeInTheDocument();
});
});
/*
* The Zim search tab's tag picker. Zim search can filter by specific tags but has no "any tag" search, and
* picking "Any" there left no filter applied -- so the picker must not offer it.
*/
describe('the Zim search tag picker', () => {
it('does not offer Any', async () => {
render(<ZimSearchView suggestions={{zimsEstimates: []}} loading={false}/>, {
contexts: [[TagsContext, tagsContextFixture({tags: [{name: 'one'}]})]],
});
fireEvent.click(screen.getByLabelText('Add tag'));
expect(await screen.findByText('Applied Tags')).toBeInTheDocument();
expect(screen.queryByRole('button', {name: 'Any'})).toBeNull();
});
});