mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(ActionBarButton): update test cases
This commit is contained in:
parent
0bd440c53e
commit
9c841da26d
10
src/action-bar-button/test/__snapshots__/index.spec.js.snap
Normal file
10
src/action-bar-button/test/__snapshots__/index.spec.js.snap
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`should render default slot and match snapshot 1`] = `
|
||||||
|
<button type="button" class="van-button van-button--default van-button--large van-action-bar-button">
|
||||||
|
<div class="van-button__content">
|
||||||
|
<!----><span class="van-button__text">Content</span>
|
||||||
|
<!---->
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
`;
|
11
src/action-bar-button/test/index.spec.js
Normal file
11
src/action-bar-button/test/index.spec.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { mount } from '@vue/test-utils';
|
||||||
|
import ActionBarButton from '..';
|
||||||
|
|
||||||
|
test('should render default slot and match snapshot', () => {
|
||||||
|
const wrapper = mount(ActionBarButton, {
|
||||||
|
slots: {
|
||||||
|
default: 'Content',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(wrapper.html()).toMatchSnapshot();
|
||||||
|
});
|
@ -1,30 +1,13 @@
|
|||||||
import ActionBar from '..';
|
import ActionBar from '..';
|
||||||
import Button from '../../action-bar-button';
|
|
||||||
import Icon from '../../action-bar-icon';
|
import Icon from '../../action-bar-icon';
|
||||||
import { mount } from '../../../test';
|
import { mount } from '../../../test';
|
||||||
|
|
||||||
test('Button click event', () => {
|
|
||||||
const wrapper = mount(Button);
|
|
||||||
wrapper.trigger('click');
|
|
||||||
expect(wrapper.emitted('click').length).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Icon click event', () => {
|
test('Icon click event', () => {
|
||||||
const wrapper = mount(Icon);
|
const wrapper = mount(Icon);
|
||||||
wrapper.trigger('click');
|
wrapper.trigger('click');
|
||||||
expect(wrapper.emitted('click').length).toEqual(1);
|
expect(wrapper.emitted('click').length).toEqual(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Button render default slot', () => {
|
|
||||||
const wrapper = mount({
|
|
||||||
render(h) {
|
|
||||||
return h(Button, null, ['Default Content']);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(wrapper.html()).toMatchSnapshot();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('Icon render default slot', () => {
|
test('Icon render default slot', () => {
|
||||||
const wrapper = mount({
|
const wrapper = mount({
|
||||||
render(h) {
|
render(h) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user