Skip to content

Commit ba1d1b1

Browse files
author
Kent C. Dodds
authored
docs: add findBy query type docs.
Reference testing-library/dom-testing-library#224
1 parent 2b800cf commit ba1d1b1

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

docs/api-queries.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,26 @@ present.
2626

2727
### queryAllBy
2828

29-
`queryAllBy*`queries return an array of all matching nodes for a query, and
29+
`queryAllBy*` queries return an array of all matching nodes for a query, and
3030
return an empty array (`[]`) if no elements match.
3131

32+
### findBy
33+
34+
`findBy*` queries return a promise which resolves when an element is found which
35+
matches the given query. The promise is rejected if no element is found after
36+
a default timeout of `4500`ms.
37+
38+
> Note, this is a simple combination of `getBy*` queries and
39+
> [`waitForElement`](/docs/api-async#waitforelement). The `findBy*` queries
40+
> accept the `waitForElement` options as the last argument. (i.e.
41+
> `findByText(container, 'text', queryOptions, waitForElementOptions)`)
42+
43+
### findAllBy
44+
45+
`findAllBy*` queries return a promise which resolves to an array of elements when
46+
any elements are found which match the given query. The promise is rejected if no
47+
elements are found after a default timeout of `4500`ms.
48+
3249
## Options
3350

3451
The argument to a query can be a _string_, _regular expression_, or _function_.

0 commit comments

Comments
 (0)