Skip to content

Commit 9f3b31d

Browse files
refactor: remove deprecated byA11yStates queries (#1015)
1 parent 7431885 commit 9f3b31d

File tree

7 files changed

+7
-227
lines changed

7 files changed

+7
-227
lines changed

src/queries/__tests__/a11yStates.test.tsx

-86
This file was deleted.

src/queries/a11yStates.ts

-86
This file was deleted.

src/screen.ts

-12
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,6 @@ const defaultScreen: RenderResult = {
5151
queryAllByRole: notImplemented,
5252
findByRole: notImplemented,
5353
findAllByRole: notImplemented,
54-
getByA11yStates: notImplemented,
55-
getAllByA11yStates: notImplemented,
56-
queryByA11yStates: notImplemented,
57-
queryAllByA11yStates: notImplemented,
58-
findByA11yStates: notImplemented,
59-
findAllByA11yStates: notImplemented,
60-
getByAccessibilityStates: notImplemented,
61-
getAllByAccessibilityStates: notImplemented,
62-
queryByAccessibilityStates: notImplemented,
63-
queryAllByAccessibilityStates: notImplemented,
64-
findByAccessibilityStates: notImplemented,
65-
findAllByAccessibilityStates: notImplemented,
6654
getByA11yState: notImplemented,
6755
getAllByA11yState: notImplemented,
6856
queryByA11yState: notImplemented,

src/within.ts

-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { bindByLabelTextQueries } from './queries/labelText';
77
import { bindByHintTextQueries } from './queries/hintText';
88
import { bindByRoleQueries } from './queries/role';
99
import { bindByA11yStateQueries } from './queries/a11yState';
10-
import { bindByA11yStatesQueries } from './queries/a11yStates';
1110
import { bindByA11yValueQueries } from './queries/a11yValue';
1211
import { bindUnsafeByTypeQueries } from './queries/unsafeType';
1312
import { bindUnsafeByPropsQueries } from './queries/unsafeProps';
@@ -22,7 +21,6 @@ export function within(instance: ReactTestInstance) {
2221
...bindByHintTextQueries(instance),
2322
...bindByRoleQueries(instance),
2423
...bindByA11yStateQueries(instance),
25-
...bindByA11yStatesQueries(instance),
2624
...bindByA11yValueQueries(instance),
2725
...bindUnsafeByTypeQueries(instance),
2826
...bindUnsafeByPropsQueries(instance),

typings/index.flow.js

+6-24
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ declare type A11yState = {|
5656
expanded?: boolean,
5757
|};
5858

59-
declare type A11yStates =
60-
| 'disabled'
61-
| 'selected'
62-
| 'checked'
63-
| 'unchecked'
64-
| 'busy'
65-
| 'expanded'
66-
| 'collapsed'
67-
| 'hasPopup';
68-
6959
declare type A11yValue = {
7060
min?: number,
7161
max?: number,
@@ -266,25 +256,17 @@ interface A11yAPI {
266256
waitForOptions?: WaitForOptions
267257
) => FindAllReturn;
268258

269-
// States
270-
getByA11yStates: (matcher: A11yStates | Array<A11yStates>) => GetReturn;
271-
getAllByA11yStates: (matcher: A11yStates | Array<A11yStates>) => GetAllReturn;
272-
queryByA11yStates: (matcher: A11yStates | Array<A11yStates>) => QueryReturn;
273-
queryAllByA11yStates: (
274-
matcher: A11yStates | Array<A11yStates>
275-
) => QueryAllReturn;
276-
277259
// State
278-
getByA11yState: (matcher: A11yStates) => GetReturn;
279-
getAllByA11yState: (matcher: A11yStates) => GetAllReturn;
280-
queryByA11yState: (matcher: A11yStates) => QueryReturn;
281-
queryAllByA11yState: (matcher: A11yStates) => QueryAllReturn;
260+
getByA11yState: (matcher: A11yState) => GetReturn;
261+
getAllByA11yState: (matcher: A11yState) => GetAllReturn;
262+
queryByA11yState: (matcher: A11yState) => QueryReturn;
263+
queryAllByA11yState: (matcher: A11yState) => QueryAllReturn;
282264
findByA11yState: (
283-
matcher: A11yStates,
265+
matcher: A11yState,
284266
waitForOptions?: WaitForOptions
285267
) => FindReturn;
286268
findAllByA11yState: (
287-
matcher: A11yStates,
269+
matcher: A11yState,
288270
waitForOptions?: WaitForOptions
289271
) => FindAllReturn;
290272

website/docs/API.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ See [Queries](./Queries.md) for a complete list.
9797
```jsx
9898
import { render } from '@testing-library/react-native';
9999

100-
const { getByText, queryByA11yStates } = render(<Component />);
100+
const { getByText, queryByA11yState } = render(<Component />);
101101
```
102102

103103
### `update`

website/docs/Queries.md

-16
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ title: Queries
2020
- [`ByTestId`](#bytestid)
2121
- [`ByLabelText`](#bylabeltext)
2222
- [`ByHintText`, `ByA11yHint`, `ByAccessibilityHint`](#byhinttext-bya11yhint-byaccessibilityhint)
23-
- [`ByA11yStates`, `ByAccessibilityStates`](#bya11ystates-byaccessibilitystates)
2423
- [`ByRole`](#byrole)
2524
- [`ByA11yState`, `ByAccessibilityState`](#bya11ystate-byaccessibilitystate)
2625
- [`ByA11Value`, `ByAccessibilityValue`](#bya11value-byaccessibilityvalue)
@@ -177,21 +176,6 @@ const element = screen.getByHintText('Plays a song');
177176
Please consult [Apple guidelines on how `accessibilityHint` should be used](https://developer.apple.com/documentation/objectivec/nsobject/1615093-accessibilityhint).
178177
:::
179178

180-
### `ByA11yStates`, `ByAccessibilityStates`
181-
182-
> getByA11yStates, getAllByA11yStates, queryByA11yStates, queryAllByA11yStates
183-
> getByAccessibilityStates, getAllByAccessibilityStates, queryByAccessibilityStates, queryAllByAccessibilityStates
184-
185-
Returns a `ReactTestInstance` with matching `accessibilityStates` prop.
186-
187-
```jsx
188-
import { render, screen } from '@testing-library/react-native';
189-
190-
render(<MyComponent />);
191-
const element = screen.getByA11yStates(['checked']);
192-
const element2 = screen.getByA11yStates('checked');
193-
```
194-
195179
### `ByRole`
196180

197181
> getByRole, getAllByRole, queryByRole, queryAllByRole, findByRole, findAllByRole

0 commit comments

Comments
 (0)