mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
fix: use actual react-native instead of homegrown mocks (#36)
<!-- Please provide enough information so that others can review your pull request. --> <!-- Keep pull requests small and focused on a single change. --> ### Summary This actually uncovered some bugs, like lack of `onDoublePress` (lol XD) and enabled us to have better snapshots for deep rendering. ### Test plan no new tests
This commit is contained in:
committed by
GitHub
parent
07d3be1c51
commit
03e2c4b0f2
@@ -193,25 +193,6 @@ const { getByTestId } = render(
|
||||
fireEvent.press(getByTestId('button'));
|
||||
```
|
||||
|
||||
### `fireEvent.doublePress: (element: ReactTestInstance) => void`
|
||||
|
||||
Invokes `doublePress` event handler on the element or parent element in the tree.
|
||||
|
||||
```jsx
|
||||
import { TouchableOpacity, Text } from 'react-native';
|
||||
import { render, fireEvent } from 'react-native-testing-library';
|
||||
|
||||
const onDoublePressMock = jest.fn();
|
||||
|
||||
const { getByTestId } = render(
|
||||
<TouchableOpacity onDoublePress={onDoublePressMock}>
|
||||
<Text testID="button-text">Click me</Text>
|
||||
</TouchableOpacity>
|
||||
);
|
||||
|
||||
fireEvent.doublePress(getByTestId('button-text'));
|
||||
```
|
||||
|
||||
### `fireEvent.changeText: (element: ReactTestInstance, data?: *) => void`
|
||||
|
||||
Invokes `changeText` event handler on the element or parent element in the tree.
|
||||
|
||||
Reference in New Issue
Block a user