Skip to content

Commit

Permalink
chore: return prev code
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanVor committed May 23, 2024
1 parent 084e392 commit 1f68b21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/Pagination/__tests__/Pagination.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ describe('Pagination component', () => {
});
});

test('Total property disable Next', () => {
test('Total property undefined', () => {
render(<Pagination pageSize={20} onUpdate={noop} page={0} total={undefined} />);

const nextButton = screen.getByTestId(PaginationQa.PaginationButtonNext);

expect(nextButton).toBeDisabled();
expect(nextButton).not.toBeDisabled();
});
});
2 changes: 1 addition & 1 deletion src/components/Pagination/hooks/usePagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function usePagination({
}: UsePaginationArgs): UsePaginationReturn {
const numberOfPages = getNumberOfPages(pageSize, total);
const hasTotal = numberOfPages !== 0;
const isNextDisabled = hasTotal === false || page === numberOfPages;
const isNextDisabled = (hasTotal && page === numberOfPages) || total === 0;

let items: PaginationItem[];

Expand Down

0 comments on commit 1f68b21

Please sign in to comment.