Merge branch '1.x' into 'dev'

This commit is contained in:
陈嘉涵 2019-05-13 12:02:26 +08:00
commit f94df82ceb
5 changed files with 41 additions and 1 deletions

View File

@ -17,7 +17,7 @@ function Info(
slots: DefaultSlots,
ctx: RenderContext<InfoProps>
) {
if (!isDef(props.info)) {
if (!isDef(props.info) || props.info === '') {
return;
}

View File

@ -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>`;

View File

@ -0,0 +1,32 @@
import Info from '..';
import { mount } from '../../../test/utils';
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();
});

View File

@ -10,6 +10,7 @@
left: 0;
width: 100%;
height: 100%;
overflow: hidden; // to clip file-upload-button
cursor: pointer;
opacity: 0;
}