Skip to content

Commit

Permalink
Layout Col test (#17)
Browse files Browse the repository at this point in the history
* Update README.md

* TagGroup 动态添加数据 点击删除无法获取相应数据问题

* Update README.md

* input test

* 合并

* input test2

* Adding default value of porps size on module Avatar and some test cases.

* fix(affix): Fix bug where body.scrollTop is 0.

* InputNumber add defaultValue

* InputNumber test

* layout md text description wrong

* Layout Row test

* Layout Col test
  • Loading branch information
kooff88 authored and jaywcjlove committed Nov 16, 2017
1 parent 18e123b commit 47a616f
Showing 1 changed file with 46 additions and 2 deletions.
48 changes: 46 additions & 2 deletions src/layout/__test__/Layout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('<Row>', () => {
// 默认值测试
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', () => {
Expand All @@ -35,7 +35,7 @@ describe('<Row>', () => {
wrapper.setProps({ type: 'flex',justify:'start' });
expect(wrapper.at(0).html()).toContain('<div class="w-row-flex w-row-justify-start"></div>')
});

it('Test align attributes', () => {
wrapper.setProps({ type: 'flex',align:'middle',justify:null });
expect(wrapper.at(0).html()).toContain('<div class="w-row-flex w-row-align-middle"></div>')
Expand All @@ -44,4 +44,48 @@ describe('<Row>', () => {
});


})
describe('<Col>', () => {
const wrapperState = {
value: 0,
};
var wrapper = mount(<Col
></Col>);

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('<div class="w-col w-col-24"></div>')
});

it('Test span attributes', () => {
wrapper.setProps({ span: '20' });
expect(wrapper.at(0).html()).toContain('<div class="w-col w-col-20"></div>')
});

it('Test xs attributes', () => {
wrapper.setProps({ span:24, xs: '6' });
expect(wrapper.at(0).html()).toContain('<div class="w-col w-col-24 w-col-xs-6"></div>')
});

it('Test sm attributes', () => {
wrapper.setProps({ xs: '' ,sm :'8' });
expect(wrapper.at(0).html()).toContain('<div class="w-col w-col-24 w-col-sm-8"></div>')
});
it('Test sm attributes', () => {
wrapper.setProps({ sm: '' ,md :'10' });
expect(wrapper.at(0).html()).toContain('<div class="w-col w-col-24 w-col-md-10"></div>')
});
it('Test lg attributes', () => {
wrapper.setProps({ md: '' ,lg :'2' });
expect(wrapper.at(0).html()).toContain('<div class="w-col w-col-24 w-col-lg-2"></div>')
});

})

0 comments on commit 47a616f

Please sign in to comment.