What’s the correct call to fire an
onChangeevent on an input with react-testing-library’sfireEventAPI?fireEvent.change(input, { target: { value: 'myValue' } });fireEvent.change(input, { value: 'myValue' });fireEvent.onChange(input, { target: { value: 'myValue' } });
How would you fire a click event on a submit button with react-testing-library
fireEventAPI?fireEvent.onClick(button);fireEvent.click(button);fireEvent.onClick(button, { target: { value: 'submit' } });
When locating an element by using one of the screen querying methods from react-testing-library, such as
screen.getByRoleorscreen.getByLabelText, what would be the return value of the call if the element is not found?An error will be thrown
null
undefined

