test(Layout): update test cases

This commit is contained in:
chenjiahan 2020-11-14 06:40:00 +08:00
parent d212883c5e
commit b5e13563eb
4 changed files with 71 additions and 70 deletions

View File

@ -1,22 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`gutter prop 1`] = `
<div class="van-row">
<div class="van-col van-col--24">24</div>
<div class="van-col van-col--12" style="padding-right: 12px;">12</div>
<div class="van-col van-col--12" style="padding-left: 12px;">12</div>
<div class="van-col van-col--8" style="padding-right: 16px;">8</div>
<div class="van-col van-col--8" style="padding-left: 8px; padding-right: 8px;">8</div>
<div class="van-col van-col--8" style="padding-left: 16px;">8</div>
<div class="van-col van-col--6" style="padding-right: 18px;">6</div>
<div class="van-col van-col--6" style="padding-left: 6px; padding-right: 12px;">6</div>
<div class="van-col van-col--6" style="padding-left: 12px; padding-right: 6px;">6</div>
<div class="van-col van-col--6" style="padding-left: 18px;">6</div>
<div class="van-col van-col--7" style="padding-right: 18px;">7</div>
<div class="van-col van-col--6" style="padding-left: 6px; padding-right: 12px;">6</div>
<div class="van-col van-col--5" style="padding-left: 12px; padding-right: 6px;">5</div>
<div class="van-col van-col--4" style="padding-left: 18px;">4</div>
<div class="van-col van-col--3" style="padding-right: 12px;">3</div>
<div class="van-col van-col--2" style="padding-left: 12px;">2</div>
</div>
`;

View File

@ -0,0 +1,28 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should render Col correcly 1`] = `
<div class="van-col van-col--8">
<!---->
</div>
`;
exports[`should render gutter correctly 1`] = `
<div class="van-row">
<div class="van-col van-col--24">24</div>
<div class="van-col van-col--12">12</div>
<div style="padding-left: 12px;" class="van-col van-col--12">12</div>
<div class="van-col van-col--8">8</div>
<div style="padding-left: 12px;" class="van-col van-col--8">8</div>
<div style="padding-left: 16px;" class="van-col van-col--8">8</div>
<div class="van-col van-col--6">6</div>
<div style="padding-left: 12px;" class="van-col van-col--6">6</div>
<div style="padding-left: 16px;" class="van-col van-col--6">6</div>
<div style="padding-left: 18px;" class="van-col van-col--6">6</div>
<div class="van-col van-col--7">7</div>
<div style="padding-left: 12px;" class="van-col van-col--6">6</div>
<div style="padding-left: 16px;" class="van-col van-col--5">5</div>
<div style="padding-left: 18px;" class="van-col van-col--4">4</div>
<div class="van-col van-col--3">3</div>
<div style="padding-left: 12px;" class="van-col van-col--2">2</div>
</div>
`;

View File

@ -1,48 +0,0 @@
import Col from '..';
import Row from '../../row';
import { mount } from '@vue/test-utils';
test('Col click event', () => {
const wrapper = mount(Col);
wrapper.trigger('click');
expect(wrapper.emitted('click')).toBeTruthy();
});
test('Row click event', () => {
const wrapper = mount(Row);
wrapper.trigger('click');
expect(wrapper.emitted('click')).toBeTruthy();
});
test('gutter prop', () => {
const wrapper = mount({
template: `
<van-row gutter="24">
<van-col span="24">24</van-col>
<van-col span="12">12</van-col>
<van-col span="12">12</van-col>
<van-col span="8">8</van-col>
<van-col span="8">8</van-col>
<van-col span="8">8</van-col>
<van-col span="6">6</van-col>
<van-col span="6">6</van-col>
<van-col span="6">6</van-col>
<van-col span="6">6</van-col>
<van-col span="7">7</van-col>
<van-col span="6">6</van-col>
<van-col span="5">5</van-col>
<van-col span="4">4</van-col>
<van-col span="3">3</van-col>
<van-col span="2">2</van-col>
</van-row>
`,
});
expect(wrapper.html()).toMatchSnapshot();
});

View File

@ -0,0 +1,43 @@
import Col from '..';
import Row from '../../row';
import { mount } from '@vue/test-utils';
test('should render Col correcly', () => {
const wrapper = mount(Col, {
props: {
span: 8,
},
});
expect(wrapper.html()).toMatchSnapshot();
});
test('should render gutter correctly', () => {
const wrapper = mount({
render: () => (
<Row gutter="24">
<Col span="24">24</Col>
<Col span="12">12</Col>
<Col span="12">12</Col>
<Col span="8">8</Col>
<Col span="8">8</Col>
<Col span="8">8</Col>
<Col span="6">6</Col>
<Col span="6">6</Col>
<Col span="6">6</Col>
<Col span="6">6</Col>
<Col span="7">7</Col>
<Col span="6">6</Col>
<Col span="5">5</Col>
<Col span="4">4</Col>
<Col span="3">3</Col>
<Col span="2">2</Col>
</Row>
),
});
expect(wrapper.html()).toMatchSnapshot();
});