Skip to content

Commit

Permalink
fix(Pagination): update default page range text (#6675)
Browse files Browse the repository at this point in the history
* fix(Pagination): update default page range text

* test(Pagination): update page range text assertion

Co-authored-by: TJ Egan <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 24, 2020
1 parent 907bdf5 commit d461f83
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('Pagination', () => {
const pager = mount(<Pagination pageSizes={[5, 10]} totalItems={0} />);
const labels = pager.find(`.${prefix}--pagination__text`);
expect(labels.at(1).text()).toBe('0–0 of 0 items');
expect(labels.at(2).text()).toBe('of 1 pages');
expect(labels.at(2).text()).toBe('of 1 page');
});

it('should have two buttons for navigation', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/react/src/components/Pagination/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export default class Pagination extends Component {
forwardText: 'Next page',
itemsPerPageText: 'Items per page:',
pageNumberText: 'Page Number',
pageRangeText: (current, total) => `of ${total} pages`,
pageRangeText: (current, total) =>
`of ${total} ${total === 1 ? 'page' : 'pages'}`,
disabled: false,
page: 1,
pagesUnknown: false,
Expand Down

0 comments on commit d461f83

Please sign in to comment.