diff --git a/src/layout/__test__/Layout.test.js b/src/layout/__test__/Layout.test.js index c3e5780595..2be2ea24b2 100644 --- a/src/layout/__test__/Layout.test.js +++ b/src/layout/__test__/Layout.test.js @@ -16,7 +16,7 @@ describe('', () => { // 默认值测试 expect(wrapper.find('.w-row')).toHaveLength(1); expect(wrapper.type()).toEqual(Row); - + expect(wrapper.at(0).prop('prefixCls')).toBe('w-row'); }); it('Test tag attributes', () => { @@ -35,7 +35,7 @@ describe('', () => { wrapper.setProps({ type: 'flex',justify:'start' }); expect(wrapper.at(0).html()).toContain('
') }); - + it('Test align attributes', () => { wrapper.setProps({ type: 'flex',align:'middle',justify:null }); expect(wrapper.at(0).html()).toContain('
') @@ -44,4 +44,48 @@ describe('', () => { }); +}) +describe('', () => { + const wrapperState = { + value: 0, + }; + var wrapper = mount(); + + it('Test the default props and node.', () => { + expect(wrapper.name()).toBe('Col'); + // 默认值测试 + expect(wrapper.find('.w-col')).toHaveLength(1); + expect(wrapper.type()).toEqual(Col); + expect(wrapper.at(0).prop('prefixCls')).toBe('w-col'); + }); + + it('Test tag attributes', () => { + wrapper.setProps({ tag: 'div' }); + expect(wrapper.at(0).html()).toContain('
') + }); + + it('Test span attributes', () => { + wrapper.setProps({ span: '20' }); + expect(wrapper.at(0).html()).toContain('
') + }); + + it('Test xs attributes', () => { + wrapper.setProps({ span:24, xs: '6' }); + expect(wrapper.at(0).html()).toContain('
') + }); + + it('Test sm attributes', () => { + wrapper.setProps({ xs: '' ,sm :'8' }); + expect(wrapper.at(0).html()).toContain('
') + }); + it('Test sm attributes', () => { + wrapper.setProps({ sm: '' ,md :'10' }); + expect(wrapper.at(0).html()).toContain('
') + }); + it('Test lg attributes', () => { + wrapper.setProps({ md: '' ,lg :'2' }); + expect(wrapper.at(0).html()).toContain('
') + }); + }) \ No newline at end of file