import React from 'react'; import CSSMotion from 'rc-motion'; import { act } from 'react-dom/test-utils'; import { genCSSMotion } from 'rc-motion/lib/CSSMotion'; import Modal from '..'; import Button from '../../button'; import Input from '../../input'; import ConfigProvider from '../../config-provider'; import { render, fireEvent } from '../../../tests/utils'; import type { ModalFunc } from '../confirm'; jest.mock('rc-util/lib/Portal'); jest.mock('rc-motion'); describe('Modal.hook', () => { // Inject CSSMotion to replace with No transition support const MockCSSMotion = genCSSMotion(false); Object.keys(MockCSSMotion).forEach(key => { // @ts-ignore CSSMotion[key] = MockCSSMotion[key]; }); it('hooks support context', () => { jest.useFakeTimers(); const Context = React.createContext('light'); let instance: ReturnType; const Demo = () => { const [modal, contextHolder] = Modal.useModal(); return (