I have a Select Box and set the data in a state by the onChange
event. Please have a look at the below code. Anyone can help me to write cases for this onChange
event in React Testing Library.
const [optionValue, setOptionValue] = useState({ value: '', label: '' })
const handleOnChange = (option: OptionType): void => setOptionValue(option)
<Select name={title} id={title} placeholder="Choose an Option" options={setOptionsData} defaultOption={optionValue} onChange={e => { handleOnChange(e) }} data-test="options" />