Skip to content

Commit e018da5

Browse files
suezzothymikee
authored andcommitted
test: add pointerEvents test
1 parent 34fc03a commit e018da5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/__tests__/fireEvent.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,21 @@ test('should not fire on non-editable TextInput with nested Text', () => {
234234
expect(onChangeTextMock).not.toHaveBeenCalled();
235235
});
236236

237+
test.only('should not fire on non-targetable View', () => {
238+
const handlePress = jest.fn();
239+
240+
const screen = render(
241+
<View pointerEvents="none">
242+
<Pressable onPress={handlePress}>
243+
<Text>Trigger</Text>
244+
</Pressable>
245+
</View>
246+
);
247+
248+
fireEvent.press(screen.getByText('Trigger'));
249+
expect(handlePress).not.toHaveBeenCalled();
250+
});
251+
237252
test('should pass event up on disabled TouchableOpacity', () => {
238253
const handleInnerPress = jest.fn();
239254
const handleOuterPress = jest.fn();

0 commit comments

Comments
 (0)