Skip to content

Commit

Permalink
test: replace Empty part test with test lib (#35289)
Browse files Browse the repository at this point in the history
* test: replace Empty part test with test lib

* test: update snapshot case
  • Loading branch information
lalalazero committed Apr 29, 2022
1 parent e153cf0 commit 1fed15c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions components/empty/__tests__/index.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { mount } from 'enzyme';
import Empty from '..';
import ConfigProvider from '../../config-provider';
import { render } from '../../../tests/utils';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';

Expand All @@ -10,21 +10,21 @@ describe('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);
const { container } = render(<Empty imageStyle={{ height: 20 }} />);
expect(container.querySelector('.ant-empty-image').style.height).toBe('20px');
});

it('description can be false', () => {
const wrapper = mount(<Empty description={false} />);
expect(wrapper.find('.ant-empty-description').length).toBe(0);
const { container } = render(<Empty description={false} />);
expect(container.querySelector('.ant-empty-description')).toBeFalsy();
});

it('should render in RTL direction', () => {
const wrapper = mount(
const { asFragment } = render(
<ConfigProvider direction="rtl">
<Empty />
</ConfigProvider>,
);
expect(wrapper.render()).toMatchSnapshot();
expect(asFragment().firstChild).toMatchSnapshot();
});
});

0 comments on commit 1fed15c

Please sign in to comment.