Fix chromatic tests (#12551)

This commit is contained in:
Baptiste Devessier
2025-06-12 10:17:23 +02:00
committed by GitHub
parent ecbc116f8b
commit 10b97d56d4
3 changed files with 22 additions and 2 deletions

View File

@ -198,12 +198,22 @@ export const ResetsDateByErasingInputContent: Story = {
new RegExp(`12/09/${currentYear} \\d{2}:\\d{2}`),
);
await userEvent.click(input);
await waitFor(() => {
expect(canvas.getByRole('dialog')).toBeVisible();
});
await userEvent.clear(input);
const waitForDialogToBeRemoved = waitForElementToBeRemoved(() =>
canvas.queryByRole('dialog'),
);
await Promise.all([
userEvent.type(input, '{Enter}'),
waitForElementToBeRemoved(() => canvas.queryByRole('dialog')),
waitForDialogToBeRemoved,
waitFor(() => {
expect(args.onChange).toHaveBeenCalledWith(null);
}),