From 55b1e3d9d5a1bb3819d3b1ec3b6352bd26ca2e2e Mon Sep 17 00:00:00 2001 From: Matyas Szabo Date: Wed, 8 Jan 2025 10:14:25 +0100 Subject: [PATCH] refactor(ui-pagination): fix failing tests --- .../__new-tests__/Pagination.test.tsx | 23 ++++++++----------- .../ui-pagination/src/Pagination/index.tsx | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/ui-pagination/src/Pagination/__new-tests__/Pagination.test.tsx b/packages/ui-pagination/src/Pagination/__new-tests__/Pagination.test.tsx index c5965f1e74..bd393e2ab4 100644 --- a/packages/ui-pagination/src/Pagination/__new-tests__/Pagination.test.tsx +++ b/packages/ui-pagination/src/Pagination/__new-tests__/Pagination.test.tsx @@ -123,12 +123,9 @@ describe('', () => { it('by default', async () => { const { container } = render( -
    - {buildPages(5)} -
+ {buildPages(5)}
) - const axeCheck = await runAxeCheck(container) expect(axeCheck).toBe(true) }) @@ -136,7 +133,7 @@ describe('', () => { it('by default with more pages', async () => { const { container } = render( -
    {buildPages(8)}
+ {buildPages(8)}
) const axeCheck = await runAxeCheck(container) @@ -153,7 +150,7 @@ describe('', () => { labelLast="Last" withFirstAndLastButton > -
    {buildPages(8)}
+ {buildPages(8)}
) const axeCheck = await runAxeCheck(container) @@ -171,7 +168,7 @@ describe('', () => { withFirstAndLastButton showDisabledButtons > -
    {buildPages(8)}
+ {buildPages(8)}
) const axeCheck = await runAxeCheck(container) @@ -966,7 +963,7 @@ describe('', () => { totalPageNumber={9} /> ) - expect(container.firstChild).toHaveTextContent('12...9Next Page') + expect(container.firstChild).toHaveTextContent('12…9Next Page') }) it('should render the correct pages - 2', () => { const { container } = render( @@ -979,7 +976,7 @@ describe('', () => { /> ) expect(container.firstChild).toHaveTextContent( - 'Previous Page1...456...9Next Page' + 'Previous Page1…456…9Next Page' ) }) it('should render the correct pages - 3', () => { @@ -1011,7 +1008,7 @@ describe('', () => { /> ) expect(container.firstChild).toHaveTextContent( - 'Previous Page12...456...89Next Page' + 'Previous Page12…456…89Next Page' ) }) it('should render the correct pages - 5', () => { @@ -1056,7 +1053,7 @@ describe('', () => { siblingCount={1} /> ) - expect(container.firstChild).toHaveTextContent('123...789Next Page') + expect(container.firstChild).toHaveTextContent('123…789Next Page') }) it('should render the correct ellipsis', () => { const { container } = render( @@ -1098,7 +1095,7 @@ describe('', () => { /> ) expect(container.firstChild).toHaveTextContent( - 'Previous Page1...567756785679...1000000000000000Next Page' + 'Previous Page1…567756785679…1000000000000000Next Page' ) }) it('should render first and last buttons', () => { @@ -1115,7 +1112,7 @@ describe('', () => { /> ) expect(container.firstChild).toHaveTextContent( - 'First PagePrevious Page1...456...100Next PageLast Page' + 'First PagePrevious Page1…456…100Next PageLast Page' ) }) it('should render every page if boundary and sibling counts are big enough', () => { diff --git a/packages/ui-pagination/src/Pagination/index.tsx b/packages/ui-pagination/src/Pagination/index.tsx index 607c8e5be2..989a4e19b8 100644 --- a/packages/ui-pagination/src/Pagination/index.tsx +++ b/packages/ui-pagination/src/Pagination/index.tsx @@ -104,7 +104,7 @@ class Pagination extends Component { currentPage: 1, siblingCount: 1, boundaryCount: 1, - ellipsis: '...', + ellipsis: '…', renderPageIndicator: (page: number) => page }