mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 13:37:52 +08:00
26 lines
754 B
TypeScript
26 lines
754 B
TypeScript
import React from 'react';
|
|
import dayjs from 'dayjs';
|
|
import MockDate from 'mockdate';
|
|
import { mount } from 'enzyme';
|
|
import ConfigProvider from '../../components/config-provider';
|
|
|
|
// eslint-disable-next-line jest/no-export
|
|
export default function rtlTest(Component: React.ComponentType, mockDate?: boolean) {
|
|
describe(`rtl render`, () => {
|
|
it(`component should be rendered correctly in RTL direction`, () => {
|
|
if (mockDate) {
|
|
MockDate.set(dayjs('2000-09-28').valueOf());
|
|
}
|
|
const wrapper = mount(
|
|
<ConfigProvider direction="rtl">
|
|
<Component />
|
|
</ConfigProvider>,
|
|
);
|
|
expect(wrapper.render()).toMatchSnapshot();
|
|
if (mockDate) {
|
|
MockDate.reset();
|
|
}
|
|
});
|
|
});
|
|
}
|