Skip to content

Commit

Permalink
fix: changed pagination label for select (#18166)
Browse files Browse the repository at this point in the history
* fix: changed pagination label for select

* fix: avt test cases

---------

Co-authored-by: Gururaj J <[email protected]>
  • Loading branch information
preetibansalui and Gururajj77 authored Dec 2, 2024
1 parent dec8173 commit 7e63bbf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions e2e/components/Pagination/Pagination-test.avt.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ test.describe('@avt Pagination', () => {
name: 'Items per page:',
});
const pageSelector = page.getByRole('combobox', {
name: 'Page number, of 11 pages',
name: 'Page of 11 pages',
});
const updatedPageSelector = page.getByRole('combobox', {
name: 'Page number, of 3 pages',
name: 'Page of 3 pages',
});
const nextPageButton = page.getByRole('button', { name: 'Next page' });
const prevPageButton = page.getByRole('button').first();
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Pagination/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ const Pagination = React.forwardRef(function Pagination(
<Select
id={`${prefix}-pagination-select-${inputId}-right`}
className={`${prefix}--select__page-number`}
labelText={`Page number, of ${totalPages} pages`}
labelText={`Page of ${totalPages} pages`}
inline
hideLabel
onChange={handlePageInputChange}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('Pagination', () => {
onChange={onChange}
/>
);
await userEvent.selectOptions(screen.getByLabelText(/Page number/), '2');
await userEvent.selectOptions(screen.getByLabelText(/Page/), '2');
expect(onChange).toHaveBeenCalledTimes(1);
expect(onChange).toHaveBeenCalledWith(
expect.objectContaining({ page: 2 })
Expand Down Expand Up @@ -237,7 +237,7 @@ describe('Pagination', () => {
);
expect(screen.getByText('1–1 of 2 items')).toBeInTheDocument();

await userEvent.selectOptions(screen.getByLabelText(/Page number/), '2');
await userEvent.selectOptions(screen.getByLabelText(/Page/), '2');
expect(screen.getByText('2–2 of 2 items')).toBeInTheDocument();
});

Expand Down

0 comments on commit 7e63bbf

Please sign in to comment.