Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] Add missing async #706

Merged
merged 5 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions packages/mui-base/src/Checkbox/Root/CheckboxRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ describe('<Checkbox.Root />', () => {
expect(checkbox).to.have.attribute('aria-checked', 'false');
expect(input.checked).to.equal(false);

await act(() => {
await act(async () => {
checkbox.click();
});

expect(checkbox).to.have.attribute('aria-checked', 'true');
expect(input.checked).to.equal(true);

await act(() => {
await act(async () => {
checkbox.click();
});

Expand All @@ -61,13 +61,13 @@ describe('<Checkbox.Root />', () => {
const button = getByText('Toggle');

expect(checkbox).to.have.attribute('aria-checked', 'false');
await act(() => {
await act(async () => {
button.click();
});

expect(checkbox).to.have.attribute('aria-checked', 'true');

await act(() => {
await act(async () => {
button.click();
});

Expand All @@ -79,7 +79,7 @@ describe('<Checkbox.Root />', () => {
const { getAllByRole } = await render(<Checkbox.Root onCheckedChange={handleChange} />);
const [checkbox] = getAllByRole('checkbox');

await act(() => {
await act(async () => {
checkbox.click();
});

Expand All @@ -104,7 +104,7 @@ describe('<Checkbox.Root />', () => {

expect(checkbox).to.have.attribute('aria-checked', 'false');

await act(() => {
await act(async () => {
checkbox.click();
});

Expand All @@ -129,7 +129,7 @@ describe('<Checkbox.Root />', () => {

expect(checkbox).to.have.attribute('aria-checked', 'false');

await act(() => {
await act(async () => {
checkbox.click();
});

Expand All @@ -149,7 +149,7 @@ describe('<Checkbox.Root />', () => {

expect(checkbox).to.have.attribute('aria-checked', 'mixed');

await act(() => {
await act(async () => {
checkbox.click();
});

Expand Down Expand Up @@ -177,7 +177,7 @@ describe('<Checkbox.Root />', () => {
const [checkbox] = getAllByRole('checkbox');
const input = container.querySelector('input[type=checkbox]') as HTMLInputElement;

await act(() => {
await act(async () => {
input.click();
});

Expand Down Expand Up @@ -231,7 +231,7 @@ describe('<Checkbox.Root />', () => {

expect(checkbox).to.have.attribute('aria-checked', 'false');

await act(() => {
await act(async () => {
label.click();
});

Expand All @@ -258,7 +258,7 @@ describe('<Checkbox.Root />', () => {

expect(checkbox).to.have.attribute('aria-checked', 'false');

await act(() => {
await act(async () => {
label.click();
});

Expand Down Expand Up @@ -294,7 +294,7 @@ describe('<Checkbox.Root />', () => {

expect(stringifiedFormData).to.equal('test-checkbox=off');

await act(() => {
await act(async () => {
checkbox.click();
});

Expand Down
4 changes: 2 additions & 2 deletions packages/mui-base/src/Dialog/Root/DialogRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('<Dialog.Root />', () => {
const button = getByRole('button');
expect(queryByRole('dialog')).to.equal(null);

await act(() => {
await act(async () => {
button.click();
});

Expand Down Expand Up @@ -191,7 +191,7 @@ describe('<Dialog.Root />', () => {
);

const trigger = getByText('Open');
await act(() => {
await act(async () => {
trigger.click();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('<Menu.CheckboxItem />', () => {
);

const menuItems = getAllByRole('menuitemcheckbox');
await act(() => {
await act(async () => {
menuItems[0].focus();
});

Expand Down Expand Up @@ -191,7 +191,7 @@ describe('<Menu.CheckboxItem />', () => {
);

const trigger = getByRole('button', { name: 'Open' });
await act(() => {
await act(async () => {
trigger.focus();
});
await user.keyboard('[ArrowDown]');
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('<Menu.CheckboxItem />', () => {
);

const trigger = getByRole('button', { name: 'Open' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Menu/Item/MenuItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('<Menu.Item />', () => {
);

const menuItems = getAllByRole('menuitem');
await act(() => {
await act(async () => {
menuItems[0].focus();
});

Expand Down
4 changes: 2 additions & 2 deletions packages/mui-base/src/Menu/RadioItem/MenuRadioItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('<Menu.RadioItem />', () => {
);

const menuItems = getAllByRole('menuitemradio');
await act(() => {
await act(async () => {
menuItems[0].focus();
});

Expand Down Expand Up @@ -190,7 +190,7 @@ describe('<Menu.RadioItem />', () => {
);

const trigger = getByRole('button', { name: 'Open' });
await act(() => {
await act(async () => {
trigger.focus();
});
await user.keyboard('[ArrowDown]');
Expand Down
28 changes: 14 additions & 14 deletions packages/mui-base/src/Menu/Root/MenuRoot.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('<Menu.Root />', () => {
);

const trigger = getByRole('button', { name: 'Toggle' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand Down Expand Up @@ -71,7 +71,7 @@ describe('<Menu.Root />', () => {
);

const trigger = getByRole('button', { name: 'Toggle' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand Down Expand Up @@ -110,7 +110,7 @@ describe('<Menu.Root />', () => {
);

const trigger = getByRole('button', { name: 'Toggle' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand Down Expand Up @@ -157,7 +157,7 @@ describe('<Menu.Root />', () => {

const items = getAllByRole('menuitem');

await act(() => {
await act(async () => {
items[0].focus();
});

Expand Down Expand Up @@ -256,7 +256,7 @@ describe('<Menu.Root />', () => {

const items = getAllByRole('menuitem');

await act(() => {
await act(async () => {
items[0].focus();
});

Expand Down Expand Up @@ -295,7 +295,7 @@ describe('<Menu.Root />', () => {

const items = getAllByRole('menuitem');

await act(() => {
await act(async () => {
items[0].focus();
});

Expand Down Expand Up @@ -334,7 +334,7 @@ describe('<Menu.Root />', () => {

const items = getAllByRole('menuitem');

await act(() => {
await act(async () => {
items[0].focus();
});

Expand Down Expand Up @@ -368,7 +368,7 @@ describe('<Menu.Root />', () => {

const items = getAllByRole('menuitem');

await act(() => {
await act(async () => {
items[0].focus();
});

Expand Down Expand Up @@ -414,7 +414,7 @@ describe('<Menu.Root />', () => {

const submenuTrigger = getByTestId('submenu-trigger');

await act(() => {
await act(async () => {
submenuTrigger.focus();
});

Expand Down Expand Up @@ -459,7 +459,7 @@ describe('<Menu.Root />', () => {
const { getAllByRole, getByRole } = await render(<Test />);

const trigger = getByRole('button', { name: 'Toggle' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand All @@ -478,7 +478,7 @@ describe('<Menu.Root />', () => {
const { getByRole, getAllByRole } = await render(<Test />);

const trigger = getByRole('button', { name: 'Toggle' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand All @@ -497,7 +497,7 @@ describe('<Menu.Root />', () => {

const trigger = getByRole('button', { name: 'Toggle' });

await act(() => {
await act(async () => {
trigger.focus();
});

Expand Down Expand Up @@ -593,7 +593,7 @@ describe('<Menu.Root />', () => {
);

const trigger = getByRole('button', { name: 'Open' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand Down Expand Up @@ -640,7 +640,7 @@ describe('<Menu.Root />', () => {
);

const trigger = getByRole('button', { name: 'Open' });
await act(() => {
await act(async () => {
trigger.focus();
});

Expand Down
2 changes: 1 addition & 1 deletion packages/mui-base/src/Menu/Trigger/MenuTrigger.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ describe('<Menu.Trigger />', () => {
);

const button = getByRole('button', { name: 'Open' });
await act(() => {
await act(async () => {
button.focus();
});

Expand Down
Loading