[improvement] add test case for field icon props (#2876)

This commit is contained in:
neverland
2019-03-01 14:18:29 +08:00
committed by GitHub
parent 60b5e188c8
commit 4ad382b33a
6 changed files with 93 additions and 0 deletions
@@ -0,0 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`render icon default slot 1`] = `
<i class="van-icon van-icon-success">Default slot
<!----></i>
`;
exports[`render icon with builtin icon name 1`] = `
<i class="van-icon van-icon-success">
<!----></i>
`;
exports[`render icon with url name 1`] = `
<i class="van-icon van-icon--image"><img src="https://img.yzcdn.com/icon.jpg">
<!----></i>
`;
+29
View File
@@ -0,0 +1,29 @@
import Icon from '..';
import { mount } from '../../../test/utils';
test('render icon with builtin icon name', () => {
const wrapper = mount(Icon, {
propsData: {
name: 'success'
}
});
expect(wrapper).toMatchSnapshot();
});
test('render icon with url name', () => {
const wrapper = mount(Icon, {
propsData: {
name: 'https://img.yzcdn.com/icon.jpg'
}
});
expect(wrapper).toMatchSnapshot();
});
test('render icon default slot', () => {
const wrapper = mount({
render(h) {
return h(Icon, { props: { name: 'success' } }, ['Default slot']);
}
});
expect(wrapper).toMatchSnapshot();
});