Skip to content

Commit 7157512

Browse files
authored
Usage of exact option with *byRole queries
Added a note about using `exact` option with *byRole queries to enable fuzzy matching. Please see details of the issue here: testing-library/dom-testing-library#1157 Users may expect to use `exact: false` for substring matching whereas it doesn't affect the way of filtering out DOM nodes by accessible names.
1 parent 8ecf58b commit 7157512

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/queries/about.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ can contain options that affect the precision of string matching:
295295
- `exact`: Defaults to `true`; matches full strings, case-sensitive. When false,
296296
matches substrings and is not case-sensitive.
297297
- `exact` has no effect on `regex` or `function` arguments.
298+
- `exact` has no effect on accessible names specified via `name` option of `*byRole`
299+
queries. You can use regex for fuzzy matching on accessible names.
298300
- In most cases using a regex instead of a string gives you more control over
299301
fuzzy matching and should be preferred over `{ exact: false }`.
300302
- `normalizer`: An optional function which overrides normalization behavior. See

0 commit comments

Comments
 (0)