ant-design/components/empty/__tests__/index.test.js
afc163 30ac6bd4e4
test: wrap React.StrictMode for test cases (#35026)
* test: React StrictMode

* test: fix Spin test

* chore: wrapper enzyme

* test: fix setState

* test: more test cover

* test: more test cover

* test: more test cover

* test: more test cover

* test: more test cover

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: more test case

* test: disable part of it

* test: fix test & add placeholder

* test: Use orign enzyme mount

Co-authored-by: zombiej <smith3816@gmail.com>
2022-04-18 21:02:11 +08:00

31 lines
895 B
JavaScript

import React from 'react';
import { mount } from 'enzyme';
import Empty from '..';
import ConfigProvider from '../../config-provider';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
describe('Empty', () => {
mountTest(Empty);
rtlTest(Empty);
it('image size should change', () => {
const wrapper = mount(<Empty imageStyle={{ height: 20 }} />);
expect(wrapper.find('.ant-empty-image').props().style.height).toBe(20);
});
it('description can be false', () => {
const wrapper = mount(<Empty description={false} />);
expect(wrapper.find('.ant-empty-description').length).toBe(0);
});
it('should render in RTL direction', () => {
const wrapper = mount(
<ConfigProvider direction="rtl">
<Empty />
</ConfigProvider>,
);
expect(wrapper.render()).toMatchSnapshot();
});
});