import React, { ChangeEvent, useRef } from 'react'; import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { createSyntheticEvent } from '..'; const MyInputComponent = ({ onChange, }: React.ComponentPropsWithoutRef<'input'>) => { const inputRef = useRef(null); const handleClick = () => { const nativeEvent = new Event('change', { bubbles: true }); const synthEvent = createSyntheticEvent(nativeEvent, inputRef.current!); onChange?.(synthEvent as ChangeEvent); }; return ( <>