mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[Improvement] Switch: add test cases (#1202)
This commit is contained in:
13
packages/switch/test/index.spec.js
Normal file
13
packages/switch/test/index.spec.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import Switch from '..';
|
||||
import { mount } from '@vue/test-utils';
|
||||
|
||||
test('emit event', () => {
|
||||
const wrapper = mount(Switch);
|
||||
wrapper.trigger('click');
|
||||
wrapper.trigger('click');
|
||||
wrapper.setProps({ disabled: true });
|
||||
wrapper.trigger('click');
|
||||
|
||||
expect(wrapper.emitted('input')).toEqual([[true], [true]]);
|
||||
expect(wrapper.emitted('change')).toEqual([[true], [true]]);
|
||||
});
|
Reference in New Issue
Block a user