index.spec.js 345 B

1234567891011121314151617
  1. import SwitchCell from '..';
  2. import { mount } from '../../../test/utils';
  3. test('change event', () => {
  4. const onChange = jest.fn();
  5. const wrapper = mount(SwitchCell, {
  6. context: {
  7. on: {
  8. change: onChange
  9. }
  10. }
  11. });
  12. wrapper.find('.van-switch').trigger('click');
  13. expect(onChange).toHaveBeenCalledWith(true);
  14. });