补充 Col & Row 测试用例 (#16)

* layout test

* fix row

* update layout test
This commit is contained in:
wny
2017-04-26 10:07:09 +08:00
committed by 张敏
parent fab9682e9a
commit b98a624960
7 changed files with 2483 additions and 7 deletions
+25
View File
@@ -0,0 +1,25 @@
<template>
<van-row gutter="10">
<van-col span="8">
<div class="gray">span: 8</div>
</van-col>
<van-col span="8">
<div class="gray">span: 8</div>
</van-col>
<van-col span="8">
<div class="gray">span: 8</div>
</van-col>
</van-row>
</template>
<script>
import Row from 'packages/row';
import Col from 'packages/col';
export default {
components: {
'van-row': Row,
'van-col': Col
}
};
</script>
+41
View File
@@ -0,0 +1,41 @@
import { mount } from 'avoriaz';
import Col from 'packages/col';
import Row from 'packages/row';
import RowTestComponent from '../components/row';
describe('Layout', () => {
let wrapper;
afterEach(() => {
wrapper && wrapper.destroy();
});
it('create a simple row', () => {
wrapper = mount(Row);
expect(wrapper.hasClass('van-row')).to.be.true;
expect(wrapper.computed().style()).to.be.empty;
});
it('create a simple column', () => {
wrapper = mount(Col, {
propsData: {
span: 8,
offset: 8
}
});
expect(wrapper.hasClass('van-col')).to.be.true;
expect(wrapper.hasClass('van-col-8')).to.be.true;
expect(wrapper.hasClass('van-col-offset-8')).to.be.true;
expect(wrapper.computed().gutter()).to.equal(0);
});
it('create a gutter row', () => {
wrapper = mount(RowTestComponent);
const row = wrapper.find(Row)[0];
const column = wrapper.find(Col)[0];
expect(row.hasStyle('margin-left', '-5px')).to.be.true;
expect(row.hasStyle('margin-right', '-5px')).to.be.true;
expect(column.hasStyle('padding-left', '5px')).to.be.true;
expect(column.hasStyle('padding-right', '5px')).to.be.true;
});
});