Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan committed Aug 7, 2024
1 parent 60dad5d commit 5a2537c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,16 @@ describe('Input ref', () => {

it('support onClear', () => {
const onClear = jest.fn();
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
const { container } = render(
<Input onClear={onClear} defaultValue="test" allowClear />,
);
fireEvent.click(
container.querySelector<HTMLSpanElement>('.rc-input-clear-icon')!,
);
expect(onClear).toHaveBeenCalled();
expect(errorSpy).not.toHaveBeenCalled();
errorSpy.mockRestore();
});
});

Expand Down

0 comments on commit 5a2537c

Please sign in to comment.