diff --git a/website/docs/API.md b/website/docs/API.md index 3492fe399..6ea4827e4 100644 --- a/website/docs/API.md +++ b/website/docs/API.md @@ -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'; @@ -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'; diff --git a/website/docs/Queries.md b/website/docs/Queries.md index 4e6bf3fcd..264a45d6d 100644 --- a/website/docs/Queries.md +++ b/website/docs/Queries.md @@ -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) @@ -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 @@ -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