Skip to content

Commit

Permalink
Update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman committed Feb 19, 2025
1 parent ca14a75 commit 5075de3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/components/src/modal/test/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,24 +234,24 @@ describe( 'Modal', () => {

// Opens outer modal > hides container.
await user.click( screen.getByRole( 'button', { name: 'Start' } ) );
expect( container ).toHaveAttribute( 'aria-hidden', 'true' );
expect( container ).toHaveAttribute( 'inert' );

// Disable reason: No semantic query can reach the overlay.
// eslint-disable-next-line testing-library/no-node-access
const outer = screen.getByRole( 'dialog' ).parentElement!;

// Opens inner modal > hides outer modal.
await user.click( screen.getByRole( 'button', { name: 'Nest' } ) );
expect( outer ).toHaveAttribute( 'aria-hidden', 'true' );
expect( outer ).toHaveAttribute( 'inert' );

// Closes inner modal > Unhides outer modal and container stays hidden.
await user.keyboard( '[Escape]' );
expect( outer ).not.toHaveAttribute( 'aria-hidden' );
expect( container ).toHaveAttribute( 'aria-hidden', 'true' );
expect( outer ).not.toHaveAttribute( 'inert' );
expect( container ).toHaveAttribute( 'inert' );

// Closes outer modal > Unhides container.
await user.keyboard( '[Escape]' );
expect( container ).not.toHaveAttribute( 'aria-hidden' );
expect( container ).not.toHaveAttribute( 'inert' );
} );

it( 'should render `headerActions` React nodes', async () => {
Expand Down

0 comments on commit 5075de3

Please sign in to comment.