import React from 'react'; import { render, mount } from 'enzyme'; import Space from '..'; import ConfigProvider from '../../config-provider'; import mountTest from '../../../tests/shared/mountTest'; describe('Space', () => { mountTest(Space); it('should render width empty children', () => { const wrapper = mount(); expect(wrapper.instance()).toBe(null); }); it('should render width ConfigProvider', () => { const wrapper = mount( 1 2 1 2 1 2 , ); expect(render(wrapper)).toMatchSnapshot(); }); it('should render width customize size', () => { const wrapper = mount( 1 2 , ); expect(wrapper.find('.ant-space-item').at(0).prop('style').marginRight).toBe(10); expect(wrapper.find('.ant-space-item').at(1).prop('style').marginRight).toBeUndefined(); }); it('should render vertical space width customize size', () => { const wrapper = mount( 1 2 , ); expect(wrapper.find('.ant-space-item').at(0).prop('style').marginBottom).toBe(10); expect(wrapper.find('.ant-space-item').at(1).prop('style').marginBottom).toBeUndefined(); }); it('should render correct with children', () => { const wrapper = mount( text1text1 <>text3 , ); expect(render(wrapper)).toMatchSnapshot(); }); it('should render with invalidElement', () => { const wrapper = mount( text1text1 text1 , ); expect(wrapper.find('.ant-space-item').length).toBe(3); }); });