diff --git a/frontend/src/lib/components/Pagination.svelte.spec.ts b/frontend/src/lib/components/Pagination.svelte.spec.ts index e9e9a576..8dc904c0 100644 --- a/frontend/src/lib/components/Pagination.svelte.spec.ts +++ b/frontend/src/lib/components/Pagination.svelte.spec.ts @@ -123,7 +123,7 @@ describe('Pagination', () => { await expect.element(rightEllipsis).not.toBeInTheDocument(); }); - it('page button buttons have hidden class on mobile (sm: prefix)', async () => { + it('page buttons container has hidden class on mobile (sm: prefix)', async () => { // The page buttons container must be hidden below sm: breakpoint render(Pagination, { page: 4, totalPages: 12, makeHref }); @@ -132,6 +132,16 @@ describe('Pagination', () => { await expect.element(pageButtons).toHaveClass(/hidden/); await expect.element(pageButtons).toHaveClass(/sm:flex/); }); + + it('renders both pages without ellipsis when totalPages is 2', async () => { + render(Pagination, { page: 0, totalPages: 2, makeHref }); + + const nav = page.getByRole('navigation'); + await expect.element(nav.getByTestId('pagination-page-1')).toBeInTheDocument(); + await expect.element(nav.getByTestId('pagination-page-2')).toBeInTheDocument(); + await expect.element(nav.getByTestId('pagination-ellipsis-left')).not.toBeInTheDocument(); + await expect.element(nav.getByTestId('pagination-ellipsis-right')).not.toBeInTheDocument(); + }); }); it('renders prev as a link pointing at page - 1 when not on first page', async () => {