Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const PaginationComponent: FC<PaginationProps> = ({
<PaginationNavigation
className={twMerge(theme.pages.previous.base, showIcon && theme.pages.showIcon)}
onClick={goToPreviousPage}
disabled={currentPage === 1}
disabled={currentPage <= 1}
>
{showIcon && <HiChevronLeft aria-hidden className={theme.pages.previous.icon} />}
{previousLabel}
Expand Down
7 changes: 5 additions & 2 deletions src/components/Pagination/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import { describe, expect, it } from 'vitest';
import { range } from './helpers';

describe('Helpers / Range', () => {
it('should return the empty list, given start >= end', () => {
it('should return the empty list, given start > end', () => {
expect(range(20, 10)).toEqual([]);
expect(range(10, 10)).toEqual([]);
});

it('should return every number from start to end, inclusive, given start < end', () => {
expect(range(10, 20)).toEqual([10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]);
});

it('should return a single number == start == end, given start == end', () => {
expect(range(10, 10)).toEqual([10]);
});
});
2 changes: 1 addition & 1 deletion src/components/Pagination/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const range: (start: number, end: number) => number[] = (start, end) => {
if (start >= end) {
if (start > end) {
return [];
}

Expand Down