(
root: TestInstance,
predicate: (instance: TestInstance) => boolean,
options: FindAllOptions = {},
)
| 15 | } |
| 16 | |
| 17 | export function findAll( |
| 18 | root: TestInstance, |
| 19 | predicate: (instance: TestInstance) => boolean, |
| 20 | options: FindAllOptions = {}, |
| 21 | ): TestInstance[] { |
| 22 | const { matchDeepestOnly } = options; |
| 23 | const results = root.queryAll(predicate, { matchDeepestOnly }); |
| 24 | |
| 25 | const includeHiddenElements = |
| 26 | options?.includeHiddenElements ?? options?.hidden ?? getConfig()?.defaultIncludeHiddenElements; |
| 27 | |
| 28 | if (includeHiddenElements) { |
| 29 | return results; |
| 30 | } |
| 31 | |
| 32 | const cache = new WeakMap<TestInstance>(); |
| 33 | return results.filter((instance) => !isHiddenFromAccessibility(instance, { cache })); |
| 34 | } |
no test coverage detected
searching dependent graphs…