refactor: info component

This commit is contained in:
chenjiahan
2020-07-04 22:38:53 +08:00
parent 79e7b4be65
commit 425ffb87eb
4 changed files with 91 additions and 0 deletions
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should not render when info is empty string 1`] = ``;
exports[`should not render when info is empty undefined 1`] = ``;
exports[`should render when info is zero 1`] = `<div class="van-info">0</div>`;
+32
View File
@@ -0,0 +1,32 @@
import Info from '..';
import { mount } from '../../../test';
test('should not render when info is empty string', () => {
const wrapper = mount(Info, {
propsData: {
info: '',
},
});
expect(wrapper).toMatchSnapshot();
});
test('should not render when info is empty undefined', () => {
const wrapper = mount(Info, {
propsData: {
info: undefined,
},
});
expect(wrapper).toMatchSnapshot();
});
test('should render when info is zero', () => {
const wrapper = mount(Info, {
propsData: {
info: 0,
},
});
expect(wrapper).toMatchSnapshot();
});