Testing Library's built-in [`fireEvent`](dom-testing-library/api-events.mdx#fireevent) is a lightweight wrapper around the browser's low-level `dispatchEvent` API, which allows developers to trigger any event on any element. This is often sufficient for testing simple behavior, e.g., checking that a click event triggers the right callback, but there are cases where the browser does more than just trigger one event for one interaction. For example, when a user types into a text box, the element is first focused, and then input events are fired as they type. `user-event` also adds visibility and interactability checks before triggering the flow, to simulate how a user wouldn't click an element they can't see, and the browser wouldn't let them type in a disabled text box.
0 commit comments