message: feat(ariakit-test-utils): Support `relatedTarget` on `hover`
diff: @@ -13,6 +13,7 @@ export async function hover(element: Element, options?: MouseEventInit) {
  const document = element.ownerDocument as DocumentWithLastHovered;
  const { lastHovered } = document;
  const { disabled } = element as HTMLButtonElement;
  + const pointerEventsEnabled = isPointerEventsEnabled(element);
  if (lastHovered && isPointerEventsEnabled(lastHovered)) {
  fireEvent.pointerMove(lastHovered, options);
  @@ -20,28 +21,35 @@ export async function hover(element: Element, options?: MouseEventInit) {
  const isElementWithinLastHovered = lastHovered.contains(element);
  - fireEvent.pointerOut(lastHovered, options);
  + const relatedTarget = pointerEventsEnabled ? element : null;
  + const leaveOptions = { ...options, relatedTarget };
  +
  + fireEvent.pointerOut(lastHovered, leaveOptions);
  if (!isElementWithinLastHovered) {
  - fireEvent.pointerLeave(lastHovered, options);
  + fireEvent.pointerLeave(lastHovered, leaveOptions);
  }
  - fireEvent.mouseOut(lastHovered, options);
  + fireEvent.mouseOut(lastHovered, leaveOptions);
  if (!isElementWithinLastHovered) {
  - fireEvent.mouseLeave(lastHovered, options);
  + fireEvent.mouseLeave(lastHovered, leaveOptions);
  }
  }
  await sleep();
  - if (!isPointerEventsEnabled(element)) return;
  + if (!pointerEventsEnabled) return;
  +
  + const enterOptions = lastHovered
  + ? { relatedTarget: lastHovered, ...options }
  + : options;
  - fireEvent.pointerOver(element, options);
  - fireEvent.pointerEnter(element, options);
  + fireEvent.pointerOver(element, enterOptions);
  + fireEvent.pointerEnter(element, enterOptions);
  if (!disabled) {
  - fireEvent.mouseOver(element, options);
  - fireEvent.mouseEnter(element, options);
  + fireEvent.mouseOver(element, enterOptions);
  + fireEvent.mouseEnter(element, enterOptions);
  }
  fireEvent.pointerMove(element, options);
  