mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 10:07:07 +00:00
[improvement] Functional: ContactList, NavBar, Panel, SubmitBar, SwitchCell, Tag (#2675)
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
import SwitchCell from '..';
|
||||
import { mount } from '../../../test/utils';
|
||||
|
||||
test('emit event', () => {
|
||||
const wrapper = mount(SwitchCell);
|
||||
test('change event', () => {
|
||||
const onChange = jest.fn();
|
||||
const wrapper = mount(SwitchCell, {
|
||||
context: {
|
||||
on: {
|
||||
change: onChange
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.vm.$on('input', value => {
|
||||
wrapper.setProps({ value });
|
||||
});
|
||||
wrapper.find('.van-switch').trigger('click');
|
||||
|
||||
expect(wrapper.emitted('change')).toBeTruthy();
|
||||
expect(onChange.mock.calls[0]).toBeTruthy();
|
||||
});
|
||||
|
Reference in New Issue
Block a user