Skip to content

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentSmedinga committed Oct 25, 2024
1 parent 0830fd9 commit 259d8b2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/react/src/Button/Button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ describe('Button', () => {
const button = screen.getByRole('button', {
name: 'Sluiten',
})
const icon = button.querySelector('.ams-icon:last-child')

expect(button).toBeInTheDocument()
const icon = button.querySelector('.ams-icon:last-child')
expect(icon).toBeInTheDocument()
})

Expand All @@ -138,9 +138,9 @@ describe('Button', () => {
const button = screen.getByRole('button', {
name: 'Sluiten',
})
const icon = button.querySelector('.ams-icon:first-child')

expect(button).toBeInTheDocument()
const icon = button.querySelector('.ams-icon:first-child')
expect(icon).toBeInTheDocument()
})

Expand All @@ -154,9 +154,11 @@ describe('Button', () => {
const button = screen.getByRole('button', {
name: 'Sluiten',
})
const icon = button.querySelector('.ams-icon')
const label = button.querySelector('.ams-visually-hidden')

expect(button).toBeInTheDocument()
const label = button.querySelector('.ams-visually-hidden')
expect(label).toHaveTextContent('Sluiten')
expect(icon).toBeInTheDocument()
expect(label).toBeInTheDocument()
})
})

0 comments on commit 259d8b2

Please sign in to comment.