Skip to content

Commit

Permalink
Fix MenuRoot test to remove a race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak committed Aug 19, 2024
1 parent 79c498b commit 7a5327f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/mui-base/src/Menu/Root/MenuRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,11 @@ describe('<Menu.Root />', () => {
expect(items[1]).to.have.attribute('tabindex', '0');
});

await user.keyboard('b');
await waitFor(() => {
expect(items[2]).toHaveFocus();
});
expect(items[2]).to.have.attribute('tabindex', '0');

await user.keyboard('b');
await user.keyboard('c');
await waitFor(() => {
expect(items[2]).toHaveFocus();
expect(items[3]).toHaveFocus();
});
expect(items[2]).to.have.attribute('tabindex', '0');
expect(items[3]).to.have.attribute('tabindex', '0');
});

it('skips the non-stringifiable items', async function test() {
Expand Down

0 comments on commit 7a5327f

Please sign in to comment.