Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit acbf466

Browse files
MattAgnthymikee
MattAgn
authored andcommittedFeb 5, 2021
refactor: rename method makeQuery to makeA11yQuery
the renaming is done to avoid any confusion with makeQueries which should be the new way to add new queries
1 parent 8b917e2 commit acbf466

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed
 

‎src/helpers/a11yAPI.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// @flow
22
import type { A11yRole, A11yStates, A11yState, A11yValue } from '../types.flow';
33
import type { WaitForOptions } from '../waitFor';
4-
import makeQuery from './makeQuery';
4+
import makeA11yQuery from './makeA11yQuery';
55

66
type GetReturn = ReactTestInstance;
77
type GetAllReturn = Array<ReactTestInstance>;
@@ -118,7 +118,7 @@ export function matchObject<T: {}>(prop?: T, matcher: T): boolean {
118118

119119
export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
120120
({
121-
...makeQuery(
121+
...makeA11yQuery(
122122
'accessibilityLabel',
123123
{
124124
getBy: ['getByA11yLabel', 'getByAccessibilityLabel', 'getByLabelText'],
@@ -150,7 +150,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
150150
},
151151
matchStringValue
152152
)(instance),
153-
...makeQuery(
153+
...makeA11yQuery(
154154
'accessibilityHint',
155155
{
156156
getBy: ['getByA11yHint', 'getByAccessibilityHint', 'getByHintText'],
@@ -178,7 +178,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
178178
},
179179
matchStringValue
180180
)(instance),
181-
...makeQuery(
181+
...makeA11yQuery(
182182
'accessibilityRole',
183183
{
184184
getBy: ['getByA11yRole', 'getByAccessibilityRole', 'getByRole'],
@@ -202,7 +202,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
202202
},
203203
matchStringValue
204204
)(instance),
205-
...makeQuery(
205+
...makeA11yQuery(
206206
'accessibilityStates',
207207
{
208208
getBy: ['getByA11yStates', 'getByAccessibilityStates'],
@@ -214,7 +214,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
214214
},
215215
matchArrayValue
216216
)(instance),
217-
...makeQuery(
217+
...makeA11yQuery(
218218
'accessibilityState',
219219
{
220220
getBy: ['getByA11yState', 'getByAccessibilityState'],
@@ -226,7 +226,7 @@ export const a11yAPI = (instance: ReactTestInstance): A11yAPI =>
226226
},
227227
matchObject
228228
)(instance),
229-
...makeQuery(
229+
...makeA11yQuery(
230230
'accessibilityValue',
231231
{
232232
getBy: ['getByA11yValue', 'getByAccessibilityValue'],

‎src/helpers/makeQuery.js renamed to ‎src/helpers/makeA11yQuery.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type QueryNames = {
2626
findAllBy: Array<string>,
2727
};
2828

29-
const makeQuery = <P: mixed, M: mixed>(
29+
const makeA11yQuery = <P: mixed, M: mixed>(
3030
name: string,
3131
queryNames: QueryNames,
3232
matcherFn: (prop: P, value: M) => boolean
@@ -95,4 +95,4 @@ const makeQuery = <P: mixed, M: mixed>(
9595
};
9696
};
9797

98-
export default makeQuery;
98+
export default makeA11yQuery;

0 commit comments

Comments
 (0)
Please sign in to comment.