From be274896183946cd425668db539c26eea6b6b000 Mon Sep 17 00:00:00 2001 From: Marcel Date: Sun, 26 Apr 2026 21:35:42 +0200 Subject: [PATCH] test(pagination): fix test name typo and add totalPages===2 boundary test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames 'page button buttons' → 'page buttons container' (Decision Queue #3). Adds 'renders both pages without ellipsis when totalPages is 2' to cover the boundary between the 1-page (hidden) and full-ellipsis-window cases (Decision Queue #5). Co-Authored-By: Claude Sonnet 4.6 --- .../src/lib/components/Pagination.svelte.spec.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 () => {