test(ActionBar): update test cases
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`should render default slot and match snapshot 1`] = `
|
||||
<div role="button" class="van-action-bar-icon" tabindex="0">
|
||||
<div class="van-badge__wrapper van-icon van-icon-undefined van-action-bar-icon__icon">
|
||||
<!---->
|
||||
<!---->
|
||||
<!---->
|
||||
</div>Content
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render icon slot and match snapshot 1`] = `
|
||||
<div role="button" class="van-action-bar-icon" tabindex="0">
|
||||
<div class="van-badge__wrapper van-action-bar-icon__icon">Custom Icon
|
||||
<!---->
|
||||
</div>Content
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render icon slot with badge and match snapshot 1`] = `
|
||||
<div role="button" class="van-action-bar-icon" tabindex="0">
|
||||
<div class="van-badge__wrapper van-action-bar-icon__icon">Custom Icon<div class="van-badge van-badge--fixed">1</div>
|
||||
</div>Content
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`should render icon slot with dot and match snapshot 1`] = `
|
||||
<div role="button" class="van-action-bar-icon" tabindex="0">
|
||||
<div class="van-badge__wrapper van-action-bar-icon__icon">Custom Icon<div class="van-badge van-badge--dot van-badge--fixed">
|
||||
<!---->
|
||||
</div>
|
||||
</div>Content
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,50 @@
|
||||
import { mount } from '@vue/test-utils';
|
||||
import ActionBarIcon from '..';
|
||||
|
||||
test('should render default slot and match snapshot', () => {
|
||||
const wrapper = mount(ActionBarIcon, {
|
||||
slots: {
|
||||
default: 'Content',
|
||||
},
|
||||
});
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should render icon slot and match snapshot', () => {
|
||||
const wrapper = mount(ActionBarIcon, {
|
||||
slots: {
|
||||
default: 'Content',
|
||||
icon: 'Custom Icon',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should render icon slot with badge and match snapshot', () => {
|
||||
const wrapper = mount(ActionBarIcon, {
|
||||
props: {
|
||||
badge: '1',
|
||||
},
|
||||
slots: {
|
||||
default: 'Content',
|
||||
icon: 'Custom Icon',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should render icon slot with dot and match snapshot', () => {
|
||||
const wrapper = mount(ActionBarIcon, {
|
||||
props: {
|
||||
dot: true,
|
||||
},
|
||||
slots: {
|
||||
default: 'Content',
|
||||
icon: 'Custom Icon',
|
||||
},
|
||||
});
|
||||
|
||||
expect(wrapper.html()).toMatchSnapshot();
|
||||
});
|
||||
Reference in New Issue
Block a user