Skip to content

Commit 8a16023

Browse files
committed
fix: event miss type
1 parent cfdcf03 commit 8a16023

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>((props, ref) => {
7171
onChange?.({
7272
target: {
7373
...props,
74+
type,
7475
checked: e.target.checked,
7576
},
7677
stopPropagation() {

tests/index.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ describe('rc-checkbox', () => {
168168
fireEvent.click(inputEl);
169169

170170
expect(onChange).toHaveBeenCalledTimes(1);
171+
expect(onChange).toHaveBeenCalledWith(
172+
expect.objectContaining({
173+
target: expect.objectContaining({ type: 'checkbox', checked: true }),
174+
}),
175+
);
171176
expect(inputEl.checked).toBe(true);
172177
});
173178

0 commit comments

Comments
 (0)