Skip to content

Commit

Permalink
Retrieve buttons by role in a test
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentSmedinga committed May 13, 2024
1 parent 06f964c commit 7f3c89c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/react/src/Pagination/Pagination.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ describe('Pagination', () => {
expect(screen.getByTestId('firstSpacer')).toBeInTheDocument()
})

it('should navigate to the next page when clicking on the "next" button', () => {
it('should navigate to the next page when clicking on the next button', () => {
const onPageChangeMock = jest.fn()
render(<Pagination page={6} totalPages={10} onPageChange={onPageChangeMock} />)

Expand All @@ -60,7 +60,7 @@ describe('Pagination', () => {
expect(screen.getByText('7')).toHaveAttribute('aria-current', 'true')
})

it('should navigate to the previous page when clicking on the "previous" button', () => {
it('should navigate to the previous page when clicking on the previous button', () => {
const onPageChangeMock = jest.fn()
render(<Pagination page={6} totalPages={10} onPageChange={onPageChangeMock} />)

Expand Down Expand Up @@ -110,8 +110,8 @@ describe('Pagination', () => {
it('renders custom aria-labels for the ‘previous’ and ‘next’ buttons', () => {
render(<Pagination totalPages={10} previousAriaLabel="Vorige pagina" nextAriaLabel="Volgende pagina" />)

expect(screen.getByText('vorige')).toHaveAttribute('aria-label', 'Vorige pagina')
expect(screen.getByText('volgende')).toHaveAttribute('aria-label', 'Volgende pagina')
expect(screen.getByRole('button', { name: 'Vorige pagina' })).toHaveAttribute('aria-label', 'Vorige pagina')
expect(screen.getByRole('button', { name: 'Volgende pagina' })).toHaveAttribute('aria-label', 'Volgende pagina')
})

it('supports ForwardRef in React', () => {
Expand Down

0 comments on commit 7f3c89c

Please sign in to comment.