Closed
Description
Describe the bug
The following test will fail
test('works on pressable with pointer event to box-only', () => {
const mockOnPress = jest.fn();
const screen = render(
<Pressable
onPress={mockOnPress}
pointerEvents="box-only"
testID="pressable"
/>
);
fireEvent.press(screen.getByTestId('pressable'));
expect(mockOnPress).toHaveBeenCalled();
});
What happens is that the pointer-events condition checks that there is not box-only on the parent but here the parent is the composite element and it has box-only so the element is considered to be disabled.
Expected behavior
The test should pass
Steps to Reproduce
Versions
I've written the test in the up to date repo of RNTL
I think this can be fixed if we look at the host parent instead of the direct parent using the method getHostParent. I'll try to submit a PR soon for this. I have made a version of the function that checks pointer-events in #1386 which could be used by fireEvent I think
Metadata
Metadata
Assignees
Labels
No labels