mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-13 15:49:10 +08:00
502dac12aa
* docs: fix code * feat: lint * feat: prettier * feat: test * feat: review * feat: format html * feat: format html
29 lines
781 B
TypeScript
29 lines
781 B
TypeScript
import React from 'react';
|
|
import dayjs from 'dayjs';
|
|
import MockDate from 'mockdate';
|
|
|
|
import ConfigProvider from '../../components/config-provider';
|
|
import { render } from '../utils';
|
|
|
|
const rtlTest = (Component: React.ComponentType, mockDate = false) => {
|
|
describe('rtl render', () => {
|
|
it('component should be rendered correctly in RTL direction', () => {
|
|
if (mockDate) {
|
|
MockDate.set(dayjs('2000-09-28').valueOf());
|
|
}
|
|
const { container } = render(
|
|
<ConfigProvider direction="rtl">
|
|
<Component />
|
|
</ConfigProvider>,
|
|
);
|
|
expect(container.firstChild).toMatchSnapshot();
|
|
if (mockDate) {
|
|
MockDate.reset();
|
|
}
|
|
});
|
|
});
|
|
};
|
|
|
|
// eslint-disable-next-line jest/no-export
|
|
export default rtlTest;
|