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 26, 2024
1 parent 94b7793 commit da09805
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ function PointerEventClickTouchTestCase(props: PlatformTestComponentBaseProps) {
checkClickEventProperties(assert_equals, e);
});

check_PointerEvent(harness, e, 'click', {});
// We cannot check mouse pointer events here, as this will assert that
// isPrimary is set to true, when it should be false for click events.
if (e.nativeEvent.pointerType !== 'mouse') {
check_PointerEvent(harness, e, 'click', {});
}
testPointerClick.done();
},
[harness, testPointerClick],
Expand Down

0 comments on commit da09805

Please sign in to comment.