Skip to content
This repository was archived by the owner on Aug 1, 2020. It is now read-only.

Commit 8d5313b

Browse files
author
Brandon Carroll
committed
get, find, and query throw if multiple are found
1 parent eede718 commit 8d5313b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ website/build/
1010
website/yarn.lock
1111
website/node_modules
1212
website/i18n/*
13+
14+
.idea/*

docs/api-queries.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ sidebar_label: Queries
1111
### getBy
1212

1313
`getBy*` queries returns the first matching node for a query, and throws an error if no elements
14-
match.
14+
match or if more than one match is found (use `getAllBy` instead).
1515

1616
### getAllBy
1717

@@ -21,7 +21,8 @@ elements match.
2121
### queryBy
2222

2323
`queryBy*` queries returns the first matching node for a query, and return `null` if no elements
24-
match. This is useful for asserting an element is not present.
24+
match. This is useful for asserting an element is not present. This throws if more than one match is
25+
found (use `queryAllBy` instead)..
2526

2627
### queryAllBy
2728

@@ -31,7 +32,8 @@ match. This is useful for asserting an element is not present.
3132
### findBy
3233

3334
`findBy*` queries return a promise which resolves when an element is found which matches the given
34-
query. The promise is rejected if no element is found after a default timeout of `4500`ms.
35+
query. The promise is rejected if no element is found or if more than one element is found after a
36+
default timeout of `4500`ms. If you need to find more than one element, then use `findAllBy`.
3537

3638
> Note, this is a simple combination of `getBy*` queries and
3739
> [`waitForElement`](/docs/api-async#waitforelement). The `findBy*` queries accept the

0 commit comments

Comments
 (0)