我试图找出使用jest测试material-ui的SelectField组件的正确方法。我需要用某些参数模拟变化。我现在拥有的:
it('when SelectField with id city_id changed, onFilterChanged prop should be called', () => {
const SelectField = form.findWhere(n => n.props().id === 'city_id' && n.name() === 'SelectField').find('[type="button"]')
const spy = jest.spyOn(defaultProps, 'onFilterChanged')
SelectField.simulate('change')
expect(spy).toBeCalled()
})
它应该在SelectField中找到一个按钮并单击它。我的问题是如何使用某些参数模拟SelectField上的更改?