Skip to content

Commit 9361186

Browse files
docs: update queries/about to explain queryOptions
* Update queries/about.mdx `queryOptions` are mentioned, but it's never explained where you actually pass them in. Once you know it's obvious, but it wasn't initially to me ("do I pass it into the render function, to modify behavior for all queries?"), and readers shouldn't have to test until they find it. It would be great to link to a list of the available options in `queryOptions` in the section I added, but I couldn't find such a list. I also added a note aboout the parameters that functions passed to queries will receive. It can be derived from examples later in the document, but you have to look for them, and I think it's clearer to make it explicit when the option to pass functions is mentioned. * Adjusting based on CR feedback * Replacing code example for `queryOptions` Replacing with link per CR suggestion. * convert link to relative, descriptive link text Co-authored-by: Matan Borenkraout <Matanbobi@gmail.com> Co-authored-by: Matan Borenkraout <Matanbobi@gmail.com>
1 parent 0bdced5 commit 9361186

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

docs/queries/about.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ const inputNode1 = screen.getByLabelText('Username')
170170
const container = document.querySelector('#app')
171171
const inputNode2 = getByLabelText(container, 'Username')
172172
```
173+
### `queryOptions`
174+
175+
You can pass a `queryOptions` object with the query type. See the docs for each query type to see available options, e.g. [byRole API](queries/byrole.mdx#api).
173176

174177
### `screen`
175178

@@ -237,7 +240,7 @@ cy.findByLabelText('Example').should('exist')
237240
## `TextMatch`
238241

239242
Most of the query APIs take a `TextMatch` as an argument, which means the
240-
argument can be either a _string_, _regex_, or a _function_ which returns `true`
243+
argument can be either a _string_, _regex_, or a _function_ of signature `(content?: string, element?: Element | null) => boolean` which returns `true`
241244
for a match and `false` for a mismatch.
242245

243246
### TextMatch Examples

0 commit comments

Comments
 (0)