Commit 686e015
Mocks: fix button content missing (#4048)
## Description
<!--
Description and motivation for this PR.
Include 'Fixes #<number>' if this is fixing some issue.
-->
Lacking button content in the provided mocks makes it impossible to
write tests such as "is the button with 'foo' rendered" or "press the
button with 'bar'".
## Test plan
<!--
Describe how did you test this change here.
-->
```tsx
import {fireEvent, render} from '@testing-library/react-native';
import {Text} from 'react-native';
import {RectButton} from 'react-native-gesture-handler';
test('Trigger press by text', () => {
const onPress = jest.fn();
const {getByText} = render(
<RectButton onPress={onPress}>
<Text>Press Me</Text>
</RectButton>,
);
fireEvent.press(getByText('Press Me'));
expect(onPress).toHaveBeenCalled();
});
```
---------
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: Jakub Piasecki <jakub.piasecki@swmansion.com>
Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>1 parent 25b88db commit 686e015
3 files changed
Lines changed: 8 additions & 4 deletions
File tree
- packages/react-native-gesture-handler
- apple
- src/mocks
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| 247 | + | |
| 248 | + | |
247 | 249 | | |
248 | 250 | | |
249 | 251 | | |
250 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
251 | 255 | | |
252 | 256 | | |
253 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| |||
0 commit comments