Skip to content

Commit 041a70b

Browse files
committed
feat: Add to A11yAPI types to include the newly-aliased queries for label, hint, and role
1 parent 97b8c3b commit 041a70b

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

src/helpers/a11yAPI.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,45 @@ type FindAllReturn = Promise<GetAllReturn>;
1313
type A11yAPI = {|
1414
// Label
1515
getByA11yLabel: (string | RegExp) => GetReturn,
16+
getByLabelText: (string | RegExp) => GetReturn,
1617
getAllByA11yLabel: (string | RegExp) => GetAllReturn,
18+
getAllByLabelText: (string | RegExp) => GetAllReturn,
1719
queryByA11yLabel: (string | RegExp) => QueryReturn,
20+
queryByLabelText: (string | RegExp) => QueryReturn,
1821
queryAllByA11yLabel: (string | RegExp) => QueryAllReturn,
22+
queryAllByLabelText: (string | RegExp) => QueryAllReturn,
1923
findByA11yLabel: (string | RegExp, ?WaitForOptions) => FindReturn,
24+
findByLabelText: (string | RegExp, ?WaitForOptions) => FindReturn,
2025
findAllByA11yLabel: (string | RegExp, ?WaitForOptions) => FindAllReturn,
26+
findAllByLabelText: (string | RegExp, ?WaitForOptions) => FindAllReturn,
2127

2228
// Hint
2329
getByA11yHint: (string | RegExp) => GetReturn,
30+
getByHintText: (string | RegExp) => GetReturn,
2431
getAllByA11yHint: (string | RegExp) => GetAllReturn,
32+
getAllByHintText: (string | RegExp) => GetAllReturn,
2533
queryByA11yHint: (string | RegExp) => QueryReturn,
34+
queryByHintText: (string | RegExp) => QueryReturn,
2635
queryAllByA11yHint: (string | RegExp) => QueryAllReturn,
36+
queryAllByHintText: (string | RegExp) => QueryAllReturn,
2737
findByA11yHint: (string | RegExp, ?WaitForOptions) => FindReturn,
38+
findByHintText: (string | RegExp, ?WaitForOptions) => FindReturn,
2839
findAllByA11yHint: (string | RegExp, ?WaitForOptions) => FindAllReturn,
40+
findAllByHintText: (string | RegExp, ?WaitForOptions) => FindAllReturn,
2941

3042
// Role
3143
getByA11yRole: (A11yRole | RegExp) => GetReturn,
44+
getByRole: (A11yRole | RegExp) => GetReturn,
3245
getAllByA11yRole: (A11yRole | RegExp) => GetAllReturn,
46+
getAllByRole: (A11yRole | RegExp) => GetAllReturn,
3347
queryByA11yRole: (A11yRole | RegExp) => QueryReturn,
48+
queryByRole: (A11yRole | RegExp) => QueryReturn,
3449
queryAllByA11yRole: (A11yRole | RegExp) => QueryAllReturn,
50+
queryAllByRole: (A11yRole | RegExp) => QueryAllReturn,
3551
findByA11yRole: (A11yRole, ?WaitForOptions) => FindReturn,
52+
findByRole: (A11yRole, ?WaitForOptions) => FindReturn,
3653
findAllByA11yRole: (A11yRole, ?WaitForOptions) => FindAllReturn,
54+
findAllByRole: (A11yRole, ?WaitForOptions) => FindAllReturn,
3755

3856
// States
3957
getByA11yStates: (A11yStates | Array<A11yStates>) => GetReturn,

typings/index.d.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,45 +167,81 @@ export type A11yValue = {
167167
type A11yAPI = {
168168
// Label
169169
getByA11yLabel: (matcher: string | RegExp) => GetReturn;
170+
getByLabelText: (matcher: string | RegExp) => GetReturn;
170171
getAllByA11yLabel: (matcher: string | RegExp) => GetAllReturn;
172+
getAllByLabelText: (matcher: string | RegExp) => GetAllReturn;
171173
queryByA11yLabel: (matcher: string | RegExp) => QueryReturn;
174+
queryByLabelText: (matcher: string | RegExp) => QueryReturn;
172175
queryAllByA11yLabel: (matcher: string | RegExp) => QueryAllReturn;
176+
queryAllByLabelText: (matcher: string | RegExp) => QueryAllReturn;
173177
findByA11yLabel: (
174178
matcher: string | RegExp,
175179
waitForOptions?: WaitForOptions
176180
) => FindReturn;
181+
findByLabelText: (
182+
matcher: string | RegExp,
183+
waitForOptions?: WaitForOptions
184+
) => FindReturn;
177185
findAllByA11yLabel: (
178186
matcher: string | RegExp,
179187
waitForOptions?: WaitForOptions
180188
) => FindAllReturn;
189+
findAllByLabelText: (
190+
matcher: string | RegExp,
191+
waitForOptions?: WaitForOptions
192+
) => FindAllReturn;
181193

182194
// Hint
183195
getByA11yHint: (matcher: string | RegExp) => GetReturn;
196+
getByHintText: (matcher: string | RegExp) => GetReturn;
184197
getAllByA11yHint: (matcher: string | RegExp) => GetAllReturn;
198+
getAllByHintText: (matcher: string | RegExp) => GetAllReturn;
185199
queryByA11yHint: (matcher: string | RegExp) => QueryReturn;
200+
queryByHintText: (matcher: string | RegExp) => QueryReturn;
186201
queryAllByA11yHint: (matcher: string | RegExp) => QueryAllReturn;
202+
queryAllByHintText: (matcher: string | RegExp) => QueryAllReturn;
187203
findByA11yHint: (
188204
matcher: string | RegExp,
189205
waitForOptions?: WaitForOptions
190206
) => FindReturn;
207+
findByHintText: (
208+
matcher: string | RegExp,
209+
waitForOptions?: WaitForOptions
210+
) => FindReturn;
191211
findAllByA11yHint: (
192212
matcher: string | RegExp,
193213
waitForOptions?: WaitForOptions
194214
) => FindAllReturn;
215+
findAllByHintText: (
216+
matcher: string | RegExp,
217+
waitForOptions?: WaitForOptions
218+
) => FindAllReturn;
195219

196220
// Role
197221
getByA11yRole: (matcher: AccessibilityRole | RegExp) => GetReturn;
222+
getByRole: (matcher: AccessibilityRole | RegExp) => GetReturn;
198223
getAllByA11yRole: (matcher: AccessibilityRole | RegExp) => GetAllReturn;
224+
getAllByRole: (matcher: AccessibilityRole | RegExp) => GetAllReturn;
199225
queryByA11yRole: (matcher: AccessibilityRole | RegExp) => QueryReturn;
226+
queryByRole: (matcher: AccessibilityRole | RegExp) => QueryReturn;
200227
queryAllByA11yRole: (matcher: AccessibilityRole | RegExp) => QueryAllReturn;
228+
queryAllByRole: (matcher: AccessibilityRole | RegExp) => QueryAllReturn;
201229
findByA11yRole: (
202230
matcher: AccessibilityRole | RegExp,
203231
waitForOptions?: WaitForOptions
204232
) => FindReturn;
233+
findByRole: (
234+
matcher: AccessibilityRole | RegExp,
235+
waitForOptions?: WaitForOptions
236+
) => FindReturn;
205237
findAllByA11yRole: (
206238
matcher: AccessibilityRole | RegExp,
207239
waitForOptions?: WaitForOptions
208240
) => FindAllReturn;
241+
findAllByRole: (
242+
matcher: AccessibilityRole | RegExp,
243+
waitForOptions?: WaitForOptions
244+
) => FindAllReturn;
209245

210246
// States
211247
getByA11yStates: (

0 commit comments

Comments
 (0)