Skip to content

Commit

Permalink
docs: add deprecation message
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjastrzebski committed Nov 16, 2022
1 parent 66f4a7c commit 4fae1c7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions website/docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ Use cases for scoped queries include:

## `query` APIs

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:
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:

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

## `queryAll` APIs

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.
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.

```jsx
import { render } from '@testing-library/react-native';
Expand Down
16 changes: 12 additions & 4 deletions website/docs/Queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ title: Queries
- [`ByHintText`, `ByA11yHint`, `ByAccessibilityHint`](#byhinttext-bya11yhint-byaccessibilityhint)
- [`ByRole`](#byrole)
- [Options](#options-1)
- [`ByA11yState`, `ByAccessibilityState`](#bya11ystate-byaccessibilitystate)
- [`ByA11yState`, `ByAccessibilityState` (deprecated)](#bya11ystate-byaccessibilitystate-deprecated)
- [Default state for: `disabled`, `selected`, and `busy` keys](#default-state-for-disabled-selected-and-busy-keys)
- [Default state for: `checked` and `expanded` keys](#default-state-for-checked-and-expanded-keys)
- [`ByA11Value`, `ByAccessibilityValue`](#bya11value-byaccessibilityvalue)
- [`ByA11Value`, `ByAccessibilityValue` (deprecated)](#bya11value-byaccessibilityvalue-deprecated)
- [Common options](#common-options)
- [`includeHiddenElements` option](#includehiddenelements-option)
- [TextMatch](#textmatch)
Expand Down Expand Up @@ -303,7 +303,11 @@ const element3 = screen.getByRole('button', { name: "Hello", disabled: true });

`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.

### `ByA11yState`, `ByAccessibilityState`
### `ByA11yState`, `ByAccessibilityState` (deprecated)

:::caution
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.
:::

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

### `ByA11Value`, `ByAccessibilityValue`
### `ByA11Value`, `ByAccessibilityValue` (deprecated)

:::caution
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.
:::

> getByA11yValue, getAllByA11yValue, queryByA11yValue, queryAllByA11yValue, findByA11yValue, findAllByA11yValue
> getByAccessibilityValue, getAllByAccessibilityValue, queryByAccessibilityValue, queryAllByAccessibilityValue, findByAccessibilityValue, findAllByAccessibilityValue
Expand Down

0 comments on commit 4fae1c7

Please sign in to comment.