I am writing a wrapper on top of Air-datepicker in React.js for our component library. I have chosen to pass/override ‘onSelect’ hook while passing the options to Datepicker while instantiating.
While writing the unit test using Jest and react-testing-library, I am not able to invoke onSelect
handler through the event mechanism. The steps I am following:
- rendered the component.
- picked the text input component (a React component) using screen API.
- Fired focusIn event on text input, so that date picker will be displayed.
- Next, I am trying to select datepicker-cell.
- Next I am trying to fire the click event on datepicker-cell.
- If I put the breakpoint in
onSelect
hook, the control never comes to this hook.
Could you please help, how can I solve this issue?