user-event icon indicating copy to clipboard operation
user-event copied to clipboard

Support `MouseEvent.relatedTarget`

Open radqut opened this issue 2 years ago • 0 comments

Reproduction example

https://codesandbox.io/p/sandbox/old-butterfly-239l2c?file=%2Fsrc%2FApp.test.js%3A4%2C37

Prerequisites

  1. Render the structure below
<div>
      <p data-testid="text1" onMouseLeave={onMouseLeave}>text1</p>
      <p data-testid="text2">text2</p>
</div>
  1. Find these fields
  const text1 = screen.getByTestId('text1')
  const text2 = screen.getByTestId('text2')
  1. Move the cursor
await user.pointer([{target: text1}, {target: text2}])

Expected behavior

event.relatedTarget should be <p data-testid="text2">text2</p>

Actual behavior

event.relatedTarget is global

User-event version

14.5.1

Environment

Testing Library framework: @testing-library/[email protected]

JS framework: [email protected]

Test environment: [email protected]

DOM implementation: [email protected]

Additional context

No response

radqut avatar Dec 13 '23 16:12 radqut