mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
test: press enter to search
This commit is contained in:
parent
12d0aedeca
commit
ac4a9086a0
@ -77,4 +77,14 @@ describe('Input.Search', () => {
|
||||
expect(onSearch).toHaveBeenCalledTimes(1);
|
||||
expect(onSearch).toBeCalledWith('search text');
|
||||
});
|
||||
|
||||
it('should trigger onSearch when press enter', () => {
|
||||
const onSearch = jest.fn();
|
||||
const wrapper = mount(
|
||||
<Search defaultValue="search text" onSearch={onSearch} />
|
||||
);
|
||||
wrapper.find('input').simulate('keydown', { key: 'Enter', keyCode: 13 });
|
||||
expect(onSearch).toHaveBeenCalledTimes(1);
|
||||
expect(onSearch).toBeCalledWith('search text');
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user