📜  模拟点击笑话 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:46.140000             🧑  作者: Mango

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

describe('Test Button component', () => {
  it('Test click event', () => {
    const mockCallBack = jest.fn();

    const button = shallow(());
    button.find('button').simulate('click');
    expect(mockCallBack.mock.calls.length).toEqual(1);
  });
});