Skip to content

Commit

Permalink
Remove unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Moroz committed Jun 4, 2024
1 parent f3575fa commit ceb0e7c
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions packages/react/focus-scope/src/FocusScope.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,15 @@ describe('FocusScope', () => {
});

it('should focus the last element in the scope on shift+tab from the first element in scope', () => {
React.act(() => {
tabbableFirst.focus();
userEvent.tab({ shift: true });
waitFor(() => expect(tabbableLast).toHaveFocus());
});
tabbableFirst.focus();
userEvent.tab({ shift: true });
waitFor(() => expect(tabbableLast).toHaveFocus());
});

it('should focus the first element in scope on tab from the last element in scope', async () => {
React.act(() => {
tabbableLast.focus();
userEvent.tab();
waitFor(() => expect(tabbableFirst).toHaveFocus());
});
tabbableLast.focus();
userEvent.tab();
waitFor(() => expect(tabbableFirst).toHaveFocus());
});
});

Expand Down Expand Up @@ -91,11 +87,9 @@ describe('FocusScope', () => {
});

it('should skip the element with a negative tabindex on shift+tab', () => {
React.act(() => {
tabbableSecond.focus();
userEvent.tab({ shift: true });
waitFor(() => expect(tabbableLast).toHaveFocus());
});
tabbableSecond.focus();
userEvent.tab({ shift: true });
waitFor(() => expect(tabbableLast).toHaveFocus());
});
});

Expand All @@ -119,12 +113,10 @@ describe('FocusScope', () => {

it('should properly blur the last element in the scope before cycling back', async () => {
// Tab back and then tab forward to cycle through the scope
React.act(() => {
tabbableFirst.focus();
userEvent.tab({ shift: true });
userEvent.tab();
waitFor(() => expect(handleLastFocusableElementBlur).toHaveBeenCalledTimes(1));
});
tabbableFirst.focus();
userEvent.tab({ shift: true });
userEvent.tab();
waitFor(() => expect(handleLastFocusableElementBlur).toHaveBeenCalledTimes(1));
});
});
});
Expand Down

0 comments on commit ceb0e7c

Please sign in to comment.