fix test cov for Search onChange

This commit is contained in:
afc163 2019-09-13 13:04:43 +08:00 committed by 偏右
parent 6f695b050e
commit 09810a28d9

View File

@ -141,14 +141,15 @@ describe('Input.Search', () => {
// https://github.com/ant-design/ant-design/issues/18729
it('should trigger onSearch when click clear icon', () => {
const onSearch = jest.fn();
const wrapper = mount(<Search allowClear defaultValue="value" onSearch={onSearch} />);
const onChange = jest.fn();
const wrapper = mount(
<Search allowClear defaultValue="value" onSearch={onSearch} onChange={onChange} />,
);
wrapper
.find('.ant-input-clear-icon')
.at(0)
.simulate('click');
expect(onSearch).toHaveBeenLastCalledWith(
'',
expect.anything(),
);
expect(onSearch).toHaveBeenLastCalledWith('', expect.anything());
expect(onChange).toHaveBeenCalled();
});
});