Skip to content

Commit

Permalink
test(modal): fix invalid test case
Browse files Browse the repository at this point in the history
  • Loading branch information
sungik-choi committed Jan 11, 2024
1 parent a0dd39e commit 27a7ccc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/bezier-react/src/components/Modal/Modal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,17 @@ describe('Modal', () => {
describe('Visually Hidden', () => {
it('should be visible when the \'hidden\' prop is false', () => {
const { getByRole } = renderOpenedModal()
expect(getByRole('banner')).toBeInTheDocument() /* HTML5 header element */
expect(getByRole('banner')).toBeVisible() /* HTML5 header element */
})

it('should be visually hidden when the \'hidden\' prop is true', () => {
const { queryByRole } = renderOpenedModal({ modalHeaderProps: { title: TITLE_TEXT, hidden: true } })
expect(queryByRole('banner')).not.toBeInTheDocument() /* HTML5 header element */
/**
* NOTE(@ed): As a `toBeVisible` matcher, it cannot be used because the `visibility` style cannot be checked.
* Instead, it tests whether the visually hidden style is applied correctly.
* @see https://github.com/testing-library/jest-dom/issues/209
*/
expect(queryByRole('banner')).toHaveStyle({ position: 'absolute' }) /* HTML5 header element */
})
})
})
Expand Down

0 comments on commit 27a7ccc

Please sign in to comment.