Skip to content

Commit

Permalink
Update text with new expectations
Browse files Browse the repository at this point in the history
  • Loading branch information
ciampo committed Apr 15, 2023
1 parent 162e978 commit 7e0ebc3
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,17 @@ describe( 'TabbableContainer', () => {
/>
);

// With the `cycle` prop set to `false`, cycling is not allowed.
// By default, cycling from first to last and from last to first is allowed.
// With the `cycle` prop set to `false`, cycling is not allowed.
// Therefore, focus will escape the `TabbableContainer` and continue its
// natural path in the page.
await user.tab( { shift: true } );
expect( firstTabbable ).toHaveFocus();
expect(
screen.getByRole( 'button', { name: 'Before container' } )
).toHaveFocus();
expect( onNavigateSpy ).toHaveBeenCalledTimes( 2 );

await user.tab();
await user.tab();
await user.tab();
expect( lastTabbable ).toHaveFocus();
Expand All @@ -141,8 +146,12 @@ describe( 'TabbableContainer', () => {
lastTabbable
);

// Focus will move to the next natively focusable elements after
// `TabbableContainer`
await user.tab();
expect( lastTabbable ).toHaveFocus();
expect(
screen.getByRole( 'button', { name: 'After container' } )
).toHaveFocus();
expect( onNavigateSpy ).toHaveBeenCalledTimes( 4 );
} );

Expand Down

0 comments on commit 7e0ebc3

Please sign in to comment.