Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import type {RNTesterModuleExample} from '../../types/RNTesterTypes';

const React = require('react');
import {Pressable, StyleSheet, View} from 'react-native';
import {StyleSheet, View} from 'react-native';
import RNTesterText from '../../components/RNTesterText';

function PointerClickEventsExample(): React.Node {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ describe('Pointer onClick Test', () => {
);

const text = await stateText.getText();
expect(text).toMatchSnapshot();
const nativeEvent = JSON.parse(text.split('onClick.nativeEvent: ')[1]);
expect(typeof nativeEvent.target).toBe('number');
nativeEvent.target = '<target>';
expect(nativeEvent).toMatchSnapshot();
});
test('onAuxClick reports correct native event properties on middle click', async () => {
const component = await app.findElementByTestID('pointer-click-target');
Expand All @@ -70,7 +73,10 @@ describe('Pointer onClick Test', () => {
);

const text = await stateText.getText();
expect(text).toMatchSnapshot();
const nativeEvent = JSON.parse(text.split('onAuxClick.nativeEvent: ')[1]);
expect(typeof nativeEvent.target).toBe('number');
nativeEvent.target = '<target>';
expect(nativeEvent).toMatchSnapshot();
});
test('onAuxClick reports correct native event properties on right click', async () => {
const component = await app.findElementByTestID('pointer-click-target');
Expand All @@ -96,6 +102,9 @@ describe('Pointer onClick Test', () => {
);

const text = await stateText.getText();
expect(text).toMatchSnapshot();
const nativeEvent = JSON.parse(text.split('onAuxClick.nativeEvent: ')[1]);
expect(typeof nativeEvent.target).toBe('number');
nativeEvent.target = '<target>';
expect(nativeEvent).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
@@ -1,100 +1,100 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Pointer onClick Test onAuxClick reports correct native event properties on middle click 1`] = `
"onAuxClick.nativeEvent: {
"pointerId": 1,
"pressure": 0,
"pointerType": "mouse",
{
"altKey": false,
"button": 1,
"buttons": 0,
"clientX": 110,
"clientY": 165,
"x": 110,
"y": 165,
"ctrlKey": false,
"detail": 0,
"height": 0,
"isPrimary": true,
"metaKey": false,
"offsetX": 100,
"offsetY": 99,
"pageX": 110,
"pageY": 165,
"pointerId": 1,
"pointerType": "mouse",
"pressure": 0,
"screenX": 100,
"screenY": 99,
"offsetX": 100,
"offsetY": 99,
"width": 0,
"height": 0,
"shiftKey": false,
"tangentialPressure": 0,
"target": "<target>",
"tiltX": 0,
"tiltY": 0,
"detail": 0,
"buttons": 0,
"tangentialPressure": 0,
"twist": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"isPrimary": true,
"button": 1,
"target": 1272
}"
"width": 0,
"x": 110,
"y": 165,
}
`;

exports[`Pointer onClick Test onAuxClick reports correct native event properties on right click 1`] = `
"onAuxClick.nativeEvent: {
"pointerId": 1,
"pressure": 0,
"pointerType": "mouse",
{
"altKey": false,
"button": 2,
"buttons": 0,
"clientX": 110,
"clientY": 165,
"x": 110,
"y": 165,
"ctrlKey": false,
"detail": 0,
"height": 0,
"isPrimary": true,
"metaKey": false,
"offsetX": 100,
"offsetY": 99,
"pageX": 110,
"pageY": 165,
"pointerId": 1,
"pointerType": "mouse",
"pressure": 0,
"screenX": 100,
"screenY": 99,
"offsetX": 100,
"offsetY": 99,
"width": 0,
"height": 0,
"shiftKey": false,
"tangentialPressure": 0,
"target": "<target>",
"tiltX": 0,
"tiltY": 0,
"detail": 0,
"buttons": 0,
"tangentialPressure": 0,
"twist": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"isPrimary": true,
"button": 2,
"target": 1272
}"
"width": 0,
"x": 110,
"y": 165,
}
`;

exports[`Pointer onClick Test onClick reports correct native event properties on left click 1`] = `
"onClick.nativeEvent: {
"pointerId": 1,
"pressure": 0,
"pointerType": "mouse",
{
"altKey": false,
"button": 0,
"buttons": 0,
"clientX": 110,
"clientY": 165,
"x": 110,
"y": 165,
"ctrlKey": false,
"detail": 0,
"height": 0,
"isPrimary": true,
"metaKey": false,
"offsetX": 100,
"offsetY": 99,
"pageX": 110,
"pageY": 165,
"pointerId": 1,
"pointerType": "mouse",
"pressure": 0,
"screenX": 100,
"screenY": 99,
"offsetX": 100,
"offsetY": 99,
"width": 0,
"height": 0,
"shiftKey": false,
"tangentialPressure": 0,
"target": "<target>",
"tiltX": 0,
"tiltY": 0,
"detail": 0,
"buttons": 0,
"tangentialPressure": 0,
"twist": 0,
"ctrlKey": false,
"shiftKey": false,
"altKey": false,
"metaKey": false,
"isPrimary": true,
"button": 0,
"target": 1272
}"
"width": 0,
"x": 110,
"y": 165,
}
`;
Loading