mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 03:22:59 +08:00
fix: update
This commit is contained in:
parent
5eeabf39f7
commit
9d19caa191
@ -12,9 +12,5 @@ export default function MotionWrapper(props: MotionWrapperProps): React.ReactEle
|
|||||||
const [, token] = useToken();
|
const [, token] = useToken();
|
||||||
const { motion } = token;
|
const { motion } = token;
|
||||||
|
|
||||||
if (motion) {
|
|
||||||
return <MotionProvider motion={motion}>{children}</MotionProvider>;
|
return <MotionProvider motion={motion}>{children}</MotionProvider>;
|
||||||
}
|
|
||||||
|
|
||||||
return children as React.ReactElement;
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { SmileOutlined } from '@ant-design/icons';
|
import { SmileOutlined } from '@ant-design/icons';
|
||||||
import CSSMotion from 'rc-motion';
|
|
||||||
import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
|
|
||||||
import KeyCode from 'rc-util/lib/KeyCode';
|
import KeyCode from 'rc-util/lib/KeyCode';
|
||||||
import { resetWarned } from 'rc-util/lib/warning';
|
import { resetWarned } from 'rc-util/lib/warning';
|
||||||
|
|
||||||
@ -16,8 +14,6 @@ import destroyFns from '../destroyFns';
|
|||||||
|
|
||||||
const { confirm } = Modal;
|
const { confirm } = Modal;
|
||||||
|
|
||||||
jest.mock('rc-motion');
|
|
||||||
|
|
||||||
// TODO: Remove this. Mock for React 19
|
// TODO: Remove this. Mock for React 19
|
||||||
jest.mock('react-dom', () => {
|
jest.mock('react-dom', () => {
|
||||||
const realReactDOM = jest.requireActual('react-dom');
|
const realReactDOM = jest.requireActual('react-dom');
|
||||||
@ -75,12 +71,6 @@ describe('Modal.confirm triggers callbacks correctly', () => {
|
|||||||
};
|
};
|
||||||
configWarp();
|
configWarp();
|
||||||
|
|
||||||
// Inject CSSMotion to replace with No transition support
|
|
||||||
const MockCSSMotion = genCSSMotion(false);
|
|
||||||
Object.keys(MockCSSMotion).forEach((key) => {
|
|
||||||
(CSSMotion as any)[key] = (MockCSSMotion as any)[key];
|
|
||||||
});
|
|
||||||
|
|
||||||
// // Mock for rc-util raf
|
// // Mock for rc-util raf
|
||||||
// window.requestAnimationFrame = callback => {
|
// window.requestAnimationFrame = callback => {
|
||||||
// const ret = window.setTimeout(callback, 16);
|
// const ret = window.setTimeout(callback, 16);
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import CSSMotion from 'rc-motion';
|
|
||||||
import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
|
|
||||||
import KeyCode from 'rc-util/lib/KeyCode';
|
import KeyCode from 'rc-util/lib/KeyCode';
|
||||||
|
|
||||||
import Modal from '..';
|
import Modal from '..';
|
||||||
@ -12,7 +10,6 @@ import zhCN from '../../locale/zh_CN';
|
|||||||
import type { ModalFunc } from '../confirm';
|
import type { ModalFunc } from '../confirm';
|
||||||
|
|
||||||
jest.mock('rc-util/lib/Portal');
|
jest.mock('rc-util/lib/Portal');
|
||||||
jest.mock('rc-motion');
|
|
||||||
|
|
||||||
// TODO: Remove this. Mock for React 19
|
// TODO: Remove this. Mock for React 19
|
||||||
jest.mock('react-dom', () => {
|
jest.mock('react-dom', () => {
|
||||||
@ -31,13 +28,6 @@ describe('Modal.hook', () => {
|
|||||||
return <ConfigProvider {...conf} theme={{ token: { motion: false } }} />;
|
return <ConfigProvider {...conf} theme={{ token: { motion: false } }} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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', () => {
|
it('hooks support context', () => {
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
const Context = React.createContext('light');
|
const Context = React.createContext('light');
|
||||||
|
Loading…
Reference in New Issue
Block a user