Skip to content

Conversation

@swarnim02
Copy link

Fixes #1422

Problem

fireEvent.mouseEnter was not forwarding relatedTarget properly - it would be window instead of the specified element.

Solution

Changed spread operator to explicit parameters in fire-event.js:

  • (...args) =>(node, init) =>

This ensures relatedTarget and other event properties are properly passed through.

Changes

  • Fixed mouseEnter, mouseLeave, pointerEnter, pointerLeave, blur, focus
  • Added comprehensive tests

Testing

fireEvent.mouseEnter(element, { relatedTarget: mockElement }) // Now correctly receives mockElement instead of window
- Changed spread operator to explicit parameters in mouseEnter/mouseLeave - Fixed pointerEnter/pointerLeave and blur/focus for consistency - Added tests to verify relatedTarget is properly forwarded Fixes testing-library#1422
@codesandbox-ci
Copy link

codesandbox-ci bot commented Nov 27, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f7ca7bc:

Sandbox Source
react-testing-library-examples Configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant