Skip to content

Commit 19e1cdc

Browse files
committed
docs: update migration v12 docs
1 parent ba34b99 commit 19e1cdc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

website/docs/MigrationV12.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ React Native Testing Library 12 introduces a handful of breaking changes compare
77

88
# Breaking changes
99

10-
## 1. `*ByRole` queries now return only accessibility elements
10+
## 1. All queries exclude elements hidden from accessibility by default
11+
Elements that are hidden from accessiblity, e.g. elements on non-active screen when using React Navigation, now will not be matched by default by all queries. This the effect of switch default value for global config option `defaultIncludeHiddenElements`(api#defaultincludehiddenelements-option) to `false`.
12+
13+
Previous behaviour of matching hidden elements can be enabled on query level using [includeHiddenElements](api-queries#includehiddenelements-option) query options or globally using `defaultIncludeHiddenElements`(api#defaultincludehiddenelements-option) configuration option.
14+
15+
## 2. `*ByRole` queries now return only accessibility elements
1116
`*ByRole` queries now return only accessibility elements, either explicitly marked with `accessible` prop or implicit ones where this status is derrived from component type itself (e.g `Text`, `TextInput`, `Switch`, but not `View`).
1217

1318
You may need to adjust relevant components under test to make sure they pass `isAccessibilityElement` check.
@@ -38,14 +43,14 @@ While following elements will not match:
3843
<Text accessible={false} role="button">Button</Text>
3944
```
4045

41-
## 2. `*ByText`, `*ByDisplayValue`, `*ByPlaceholderText` queries now return host elements
46+
## 3. `*ByText`, `*ByDisplayValue`, `*ByPlaceholderText` queries now return host elements
4247
`*ByText`, `*ByDisplayValue`, `*ByPlaceholderText` queries now return [host elements](testing-env#host-and-composite-components), which is consistent with other queries.
4348

4449
While potentially breaking, this should not cause issues in tests if you are using recommended queries and Jest Matchers from Jest Native package.
4550

4651
Problematic cases may include: directly checking some prop values (without using Jest Native matchers), referencing other nodes using `parent` or `children` props, examining `type` property of `ReactTestInstance`, etc.
4752

48-
## 3. `container` API has been renamed to `UNSAFE_root`.
53+
## 4. `container` API has been renamed to `UNSAFE_root`.
4954

5055
Historically `container` was supposed to mimic the [RTL's container](https://testing-library.com/docs/react-testing-library/api/#container). However it turned out not so relevant in RNTL's environment, where we actually used it to return React Test Renderer's root instance.
5156

0 commit comments

Comments
 (0)