[Improvement] Switch: add test cases (#1202)

This commit is contained in:
neverland
2018-05-30 20:35:30 +08:00
committed by GitHub
parent 06056dc226
commit 49701851f7
5 changed files with 143 additions and 68 deletions

View File

@@ -0,0 +1,13 @@
import SwitchCell from '..';
import { mount } from '@vue/test-utils';
test('emit event', () => {
const wrapper = mount(SwitchCell);
wrapper.vm.$on('input', value => {
wrapper.setProps({ value });
});
wrapper.find('.van-switch').trigger('click');
expect(wrapper.emitted('change')).toBeTruthy();
});