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 659ee485f2 - Show all commits

View File

@@ -84,4 +84,28 @@ describe('Pagination', () => {
const nav = document.querySelector('nav');
expect(nav?.getAttribute('aria-label')).toBe('Custom pagination');
});
it('renders the bridge page (no ellipsis) when window is exactly 2 pages from start', async () => {
// page=3 (1-indexed=4), totalPages=10 → windowStart=3, first+2=3 → bridge to page 2
render(Pagination, { props: { page: 3, totalPages: 10, makeHref } });
// Should have page 2 directly, not an ellipsis
const ellipsisLeft = document.querySelector('[data-testid="pagination-ellipsis-left"]');
expect(ellipsisLeft).toBeNull();
});
it('renders the bridge page (no ellipsis) when window is exactly 2 pages from end', async () => {
// page=6 (1-indexed=7), totalPages=10 → windowEnd=8, last-2=8 → bridge to page 9
render(Pagination, { props: { page: 6, totalPages: 10, makeHref } });
// Should have page 9 directly, not an ellipsis on the right
const ellipsisRight = document.querySelector('[data-testid="pagination-ellipsis-right"]');
expect(ellipsisRight).toBeNull();
});
it('returns no result when totalPages is 0', async () => {
render(Pagination, { props: { page: 0, totalPages: 0, makeHref } });
expect(document.querySelector('nav')).toBeNull();
});
});