@testing-library/react-native 8.0.0-rc.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/build/fireEvent.js +1 -1
- package/build/fireEvent.js.flow +2 -2
- package/build/helpers/timers.js +1 -1
- package/build/helpers/timers.js.flow +1 -1
- package/package.json +11 -10
- package/typings/index.d.ts +2 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
height="80"
|
|
5
5
|
width="80"
|
|
6
6
|
alt="owl"
|
|
7
|
-
src="https://raw.githubusercontent.com/callstack/react-native-testing-library/
|
|
7
|
+
src="https://raw.githubusercontent.com/callstack/react-native-testing-library/main/website/static/img/owl.png"
|
|
8
8
|
/>
|
|
9
9
|
<p>Simple and complete React Native testing utilities that encourage good testing practices.</P>
|
|
10
10
|
</div>
|
|
@@ -46,7 +46,7 @@ npm install --save-dev @testing-library/react-native
|
|
|
46
46
|
|
|
47
47
|
This library has a peerDependencies listing for `react-test-renderer` and, of course, `react`. Make sure to install them too!
|
|
48
48
|
|
|
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.
|
|
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).
|
|
50
50
|
|
|
51
51
|
### Additional Jest matchers
|
|
52
52
|
|
|
@@ -126,7 +126,7 @@ test('form submits two answers', () => {
|
|
|
126
126
|
});
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
-
You can find the source of `QuestionsBoard` component and this example [here](https://github.com/callstack/react-native-testing-library/blob/
|
|
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).
|
|
130
130
|
|
|
131
131
|
## API / Usage
|
|
132
132
|
|
|
@@ -153,6 +153,8 @@ The [public API](https://callstack.github.io/react-native-testing-library/docs/a
|
|
|
153
153
|
|
|
154
154
|
React Native Testing Library is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Callstack](https://callstack.com) is a group of React and React Native geeks, contact us at [hello@callstack.com](mailto:hello@callstack.com) if you need any help with these or just want to say hi!
|
|
155
155
|
|
|
156
|
+
Like the project? ⚛️ [Join the team](https://callstack.com/careers/?utm_campaign=Senior_RN&utm_source=github&utm_medium=readme) who does amazing stuff for clients and drives React Native Open Source! 🔥
|
|
157
|
+
|
|
156
158
|
---
|
|
157
159
|
|
|
158
160
|
Supported and used by [Rally Health](https://www.rallyhealth.com/careers-home).
|
package/build/fireEvent.js
CHANGED
|
@@ -90,7 +90,7 @@ const invokeEvent = (element, eventName, callsite, ...data) => {
|
|
|
90
90
|
|
|
91
91
|
const toEventHandlerName = eventName => `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
92
92
|
|
|
93
|
-
const pressHandler = element => invokeEvent(element, 'press', pressHandler);
|
|
93
|
+
const pressHandler = (element, ...data) => invokeEvent(element, 'press', pressHandler, ...data);
|
|
94
94
|
|
|
95
95
|
const changeTextHandler = (element, ...data) => invokeEvent(element, 'changeText', changeTextHandler, ...data);
|
|
96
96
|
|
package/build/fireEvent.js.flow
CHANGED
|
@@ -105,8 +105,8 @@ const invokeEvent = (
|
|
|
105
105
|
const toEventHandlerName = (eventName: string) =>
|
|
106
106
|
`on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`;
|
|
107
107
|
|
|
108
|
-
const pressHandler = (element: ReactTestInstance): void =>
|
|
109
|
-
invokeEvent(element, 'press', pressHandler);
|
|
108
|
+
const pressHandler = (element: ReactTestInstance, ...data: Array<any>): void =>
|
|
109
|
+
invokeEvent(element, 'press', pressHandler, ...data);
|
|
110
110
|
const changeTextHandler = (
|
|
111
111
|
element: ReactTestInstance,
|
|
112
112
|
...data: Array<any>
|
package/build/helpers/timers.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.runWithRealTimers = runWithRealTimers;
|
|
7
7
|
exports.setTimeout = exports.setImmediate = exports.clearTimeout = exports.jestFakeTimersAreEnabled = void 0;
|
|
8
|
-
// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/
|
|
8
|
+
// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/main/src/helpers.js
|
|
9
9
|
|
|
10
10
|
/* globals jest */
|
|
11
11
|
const globalObj = typeof window === 'undefined' ? global : window; // Currently this fn only supports jest timers, but it could support other test runners in the future.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/
|
|
1
|
+
// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/main/src/helpers.js
|
|
2
2
|
// @flow
|
|
3
3
|
/* globals jest */
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/react-native",
|
|
3
|
-
"version": "8.0.0
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"typings": "./typings/index.d.ts",
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
"@babel/preset-react": "^7.9.4",
|
|
35
35
|
"@callstack/eslint-config": "^10.0.0",
|
|
36
36
|
"@release-it/conventional-changelog": "^2.0.0",
|
|
37
|
-
"@testing-library/jest-native": "~
|
|
37
|
+
"@testing-library/jest-native": "~4.0.2",
|
|
38
38
|
"@types/react": "^17.0.0",
|
|
39
|
-
"@types/react-native": "^0.
|
|
39
|
+
"@types/react-native": "^0.65.7",
|
|
40
40
|
"@types/react-test-renderer": "^17.0.0",
|
|
41
|
-
"babel-jest": "^
|
|
41
|
+
"babel-jest": "^27.0.0",
|
|
42
42
|
"conventional-changelog-cli": "^2.0.11",
|
|
43
43
|
"dedent": "^0.7.0",
|
|
44
44
|
"eslint": "^7.0.0",
|
|
45
45
|
"flow-bin": "^0.141.0",
|
|
46
46
|
"flow-copy-source": "^2.0.9",
|
|
47
|
-
"jest": "^
|
|
48
|
-
"react": "^17.0.
|
|
49
|
-
"react-native": "^0.
|
|
50
|
-
"react-test-renderer": "^17.0.
|
|
47
|
+
"jest": "^27.0.0",
|
|
48
|
+
"react": "^17.0.2",
|
|
49
|
+
"react-native": "^0.66.0",
|
|
50
|
+
"react-test-renderer": "^17.0.2",
|
|
51
51
|
"release-it": "^14.0.3",
|
|
52
52
|
"strip-ansi": "^6.0.0",
|
|
53
53
|
"typescript": "^4.0.2"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"pretty-format": "^
|
|
56
|
+
"pretty-format": "^27.0.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"react": ">=16.0.0",
|
|
@@ -79,6 +79,7 @@
|
|
|
79
79
|
"rootDir": "./src",
|
|
80
80
|
"testPathIgnorePatterns": [
|
|
81
81
|
"timerUtils"
|
|
82
|
-
]
|
|
82
|
+
],
|
|
83
|
+
"testTimeout": 30000
|
|
83
84
|
}
|
|
84
85
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -309,7 +309,7 @@ export interface RenderAPI extends Queries {
|
|
|
309
309
|
update(nextElement: React.ReactElement<any>): void;
|
|
310
310
|
rerender(nextElement: React.ReactElement<any>): void;
|
|
311
311
|
unmount(nextElement?: React.ReactElement<any>): void;
|
|
312
|
-
toJSON(): ReactTestRendererJSON | null;
|
|
312
|
+
toJSON(): ReactTestRendererJSON[] | ReactTestRendererJSON | null;
|
|
313
313
|
debug: Debug;
|
|
314
314
|
container: ReactTestInstance;
|
|
315
315
|
}
|
|
@@ -321,7 +321,7 @@ export type FireEventFunction = (
|
|
|
321
321
|
) => any;
|
|
322
322
|
|
|
323
323
|
export type FireEventAPI = FireEventFunction & {
|
|
324
|
-
press: (element: ReactTestInstance) => any;
|
|
324
|
+
press: (element: ReactTestInstance, ...data: Array<any>) => any;
|
|
325
325
|
changeText: (element: ReactTestInstance, ...data: Array<any>) => any;
|
|
326
326
|
scroll: (element: ReactTestInstance, ...data: Array<any>) => any;
|
|
327
327
|
};
|