mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
28 lines
555 B
JavaScript
28 lines
555 B
JavaScript
import { mount } from '@vue/test-utils';
|
|
import Badge from '../';
|
|
import BadgeGroup from '../../badge-group';
|
|
import demoTest from '../../../test/demo-test';
|
|
|
|
demoTest(Badge);
|
|
|
|
test('click', () => {
|
|
const onClick = jest.fn();
|
|
const wrapper = mount({
|
|
template: `
|
|
<badge-group>
|
|
<badge @click="onClick">Text</badge>
|
|
</badge-group>
|
|
`,
|
|
components: {
|
|
Badge,
|
|
BadgeGroup
|
|
},
|
|
methods: {
|
|
onClick
|
|
}
|
|
});
|
|
|
|
wrapper.find('.van-badge').trigger('click');
|
|
expect(onClick.mock.calls[0][0]).toBe(0);
|
|
});
|