test(coverage): drive browser tests to 80% on all metrics (#496) #505

Merged
marcel merged 189 commits from feat/issue-496-browser-coverage-tests into main 2026-05-11 21:50:39 +02:00
Showing only changes of commit 1301b81d26 - Show all commits

View File

@@ -28,6 +28,7 @@ vi.mock('$app/state', () => ({
}));
const { default: DocumentsListPage } = await import('./+page.svelte');
const { bulkSelectionStore } = await import('$lib/document/bulkSelection.svelte');
afterEach(cleanup);
@@ -336,4 +337,35 @@ describe('documents/+ page', () => {
})
).not.toThrow();
});
it('typing in the search input triggers handleTextSearch callback', async () => {
render(DocumentsListPage, { props: { data: baseData() } });
const input = document.querySelector('input[type="text"]') as HTMLInputElement;
if (input) {
input.value = 'kurrent';
expect(() => input.dispatchEvent(new Event('input', { bubbles: true }))).not.toThrow();
}
});
it('focus and blur on search input toggle qFocused without throwing', async () => {
render(DocumentsListPage, { props: { data: baseData() } });
const input = document.querySelector('input[type="text"]') as HTMLInputElement;
if (input) {
expect(() => {
input.dispatchEvent(new Event('focus', { bubbles: true }));
input.dispatchEvent(new Event('blur', { bubbles: true }));
}).not.toThrow();
}
});
it('renders without throwing with the bulk-selection store containing items', async () => {
bulkSelectionStore.toggle('doc-x');
bulkSelectionStore.toggle('doc-y');
expect(() =>
render(DocumentsListPage, { props: { data: baseData({ canWrite: true }) } })
).not.toThrow();
});
});