Skip to content

Commit 6779e66

Browse files
committed
chore: docs
1 parent 263dc1a commit 6779e66

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

website/docs/Queries.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ title: Queries
2626
- [Default state for: `disabled`, `selected`, and `busy` keys](#default-state-for-disabled-selected-and-busy-keys)
2727
- [Default state for: `checked` and `expanded` keys](#default-state-for-checked-and-expanded-keys)
2828
- [`ByA11Value`, `ByAccessibilityValue`](#bya11value-byaccessibilityvalue)
29+
- [`ByPredicate`](#bypredicate)
2930
- [Common options](#common-options)
3031
- [`includeHiddenElements` option](#includehiddenelements-option)
3132
- [TextMatch](#textmatch)
@@ -391,6 +392,23 @@ const element = screen.getByA11yValue({ now: 25 });
391392
const element2 = screen.getByA11yValue({ text: /25/ });
392393
```
393394

395+
### `ByPredicate`
396+
397+
> getByPredicate, getAllByPredicate, queryByPredicate, queryAllByPredicate, findByPredicate, findAllByPredicate
398+
399+
```ts
400+
getByPredicate(
401+
predicate: (element: ReactTestInstance) => boolean,
402+
options?: {
403+
includeHiddenElements?: boolean;
404+
}
405+
): ReactTestInstance;
406+
```
407+
408+
Returns a host element matching a custom `predicate` function.
409+
410+
This query type is an escape hatch and should be used with care. In most cases you using the standard queries like `getByRole` or `getByText` will lead to test more-resembling user perspective. Use this query with care in rare cases where more flexibility is needed.
411+
394412
## Common options
395413

396414
### `includeHiddenElements` option

0 commit comments

Comments
 (0)