mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
chore: tweak v13 docs (#1694)
* chore: move to v13-alpha * chore: tweaks
This commit is contained in:
committed by
GitHub
parent
94f5b390d0
commit
0632000f1e
-6
@@ -1,11 +1,5 @@
|
||||
# User Event interactions
|
||||
|
||||
:::info RNTL minimal version
|
||||
|
||||
User Event interactions require RNTL v12.2.0 or later.
|
||||
|
||||
:::
|
||||
|
||||
## Comparison with Fire Event API
|
||||
|
||||
Fire Event is our original event simulation API. It can invoke **any event handler** declared on **either host or composite elements**. Suppose the element does not have `onEventName` event handler for the passed `eventName` event, or the element is disabled. In that case, Fire Event will traverse up the component tree, looking for an event handler on both host and composite elements along the way. By default, it will **not pass any event data**, but the user might provide it in the last argument.
|
||||
-6
@@ -1,11 +1,5 @@
|
||||
# Jest matchers
|
||||
|
||||
:::info RNTL minimal version
|
||||
|
||||
Built-in Jest matchers require RNTL v12.4.0 or later.
|
||||
|
||||
:::
|
||||
|
||||
This guide describes built-in Jest matchers, we recommend using these matchers as they provide readable tests, accessibility support, and a better developer experience.
|
||||
|
||||
## Setup
|
||||
+2
-1
@@ -29,7 +29,8 @@ Default [debug options](#debug) to be used when calling `debug()`. These default
|
||||
|
||||
### `concurrentRoot` option
|
||||
|
||||
Set to `true` to enable concurrent rendering used in the React Native New Architecture. Otherwise `render` will default to legacy synchronous rendering.
|
||||
Set to `false` to disable concurrent rendering.
|
||||
Otherwise, `render` will default to using concurrent rendering used in the React Native New Architecture.
|
||||
|
||||
## `resetToDefaults()`
|
||||
|
||||
@@ -34,7 +34,8 @@ This option allows you to wrap the tested component, passed as the first option
|
||||
|
||||
#### `concurrentRoot` option
|
||||
|
||||
Set to `true` to enable concurrent rendering used in the React Native New Architecture. Otherwise `render` will default to legacy synchronous rendering.
|
||||
Set to `false` to disable concurrent rendering.
|
||||
Otherwise, `render` will default to using concurrent rendering used in the React Native New Architecture.
|
||||
|
||||
#### `createNodeMock` option
|
||||
|
||||
+1
-6
@@ -8,11 +8,7 @@ All of the built-in Jest matchers provided by the React Native Testing Library s
|
||||
|
||||
## Usage
|
||||
|
||||
You can use the built-in matchers by adding the following line to your `jest-setup.ts` file (configured using [`setupFilesAfterEnv`](https://jestjs.io/docs/configuration#setupfilesafterenv-array)):
|
||||
|
||||
```ts title=jest-setup.ts
|
||||
import '@testing-library/react-native/extend-expect';
|
||||
```
|
||||
You don't need to do anything to use the built-in matchers. They are automatically available when you import anything from `@testing-library/react-native`.
|
||||
|
||||
### Gradual migration
|
||||
|
||||
@@ -23,7 +19,6 @@ You can use the built-in matchers alongside legacy Jest Native matchers by chang
|
||||
// import '@testing-library/jest-native/extend-expect';
|
||||
|
||||
// With this:
|
||||
import '@testing-library/react-native/extend-expect';
|
||||
import '@testing-library/jest-native/legacy-extend-expect';
|
||||
```
|
||||
|
||||
@@ -19,7 +19,7 @@ export default defineConfig({
|
||||
},
|
||||
multiVersion: {
|
||||
default: '12.x',
|
||||
versions: ['12.x', '13.x'],
|
||||
versions: ['12.x', '13.x-alpha'],
|
||||
},
|
||||
route: {
|
||||
cleanUrls: true,
|
||||
|
||||
Reference in New Issue
Block a user