📜  模拟点击功能功能组件酶 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:52.950000             🧑  作者: Mango

代码示例1
import React from 'react';
import Profile from '.';
import { shallow } from 'enzyme';

describe('62202833', () => {
  it('should pass', () => {
    const wrapper = shallow();
    const mEvent = { preventDefault: jest.fn() };
    wrapper.find('button').simulate('click', mEvent);
    expect(mEvent.preventDefault).toBeCalledTimes(1);
  });
});