mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-23 18:04:12 +08:00
f8115d3b6b
* chore: init docs * docs: update * docs: update with compatible * test: add test case * docs: update docs * chore: bump patch version * test: fix test case * chore: fix warning check logic
33 lines
847 B
TypeScript
33 lines
847 B
TypeScript
import { version } from 'react';
|
|
|
|
import { waitFakeTimer19 } from '../../../tests/utils';
|
|
import Modal from '../../modal';
|
|
|
|
jest.mock('rc-util/lib/Dom/isVisible', () => () => true);
|
|
|
|
describe('UnstableContext', () => {
|
|
beforeEach(() => {
|
|
jest.useFakeTimers();
|
|
});
|
|
|
|
afterEach(() => {
|
|
jest.useRealTimers();
|
|
});
|
|
|
|
// TODO: Remove in v6
|
|
it('should warning', async () => {
|
|
const majorVersion = parseInt(version.split('.')[0], 10);
|
|
|
|
if (majorVersion >= 19) {
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
Modal.info({ title: 'title', content: 'content' });
|
|
|
|
await waitFakeTimer19();
|
|
|
|
expect(errorSpy).toHaveBeenCalledWith(
|
|
'Warning: [antd: compatible] antd v5 support React is 16 ~ 18. see https://u.ant.design/v5-for-19 for compatible.',
|
|
);
|
|
}
|
|
});
|
|
});
|