可以在自定义事件上使用 Enzyme 的方法 .simulate()。例如:
// Code
<Element onFoo={someFunction}></Elements>
// Test
const element = shallow(<Element>);
element.simulate('foo');
这是应该使用酶测试自定义事件的方式还是使用 s.th. 的更好方法?喜欢:
//Test
const element = shallow(<Element>);
element.props.onFoo()