fireEvent
fireEvent was originally in the @testing-library/dom package, but @testing-library/react rewrote it and gave it additional React-specific functionality. It can simulate user actions to trigger events.
usage
instruction event fireEvent.click(DOM) mouse click on the DOM fireEvent.change(input, { target: { value: “x” } }); User enters x fireEvent.mouseOver(DOM); Move the mouse into the DOM fireEvent.keyPress(inputEl, { key: “Enter”, code: “Enter”, charCode: 13 }); keyboard press event Note that in
fireEvent.change(input, { target: { value: "x" } });
,''
should be used here even if the input format is a number.