Skip to content

Commit 5aa5e50

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/554
* origin/main: (24 commits) v8.0.0 chore(deps): bump dns-packet from 1.3.1 to 1.3.4 in /website (callstack#742) chore(deps-dev): bump @babel/preset-flow from 7.13.13 to 7.14.5 (callstack#765) chore(deps-dev): bump typescript from 4.4.2 to 4.4.4 (callstack#845) chore(deps-dev): bump release-it from 14.6.1 to 14.11.6 (callstack#830) chore(deps-dev): bump @babel/plugin-proposal-class-properties (callstack#846) chore(deps-dev): bump @babel/cli from 7.13.16 to 7.15.7 (callstack#833) chore(deps-dev): bump @testing-library/jest-native from 3.4.3 to 4.0.2 (callstack#842) chore(deps): bump color-string from 1.5.3 to 1.6.0 in /website (callstack#844) chore(deps): bump prismjs from 1.23.0 to 1.25.0 in /website (callstack#843) Forward extra data to press event (callstack#828) chore(deps-dev): bump @babel/preset-react from 7.13.13 to 7.14.5 (callstack#839) chore(deps): bump url-parse from 1.5.1 to 1.5.3 in /website (callstack#813) chore(deps-dev): bump @types/react from 17.0.2 to 17.0.30 (callstack#838) chore(deps): bump postcss from 7.0.29 to 7.0.36 in /website (callstack#756) chore(deps): bump prismjs from 1.23.0 to 1.25.0 in /website (callstack#823) chore(deps): bump path-parse from 1.0.6 to 1.0.7 in /website (callstack#796) chore(deps): bump merge-deep from 3.0.2 to 3.0.3 in /website (callstack#754) chore(deps): bump ws from 6.2.1 to 6.2.2 in /website (callstack#752) chore(deps): bump path-parse from 1.0.6 to 1.0.7 (callstack#795) ...
2 parents af62597 + 0ede617 commit 5aa5e50

File tree

18 files changed

+1649
-1483
lines changed

18 files changed

+1649
-1483
lines changed

.circleci/config.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
version: 2
22

33
aliases:
4-
- &filter-only-master
4+
- &filter-only-main
55
branches:
66
only:
7-
- master
8-
- &filter-ignore-master
7+
- main
8+
- &filter-ignore-main
99
branches:
1010
ignore:
11-
- master
11+
- main
1212

1313
defaults: &defaults
1414
docker:
@@ -102,12 +102,12 @@ workflows:
102102
requires:
103103
- install-dependencies
104104
# docusuarus build is running when deploying website as well
105-
filters: *filter-ignore-master
105+
filters: *filter-ignore-main
106106
- test-examples:
107107
requires:
108108
- install-dependencies
109-
filters: *filter-only-master
109+
filters: *filter-only-main
110110
- deploy-website:
111111
requires:
112112
- install-dependencies
113-
filters: *filter-only-master
113+
filters: *filter-only-main

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ The core team works directly on GitHub and all work is public.
1212

1313
> **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
1414
15-
1. Fork the repo and create your branch from `master` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
15+
1. Fork the repo and create your branch from `main` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
1616
2. Run `yarn` to setup the development environment.
1717
3. Do the changes you want and test them out in the example app before sending a pull request.
1818

@@ -49,7 +49,7 @@ When you're sending a pull request:
4949

5050
### Publishing a release
5151

52-
We use [release-it](https://github.com/webpro/release-it) to automate our release. If you have publish access to the NPM package, run the following from the master branch to publish a new release:
52+
We use [release-it](https://github.com/webpro/release-it) to automate our release. If you have publish access to the NPM package, run the following from the main branch to publish a new release:
5353

5454
```sh
5555
yarn release

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
height="80"
55
width="80"
66
alt="owl"
7-
src="https://raw.githubusercontent.com/callstack/react-native-testing-library/master/website/static/img/owl.png"
7+
src="https://raw.githubusercontent.com/callstack/react-native-testing-library/main/website/static/img/owl.png"
88
/>
99
<p>Simple and complete React Native testing utilities that encourage good testing practices.</P>
1010
</div>
@@ -46,7 +46,7 @@ npm install --save-dev @testing-library/react-native
4646

4747
This library has a peerDependencies listing for `react-test-renderer` and, of course, `react`. Make sure to install them too!
4848

49-
> In order to properly use helpers for async tests (`findBy` queries and `waitFor`) you need at least React >=16.9.0 (featuring async `act`) or React Native >=0.60 (which comes with React >=16.9.0).
49+
> In order to properly use helpers for async tests (`findBy` queries and `waitFor`) you need at least React >=16.9.0 (featuring async `act`) or React Native >=0.61 (which comes with React >=16.9.0).
5050
5151
### Additional Jest matchers
5252

@@ -126,7 +126,7 @@ test('form submits two answers', () => {
126126
});
127127
```
128128

129-
You can find the source of `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/master/src/__tests__/questionsBoard.test.js).
129+
You can find the source of `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/main/src/__tests__/questionsBoard.test.js).
130130

131131
## API / Usage
132132

flow-typed/npm/react-test-renderer_v16.x.x.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ type ReactComponentInstance = React$Component<any>;
99
type ReactTestRendererJSON = {
1010
type: string,
1111
props: { [propName: string]: any },
12-
children: null | ReactTestRendererJSON[]
12+
children: null | ReactTestRendererJSON[],
1313
};
1414

1515
type ReactTestRendererTree = ReactTestRendererJSON & {
16-
nodeType: "component" | "host",
16+
nodeType: 'component' | 'host',
1717
instance: ?ReactComponentInstance,
18-
rendered: null | ReactTestRendererTree
18+
rendered: null | ReactTestRendererTree,
1919
};
2020

2121
type ReactTestInstance = {
@@ -40,21 +40,21 @@ type ReactTestInstance = {
4040
findAllByProps(
4141
props: { [propName: string]: any },
4242
options?: { deep: boolean }
43-
): ReactTestInstance[]
43+
): ReactTestInstance[],
4444
};
4545

4646
type TestRendererOptions = {
47-
createNodeMock(element: React$Element<any>): any
47+
createNodeMock(element: React$Element<any>): any,
4848
};
4949

50-
declare module "react-test-renderer" {
50+
declare module 'react-test-renderer' {
5151
declare export type ReactTestRenderer = {
5252
toJSON(): null | ReactTestRendererJSON,
5353
toTree(): null | ReactTestRendererTree,
5454
unmount(nextElement?: React$Element<any>): void,
5555
update(nextElement: React$Element<any>): void,
5656
getInstance(): ?ReactComponentInstance,
57-
root: ReactTestInstance
57+
root: ReactTestInstance,
5858
};
5959

6060
declare type Thenable = {
@@ -69,7 +69,7 @@ declare module "react-test-renderer" {
6969
declare function act(callback: () => void): Thenable;
7070
}
7171

72-
declare module "react-test-renderer/shallow" {
72+
declare module 'react-test-renderer/shallow' {
7373
declare export default class ShallowRenderer {
7474
static createRenderer(): ShallowRenderer;
7575
getMountedInstance(): ReactTestInstance;

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@testing-library/react-native",
3-
"version": "8.0.0-rc.1",
3+
"version": "8.0.0",
44
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
55
"main": "build/index.js",
66
"typings": "./typings/index.d.ts",
@@ -34,26 +34,26 @@
3434
"@babel/preset-react": "^7.9.4",
3535
"@callstack/eslint-config": "^10.0.0",
3636
"@release-it/conventional-changelog": "^2.0.0",
37-
"@testing-library/jest-native": "~3.4.3",
37+
"@testing-library/jest-native": "~4.0.2",
3838
"@types/react": "^17.0.0",
39-
"@types/react-native": "^0.64.4",
39+
"@types/react-native": "^0.65.7",
4040
"@types/react-test-renderer": "^17.0.0",
41-
"babel-jest": "^26.0.1",
41+
"babel-jest": "^27.0.0",
4242
"conventional-changelog-cli": "^2.0.11",
4343
"dedent": "^0.7.0",
4444
"eslint": "^7.0.0",
4545
"flow-bin": "^0.141.0",
4646
"flow-copy-source": "^2.0.9",
47-
"jest": "^26.0.1",
48-
"react": "^17.0.1",
49-
"react-native": "^0.64.0-rc.1",
50-
"react-test-renderer": "^17.0.1",
47+
"jest": "^27.0.0",
48+
"react": "^17.0.2",
49+
"react-native": "^0.66.0",
50+
"react-test-renderer": "^17.0.2",
5151
"release-it": "^14.0.3",
5252
"strip-ansi": "^6.0.0",
5353
"typescript": "^4.0.2"
5454
},
5555
"dependencies": {
56-
"pretty-format": "^26.0.1"
56+
"pretty-format": "^27.0.0"
5757
},
5858
"peerDependencies": {
5959
"react": ">=16.0.0",
@@ -79,6 +79,7 @@
7979
"rootDir": "./src",
8080
"testPathIgnorePatterns": [
8181
"timerUtils"
82-
]
82+
],
83+
"testTimeout": 30000
8384
}
8485
}

src/__tests__/__snapshots__/render.test.js.snap

Lines changed: 6 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -11,38 +11,28 @@ exports[`debug 1`] = `
1111
not fresh
1212
</Text>
1313
<TextInput
14-
allowFontScaling={true}
1514
placeholder=\\"Add custom freshness\\"
16-
rejectResponderTermination={true}
1715
testID=\\"bananaCustomFreshness\\"
18-
underlineColorAndroid=\\"transparent\\"
1916
value=\\"Custom Freshie\\"
2017
/>
2118
<TextInput
22-
allowFontScaling={true}
2319
defaultValue=\\"What did you inspect?\\"
2420
placeholder=\\"Who inspected freshness?\\"
25-
rejectResponderTermination={true}
2621
testID=\\"bananaChef\\"
27-
underlineColorAndroid=\\"transparent\\"
2822
value=\\"I inspected freshie\\"
2923
/>
3024
<TextInput
31-
allowFontScaling={true}
3225
defaultValue=\\"What banana?\\"
33-
rejectResponderTermination={true}
34-
underlineColorAndroid=\\"transparent\\"
3526
/>
3627
<TextInput
37-
allowFontScaling={true}
3828
defaultValue=\\"hello\\"
39-
rejectResponderTermination={true}
40-
underlineColorAndroid=\\"transparent\\"
4129
value=\\"\\"
4230
/>
4331
<View
4432
accessible={true}
33+
collapsable={false}
4534
focusable={true}
35+
nativeID=\\"animatedComponent\\"
4636
onClick={[Function onClick]}
4737
onResponderGrant={[Function onResponderGrant]}
4838
onResponderMove={[Function onResponderMove]}
@@ -87,33 +77,21 @@ exports[`debug changing component: bananaFresh button message should now be "fre
8777
fresh
8878
</Text>
8979
<TextInput
90-
allowFontScaling={true}
9180
placeholder=\\"Add custom freshness\\"
92-
rejectResponderTermination={true}
9381
testID=\\"bananaCustomFreshness\\"
94-
underlineColorAndroid=\\"transparent\\"
9582
value=\\"Custom Freshie\\"
9683
/>
9784
<TextInput
98-
allowFontScaling={true}
9985
defaultValue=\\"What did you inspect?\\"
10086
placeholder=\\"Who inspected freshness?\\"
101-
rejectResponderTermination={true}
10287
testID=\\"bananaChef\\"
103-
underlineColorAndroid=\\"transparent\\"
10488
value=\\"I inspected freshie\\"
10589
/>
10690
<TextInput
107-
allowFontScaling={true}
10891
defaultValue=\\"What banana?\\"
109-
rejectResponderTermination={true}
110-
underlineColorAndroid=\\"transparent\\"
11192
/>
11293
<TextInput
113-
allowFontScaling={true}
11494
defaultValue=\\"hello\\"
115-
rejectResponderTermination={true}
116-
underlineColorAndroid=\\"transparent\\"
11795
value=\\"\\"
11896
/>
11997
<View
@@ -163,33 +141,21 @@ exports[`debug: shallow 1`] = `
163141
not fresh
164142
</Text>
165143
<TextInput
166-
allowFontScaling={true}
167144
placeholder=\\"Add custom freshness\\"
168-
rejectResponderTermination={true}
169145
testID=\\"bananaCustomFreshness\\"
170-
underlineColorAndroid=\\"transparent\\"
171146
value=\\"Custom Freshie\\"
172147
/>
173148
<TextInput
174-
allowFontScaling={true}
175149
defaultValue=\\"What did you inspect?\\"
176150
placeholder=\\"Who inspected freshness?\\"
177-
rejectResponderTermination={true}
178151
testID=\\"bananaChef\\"
179-
underlineColorAndroid=\\"transparent\\"
180152
value=\\"I inspected freshie\\"
181153
/>
182154
<TextInput
183-
allowFontScaling={true}
184155
defaultValue=\\"What banana?\\"
185-
rejectResponderTermination={true}
186-
underlineColorAndroid=\\"transparent\\"
187156
/>
188157
<TextInput
189-
allowFontScaling={true}
190158
defaultValue=\\"hello\\"
191-
rejectResponderTermination={true}
192-
underlineColorAndroid=\\"transparent\\"
193159
value=\\"\\"
194160
/>
195161
<MyButton
@@ -227,33 +193,21 @@ exports[`debug: shallow with message 1`] = `
227193
not fresh
228194
</Text>
229195
<TextInput
230-
allowFontScaling={true}
231196
placeholder=\\"Add custom freshness\\"
232-
rejectResponderTermination={true}
233197
testID=\\"bananaCustomFreshness\\"
234-
underlineColorAndroid=\\"transparent\\"
235198
value=\\"Custom Freshie\\"
236199
/>
237200
<TextInput
238-
allowFontScaling={true}
239201
defaultValue=\\"What did you inspect?\\"
240202
placeholder=\\"Who inspected freshness?\\"
241-
rejectResponderTermination={true}
242203
testID=\\"bananaChef\\"
243-
underlineColorAndroid=\\"transparent\\"
244204
value=\\"I inspected freshie\\"
245205
/>
246206
<TextInput
247-
allowFontScaling={true}
248207
defaultValue=\\"What banana?\\"
249-
rejectResponderTermination={true}
250-
underlineColorAndroid=\\"transparent\\"
251208
/>
252209
<TextInput
253-
allowFontScaling={true}
254210
defaultValue=\\"hello\\"
255-
rejectResponderTermination={true}
256-
underlineColorAndroid=\\"transparent\\"
257211
value=\\"\\"
258212
/>
259213
<MyButton
@@ -291,38 +245,28 @@ exports[`debug: with message 1`] = `
291245
not fresh
292246
</Text>
293247
<TextInput
294-
allowFontScaling={true}
295248
placeholder=\\"Add custom freshness\\"
296-
rejectResponderTermination={true}
297249
testID=\\"bananaCustomFreshness\\"
298-
underlineColorAndroid=\\"transparent\\"
299250
value=\\"Custom Freshie\\"
300251
/>
301252
<TextInput
302-
allowFontScaling={true}
303253
defaultValue=\\"What did you inspect?\\"
304254
placeholder=\\"Who inspected freshness?\\"
305-
rejectResponderTermination={true}
306255
testID=\\"bananaChef\\"
307-
underlineColorAndroid=\\"transparent\\"
308256
value=\\"I inspected freshie\\"
309257
/>
310258
<TextInput
311-
allowFontScaling={true}
312259
defaultValue=\\"What banana?\\"
313-
rejectResponderTermination={true}
314-
underlineColorAndroid=\\"transparent\\"
315260
/>
316261
<TextInput
317-
allowFontScaling={true}
318262
defaultValue=\\"hello\\"
319-
rejectResponderTermination={true}
320-
underlineColorAndroid=\\"transparent\\"
321263
value=\\"\\"
322264
/>
323265
<View
324266
accessible={true}
267+
collapsable={false}
325268
focusable={true}
269+
nativeID=\\"animatedComponent\\"
326270
onClick={[Function onClick]}
327271
onResponderGrant={[Function onResponderGrant]}
328272
onResponderMove={[Function onResponderMove]}
@@ -359,7 +303,9 @@ exports[`debug: with message 1`] = `
359303
exports[`toJSON 1`] = `
360304
<View
361305
accessible={true}
306+
collapsable={false}
362307
focusable={false}
308+
nativeID="animatedComponent"
363309
onClick={[Function]}
364310
onResponderGrant={[Function]}
365311
onResponderMove={[Function]}

src/__tests__/fireEvent.test.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,19 @@ describe('fireEvent', () => {
9191
test('fireEvent.press', () => {
9292
const onPressMock = jest.fn();
9393
const text = 'Fireevent press';
94+
const eventData = {
95+
nativeEvent: {
96+
pageX: 20,
97+
pageY: 30,
98+
},
99+
};
94100
const { getByText } = render(
95101
<OnPressComponent onPress={onPressMock} text={text} />
96102
);
97103

98-
fireEvent.press(getByText(text));
104+
fireEvent.press(getByText(text), eventData);
99105

100-
expect(onPressMock).toHaveBeenCalled();
106+
expect(onPressMock).toHaveBeenCalledWith(eventData);
101107
});
102108

103109
test('fireEvent.scroll', () => {

0 commit comments

Comments
 (0)