feat(search): NL search frontend — toggle, chips, disambiguation, empty state (#739) #757

Merged
marcel merged 12 commits from feat/issue-739-nl-search-frontend into main 2026-06-06 18:40:35 +02:00
Showing only changes of commit 169e1ad9de - Show all commits

View File

@@ -195,3 +195,39 @@ describe('SearchFilterBar tagQ live filter', () => {
vi.unstubAllGlobals();
});
});
describe('SearchFilterBar smart-mode chip lifecycle hooks', () => {
// The interpretation chips live in the result area (parent page). SearchFilterBar
// drives chip-clearing through callbacks: onModeToggle (mode switch) and
// onSmartSearch (new query). These tests pin that contract.
it('invokes onModeToggle when toggling back to keyword mode (parent clears chips)', async () => {
const onModeToggle = vi.fn();
render(SearchFilterBar, {
...defaultProps,
sort: 'DATE',
dir: 'desc',
smartMode: true,
onModeToggle
});
await page.getByRole('button', { name: /KI/ }).click();
expect(onModeToggle).toHaveBeenCalledOnce();
});
it('invokes onSmartSearch when a new query is submitted in smart mode (parent resets chips)', async () => {
const onSmartSearch = vi.fn();
render(SearchFilterBar, {
...defaultProps,
sort: 'DATE',
dir: 'desc',
smartMode: true,
onSmartSearch
});
const input = page.getByPlaceholder('Titel, Personen, Tags durchsuchen…');
await input.fill('Walter im Krieg');
await input.click();
(document.activeElement as HTMLElement).dispatchEvent(
new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })
);
await vi.waitFor(() => expect(onSmartSearch).toHaveBeenCalled());
});
});