Skip to content

Commit 4fae1c7

Browse files
committed
docs: add deprecation message
1 parent 66f4a7c commit 4fae1c7

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

website/docs/API.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ Use cases for scoped queries include:
613613

614614
## `query` APIs
615615

616-
Each of the get APIs listed in the render section above have a complimentary query API. The get APIs will throw errors if a proper node cannot be found. This is normally the desired effect. However, if you want to make an assertion that an element is not present in the hierarchy, then you can use the query API instead:
616+
Each of the `getBy` APIs listed in the render section above have a complimentary `queryBy` API. The `getBy` APIs will throw errors if a proper node cannot be found. This is normally the desired effect. However, if you want to make an assertion that an element is not present in the hierarchy, then you can use the `queryBy` API instead:
617617

618618
```jsx
619619
import { render, screen } from '@testing-library/react-native';
@@ -625,7 +625,7 @@ expect(submitButton).toBeNull(); // it doesn't exist
625625

626626
## `queryAll` APIs
627627

628-
Each of the query APIs have a corresponding queryAll version that always returns an Array of matching nodes. getAll is the same but throws when the array has a length of 0.
628+
Each of the query APIs have a corresponding `queryAll` version that always returns an array of matching nodes. `getAll` is the same but throws when the array has a length of 0.
629629

630630
```jsx
631631
import { render } from '@testing-library/react-native';

website/docs/Queries.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ title: Queries
2222
- [`ByHintText`, `ByA11yHint`, `ByAccessibilityHint`](#byhinttext-bya11yhint-byaccessibilityhint)
2323
- [`ByRole`](#byrole)
2424
- [Options](#options-1)
25-
- [`ByA11yState`, `ByAccessibilityState`](#bya11ystate-byaccessibilitystate)
25+
- [`ByA11yState`, `ByAccessibilityState` (deprecated)](#bya11ystate-byaccessibilitystate-deprecated)
2626
- [Default state for: `disabled`, `selected`, and `busy` keys](#default-state-for-disabled-selected-and-busy-keys)
2727
- [Default state for: `checked` and `expanded` keys](#default-state-for-checked-and-expanded-keys)
28-
- [`ByA11Value`, `ByAccessibilityValue`](#bya11value-byaccessibilityvalue)
28+
- [`ByA11Value`, `ByAccessibilityValue` (deprecated)](#bya11value-byaccessibilityvalue-deprecated)
2929
- [Common options](#common-options)
3030
- [`includeHiddenElements` option](#includehiddenelements-option)
3131
- [TextMatch](#textmatch)
@@ -303,7 +303,11 @@ const element3 = screen.getByRole('button', { name: "Hello", disabled: true });
303303

304304
`value`: Filter elements by their accessibility, available value entries include numeric `min`, `max` & `now`, as well as string or regex `text` key. See React Native [accessibilityValue](https://reactnative.dev/docs/accessibility#accessibilityvalue) docs to learn more about this prop.
305305

306-
### `ByA11yState`, `ByAccessibilityState`
306+
### `ByA11yState`, `ByAccessibilityState` (deprecated)
307+
308+
:::caution
309+
This method has been marked deprecated, as similar functionallity can be better achieved using [`*ByRole`](#byrole) query with state options (`disabled`, `selected`, etc) or by using [`toHaveAccessibilityState()`](https://github.com/testing-library/jest-native#tohaveaccessibilitystate) Jest matcher.
310+
:::
307311

308312
> getByA11yState, getAllByA11yState, queryByA11yState, queryAllByA11yState, findByA11yState, findAllByA11yState
309313
> getByAccessibilityState, getAllByAccessibilityState, queryByAccessibilityState, queryAllByAccessibilityState, findByAccessibilityState, findAllByAccessibilityState
@@ -360,7 +364,11 @@ but will not match elements with following props:
360364
The difference in handling default values is made to reflect observed accessibility behaviour on iOS and Android platforms.
361365
:::
362366

363-
### `ByA11Value`, `ByAccessibilityValue`
367+
### `ByA11Value`, `ByAccessibilityValue` (deprecated)
368+
369+
:::caution
370+
This method has been marked deprecated, as similar functionallity can be better achieved using [`*ByRole`](#byrole) query with `value` option or by using [`toHaveAccessibilityValue()`](https://github.com/testing-library/jest-native#tohaveaccessibilityvalue) Jest matcher.
371+
:::
364372

365373
> getByA11yValue, getAllByA11yValue, queryByA11yValue, queryAllByA11yValue, findByA11yValue, findAllByA11yValue
366374
> getByAccessibilityValue, getAllByAccessibilityValue, queryByAccessibilityValue, queryAllByAccessibilityValue, findByAccessibilityValue, findAllByAccessibilityValue

0 commit comments

Comments
 (0)