test(Badge): fix prop name

This commit is contained in:
chenjiahan 2020-11-22 19:46:41 +08:00
parent 4154dc7404
commit c9ff79390f
2 changed files with 13 additions and 9 deletions

View File

@ -6,8 +6,12 @@ exports[`should render content slot correctly 1`] = `
</div> </div>
`; `;
exports[`should render nothing when badge is empty string 1`] = ``; exports[`should render nothing when content is empty string 1`] = ``;
exports[`should render nothing when badge is undefined 1`] = ``; exports[`should render nothing when content is undefined 1`] = ``;
exports[`should render nothing when badge is zero 1`] = ``; exports[`should render nothing when content is zero 1`] = `
<div class="van-badge">
0
</div>
`;

View File

@ -1,30 +1,30 @@
import Badge from '..'; import Badge from '..';
import { mount } from '@vue/test-utils'; import { mount } from '@vue/test-utils';
test('should render nothing when badge is empty string', () => { test('should render nothing when content is empty string', () => {
const wrapper = mount(Badge, { const wrapper = mount(Badge, {
props: { props: {
badge: '', content: '',
}, },
}); });
expect(wrapper.html()).toMatchSnapshot(); expect(wrapper.html()).toMatchSnapshot();
}); });
test('should render nothing when badge is undefined', () => { test('should render nothing when content is undefined', () => {
const wrapper = mount(Badge, { const wrapper = mount(Badge, {
props: { props: {
badge: undefined, content: undefined,
}, },
}); });
expect(wrapper.html()).toMatchSnapshot(); expect(wrapper.html()).toMatchSnapshot();
}); });
test('should render nothing when badge is zero', () => { test('should render nothing when content is zero', () => {
const wrapper = mount(Badge, { const wrapper = mount(Badge, {
props: { props: {
badge: 0, content: 0,
}, },
}); });