You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all!
Need a help with react-testing-library. I use Preact in my project, and use preact-testing-library wrapper for RTL.
The problem is in the onInput event. The project is big and there are many controlled inputs. These inputs don't have onChange event handler, but they have onInput handler instead.
I'm trying to write a simple test for my component:
it('First test', async () => {
const field = await screen.findByLabelText('label');
// type in the field
fireEvent.input(field, { target: { value: 'BADBADBAD12345' }});
});
When I call the fireEvent.change method, the onChange handler called. But no method (fireEvent.change, fireEvent.input) does not fire the onInput handler.
I tried to use @testing-library/user-event, and call userEvent.type, but still no effect.
Can somebody help with this issue?
I don't have any option to change the onInput to onChange.
The text was updated successfully, but these errors were encountered:
eps1lon
transferred this issue from testing-library/react-testing-library
Aug 4, 2022
@valisij94 is there any chance you have a reproduction of this? I'd be interested in looking into it. Experimenting locally in a simple example, this seems to work for me,
Hi all!
Need a help with react-testing-library. I use Preact in my project, and use preact-testing-library wrapper for RTL.
The problem is in the
onInput
event. The project is big and there are many controlled inputs. These inputs don't haveonChange
event handler, but they haveonInput
handler instead.I'm trying to write a simple test for my component:
And this is a code fragment of my component:
When I call the
fireEvent.change
method, theonChange
handler called. But no method (fireEvent.change
,fireEvent.input
) does not fire theonInput
handler.I tried to use
@testing-library/user-event
, and calluserEvent.type
, but still no effect.Can somebody help with this issue?
I don't have any option to change the
onInput
toonChange
.The text was updated successfully, but these errors were encountered: