Fix Modal stories
This commit is contained in:
@ -7,6 +7,7 @@ import { internalHotkeysEnabledScopesState } from '@/ui/utilities/hotkey/states/
|
|||||||
import { ComponentDecorator } from 'twenty-ui/testing';
|
import { ComponentDecorator } from 'twenty-ui/testing';
|
||||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||||
import { RootDecorator } from '~/testing/decorators/RootDecorator';
|
import { RootDecorator } from '~/testing/decorators/RootDecorator';
|
||||||
|
import { sleep } from '~/utils/sleep';
|
||||||
import { isModalOpenedComponentState } from '../../states/isModalOpenedComponentState';
|
import { isModalOpenedComponentState } from '../../states/isModalOpenedComponentState';
|
||||||
import { ConfirmationModal } from '../ConfirmationModal';
|
import { ConfirmationModal } from '../ConfirmationModal';
|
||||||
|
|
||||||
@ -101,6 +102,9 @@ export const CloseOnClickOutside: Story = {
|
|||||||
|
|
||||||
const backdrop = await canvas.findByTestId('modal-backdrop');
|
const backdrop = await canvas.findByTestId('modal-backdrop');
|
||||||
|
|
||||||
|
// We need to wait for the outside click listener to be registered
|
||||||
|
await sleep(100);
|
||||||
|
|
||||||
await userEvent.click(backdrop);
|
await userEvent.click(backdrop);
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import { internalHotkeysEnabledScopesState } from '@/ui/utilities/hotkey/states/
|
|||||||
import { ComponentDecorator } from 'twenty-ui/testing';
|
import { ComponentDecorator } from 'twenty-ui/testing';
|
||||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||||
import { RootDecorator } from '~/testing/decorators/RootDecorator';
|
import { RootDecorator } from '~/testing/decorators/RootDecorator';
|
||||||
|
import { sleep } from '~/utils/sleep';
|
||||||
import { isModalOpenedComponentState } from '../../states/isModalOpenedComponentState';
|
import { isModalOpenedComponentState } from '../../states/isModalOpenedComponentState';
|
||||||
import { Modal } from '../Modal';
|
import { Modal } from '../Modal';
|
||||||
|
|
||||||
@ -87,7 +88,9 @@ export const CloseClosableModalOnClickOutside: Story = {
|
|||||||
|
|
||||||
await canvas.findByText('Click Outside Test');
|
await canvas.findByText('Click Outside Test');
|
||||||
|
|
||||||
const backdrop = document.querySelector('.modal-backdrop') as HTMLElement;
|
const backdrop = await canvas.findByTestId('modal-backdrop');
|
||||||
|
// We need to wait for the outside click listener to be registered
|
||||||
|
await sleep(100);
|
||||||
await userEvent.click(backdrop);
|
await userEvent.click(backdrop);
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user