Skip to content

Commit

Permalink
[Popover] Wait for focus to settle in tests (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaldudak authored Jul 25, 2024
1 parent 3ee8797 commit 1eb94a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/mui-base/src/Popover/Root/PopoverRoot.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as Popover from '@base_ui/react/Popover';
import { fireEvent, flushMicrotasks, screen } from '@mui/internal-test-utils';
import { fireEvent, flushMicrotasks, screen, waitFor } from '@mui/internal-test-utils';
import userEvent from '@testing-library/user-event';
import { expect } from 'chai';
import { spy } from 'sinon';
Expand Down Expand Up @@ -352,6 +352,8 @@ describe('<Popover.Root />', () => {

await user.click(close);

expect(toggle).toHaveFocus();
await waitFor(() => {
expect(toggle).toHaveFocus();
});
});
});

0 comments on commit 1eb94a7

Please sign in to comment.