MCPcopy Index your code
hub / github.com/callstack/react-native-testing-library / queryAllByRole

Function queryAllByRole

src/queries/role.ts:57–71  ·  view source on GitHub ↗
(instance: TestInstance)

Source from the content-addressed store, hash-verified

55};
56
57const queryAllByRole = (instance: TestInstance): QueryAllByQuery<ByRoleMatcher, ByRoleOptions> =>
58 function queryAllByRoleFn(role, options) {
59 const normalizedRole = typeof role === 'string' ? normalizeRole(role) : role;
60 return findAll(
61 instance,
62 (item) =>
63 // run the cheapest checks first, and early exit to avoid unneeded computations
64 isAccessibilityElement(item) &&
65 matchStringProp(getRole(item), normalizedRole) &&
66 matchAccessibleStateIfNeeded(item, options) &&
67 matchAccessibilityValueIfNeeded(item, options?.value) &&
68 matchAccessibleNameIfNeeded(item, options?.name),
69 options,
70 );
71 };
72
73const formatQueryParams = (role: TextMatch, options: ByRoleOptions = {}) => {
74 const params = [`role: ${String(role)}`];

Callers

nothing calls this directly

Calls 8

normalizeRoleFunction · 0.90
findAllFunction · 0.90
isAccessibilityElementFunction · 0.90
matchStringPropFunction · 0.90
getRoleFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…