Skip to content

Commit

Permalink
refactor(ui-pagination): fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matyasf committed Feb 3, 2025
1 parent 1dbe539 commit 55b1e3d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,17 @@ describe('<Pagination />', () => {
it('by default', async () => {
const { container } = render(
<Pagination variant="compact" labelNext="Next" labelPrev="Prev">
<ul>
{buildPages(5)}
</ul>
{buildPages(5)}
</Pagination>
)

const axeCheck = await runAxeCheck(container)
expect(axeCheck).toBe(true)
})

it('by default with more pages', async () => {
const { container } = render(
<Pagination variant="compact" labelNext="Next" labelPrev="Prev">
<ul>{buildPages(8)}</ul>
{buildPages(8)}
</Pagination>
)
const axeCheck = await runAxeCheck(container)
Expand All @@ -153,7 +150,7 @@ describe('<Pagination />', () => {
labelLast="Last"
withFirstAndLastButton
>
<ul>{buildPages(8)}</ul>
{buildPages(8)}
</Pagination>
)
const axeCheck = await runAxeCheck(container)
Expand All @@ -171,7 +168,7 @@ describe('<Pagination />', () => {
withFirstAndLastButton
showDisabledButtons
>
<ul>{buildPages(8)}</ul>
{buildPages(8)}
</Pagination>
)
const axeCheck = await runAxeCheck(container)
Expand Down Expand Up @@ -966,7 +963,7 @@ describe('<Pagination />', () => {
totalPageNumber={9}
/>
)
expect(container.firstChild).toHaveTextContent('12...9Next Page')
expect(container.firstChild).toHaveTextContent('129Next Page')
})
it('should render the correct pages - 2', () => {
const { container } = render(
Expand All @@ -979,7 +976,7 @@ describe('<Pagination />', () => {
/>
)
expect(container.firstChild).toHaveTextContent(
'Previous Page1...456...9Next Page'
'Previous Page14569Next Page'
)
})
it('should render the correct pages - 3', () => {
Expand Down Expand Up @@ -1011,7 +1008,7 @@ describe('<Pagination />', () => {
/>
)
expect(container.firstChild).toHaveTextContent(
'Previous Page12...456...89Next Page'
'Previous Page1245689Next Page'
)
})
it('should render the correct pages - 5', () => {
Expand Down Expand Up @@ -1056,7 +1053,7 @@ describe('<Pagination />', () => {
siblingCount={1}
/>
)
expect(container.firstChild).toHaveTextContent('123...789Next Page')
expect(container.firstChild).toHaveTextContent('123789Next Page')
})
it('should render the correct ellipsis', () => {
const { container } = render(
Expand Down Expand Up @@ -1098,7 +1095,7 @@ describe('<Pagination />', () => {
/>
)
expect(container.firstChild).toHaveTextContent(
'Previous Page1...567756785679...1000000000000000Next Page'
'Previous Page15677567856791000000000000000Next Page'
)
})
it('should render first and last buttons', () => {
Expand All @@ -1115,7 +1112,7 @@ describe('<Pagination />', () => {
/>
)
expect(container.firstChild).toHaveTextContent(
'First PagePrevious Page1...456...100Next PageLast Page'
'First PagePrevious Page1456100Next PageLast Page'
)
})
it('should render every page if boundary and sibling counts are big enough', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-pagination/src/Pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Pagination extends Component<PaginationProps> {
currentPage: 1,
siblingCount: 1,
boundaryCount: 1,
ellipsis: '...',
ellipsis: '',
renderPageIndicator: (page: number) => page
}

Expand Down

0 comments on commit 55b1e3d

Please sign in to comment.