import { mount } from '@vue/test-utils'; import Space from '..'; import mountTest from '../../../tests/shared/mountTest'; describe('Space', () => { mountTest(Space); it('should render width empty children', () => { const wrapper = mount({ render() { return ; }, }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render width customize size', () => { const wrapper = mount({ render() { return ( 1 2 ); }, }); expect(wrapper.findAll('.ant-space-item')[0].element.style.marginRight).toBe('10px'); expect(wrapper.findAll('.ant-space-item')[1].element.style.marginRight).toBeFalsy(); }); it('should render vertical space width customize size', () => { const wrapper = mount({ render() { return ( 1 2 ); }, }); expect(wrapper.findAll('.ant-space-item')[0].element.style.marginBottom).toBe('10px'); expect(wrapper.findAll('.ant-space-item')[1].element.style.marginBottom).toBeFalsy(); }); it('should render correct with children', () => { const wrapper = mount({ render() { return ( text1text1 text3 ); }, }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render with invalidElement', () => { const wrapper = mount({ render() { return ( text1text1 text1 ); }, }); expect(wrapper.findAll('.ant-space-item').length).toBe(3); }); });