Skip to content

Commit 072621b

Browse files
committed
chore: add unit test
1 parent a08bf2f commit 072621b

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/Select.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ describe('Select.Basic', () => {
923923
const onCompositionEnd = jest.fn();
924924
const textareaRef = jest.fn();
925925
const mouseDownPreventDefault = jest.fn();
926+
const onPaste = jest.fn();
926927
const { container } = render(
927928
<Select
928929
mode="combobox"
@@ -933,6 +934,7 @@ describe('Select.Basic', () => {
933934
onMouseDown={onMouseDown}
934935
onCompositionStart={onCompositionStart}
935936
onCompositionEnd={onCompositionEnd}
937+
onPaste={onPaste}
936938
ref={textareaRef}
937939
className="custom-input"
938940
/>
@@ -964,6 +966,13 @@ describe('Select.Basic', () => {
964966
expect(textareaRef).toHaveBeenCalled();
965967
expect(onCompositionStart).toHaveBeenCalled();
966968
expect(onCompositionEnd).toHaveBeenCalled();
969+
970+
fireEvent.paste(textareaEle, {
971+
target: { value: 'hi' },
972+
clipboardData: { getData: () => 'hi' },
973+
});
974+
expect(onPaste).toHaveBeenCalled();
975+
expect(textareaEle.value).toEqual('hi');
967976
});
968977

969978
it('not override customize props', () => {

0 commit comments

Comments
 (0)