Browse Source

test: add more space test (#30099)

pull/30098/head
xrkffgg 4 years ago
committed by GitHub
parent
commit
e8b4d03265
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      components/space/__tests__/__snapshots__/index.test.js.snap
  2. 13
      components/space/__tests__/index.test.js

2
components/space/__tests__/__snapshots__/index.test.js.snap

@ -1,5 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Space rtl render component should be rendered correctly in RTL direction 1`] = `null`;
exports[`Space should render correct with children 1`] = `
<div
class="ant-space ant-space-horizontal ant-space-align-center"

13
components/space/__tests__/index.test.js

@ -4,9 +4,11 @@ import { act } from 'react-test-renderer';
import Space from '..';
import ConfigProvider from '../../config-provider';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
describe('Space', () => {
mountTest(Space);
rtlTest(Space);
it('should render width empty children', () => {
const wrapper = mount(<Space />);
@ -47,6 +49,17 @@ describe('Space', () => {
expect(wrapper.find('div.ant-space-item').at(1).prop('style').marginRight).toBeUndefined();
});
it('should render width size 0', () => {
const wrapper = mount(
<Space size={NaN}>
<span>1</span>
<span>2</span>
</Space>,
);
expect(wrapper.find('div.ant-space-item').at(0).prop('style').marginRight).toBe(0);
});
it('should render vertical space width customize size', () => {
const wrapper = mount(
<Space size={10} direction="vertical">

Loading…
Cancel
Save