Skip to content

Commit aa92b77

Browse files
fix: add deprecation notice for *ByA11yState and *ByA11yValue queries (#1269)
1 parent 9ec1270 commit aa92b77

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

website/docs/Queries.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ const element3 = screen.getByRole('button', { name: "Hello", disabled: true });
309309

310310
### `ByA11yState`, `ByAccessibilityState`
311311

312+
:::caution
313+
This query uses a predicate that is typically too general to give meaningful results. Therefore, it's better to use one of the following options:
314+
* use one of [`ByRole`](#byrole) queries with relevant state options: `disabled`, `selected`, `checked`, `expanded` and `busy`
315+
* use [`toHaveAccessibilityState()`](https://github.com/testing-library/jest-native#tohaveaccessibilitystate) matcher to check the state of element found using some other query
316+
:::
317+
312318
> getByA11yState, getAllByA11yState, queryByA11yState, queryAllByA11yState, findByA11yState, findAllByA11yState
313319
> getByAccessibilityState, getAllByAccessibilityState, queryByAccessibilityState, queryAllByAccessibilityState, findByAccessibilityState, findAllByAccessibilityState
314320
@@ -366,6 +372,13 @@ The difference in handling default values is made to reflect observed accessibil
366372

367373
### `ByA11Value`, `ByAccessibilityValue`
368374

375+
:::caution
376+
This query uses a predicate that is typically too general to give meaningful results. Therefore, it's better to use one of the following options:
377+
* use one of [`ByRole`](#byrole) queries with `value` option
378+
* use [`toHaveAccessibilityValue()`](https://github.com/testing-library/jest-native#tohaveaccessibilityvalue) matcher to check the state of element found using some other query
379+
:::
380+
381+
369382
> getByA11yValue, getAllByA11yValue, queryByA11yValue, queryAllByA11yValue, findByA11yValue, findAllByA11yValue
370383
> getByAccessibilityValue, getAllByAccessibilityValue, queryByAccessibilityValue, queryAllByAccessibilityValue, findByAccessibilityValue, findAllByAccessibilityValue
371384

0 commit comments

Comments
 (0)