Skip to content

Commit

Permalink
Fix conflicting assertions for click events (facebook#46633)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#46633

There is an assertion in the "basic click test" that [checks](https://github.com/facebook/react-native/blob/d6e0bc7/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventClickTouch.js#L36-L40) that `isPrimary` is set to false. The same assertion suite also does a mouse event [validation](https://github.com/facebook/react-native/blob/d6e0bc7/packages/rn-tester/js/examples/Experimental/W3CPointerEventPlatformTests/PointerEventSupport.js#L201-L204) that `isPrimary` is set to true.

This fixes the conflicting assertions, favoring the behavior observed on Web, that `isPrimary` for mouse click events should be set to false.

## Changelog

[General][Fixed] Fixed issues with W3C PointerEvents tests

Differential Revision: D63336622
  • Loading branch information
rozele authored and facebook-github-bot committed Sep 25, 2024
1 parent eb7c439 commit b3842c0
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ export function check_PointerEvent(
assert_equals(nativeEvent.height, 1, 'height of mouse should be 1');
assert_equals(nativeEvent.tiltX, 0, eventType + '.tiltX is 0 for mouse');
assert_equals(nativeEvent.tiltY, 0, eventType + '.tiltY is 0 for mouse');
assert_true(
assert_equals(
nativeEvent.isPrimary,
// isPrimary is set to false for 'click' events
eventType !== 'click',
eventType + '.isPrimary is true for mouse',
);
}, pointerTestName + ' properties for pointerType = mouse');
Expand Down

0 comments on commit b3842c0

Please sign in to comment.