vant/packages/switch-cell/test/index.spec.js
2019-04-30 15:11:05 +08:00

28 lines
503 B
JavaScript

import SwitchCell from '..';
import { mount } from '../../../test/utils';
test('change event', () => {
const onChange = jest.fn();
const wrapper = mount(SwitchCell, {
context: {
on: {
change: onChange
}
}
});
wrapper.find('.van-switch').trigger('click');
expect(onChange).toHaveBeenCalledWith(true);
});
test('border prop', () => {
const wrapper = mount(SwitchCell, {
propsData: {
border: false
}
});
expect(wrapper).toMatchSnapshot();
});