mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
38 lines
668 B
JavaScript
38 lines
668 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();
|
|
});
|
|
|
|
test('cell-size prop', () => {
|
|
const wrapper = mount(SwitchCell, {
|
|
propsData: {
|
|
cellSize: 'large'
|
|
}
|
|
});
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|