Skip to content

Commit 9d5b642

Browse files
docs #1477 Note exception to chaining find calls (#1481)
* docs(wrapper): note exception to chaining find calls Make it clear that when chaining find calls, you can only use DOM selectors. * chore: revert Co-authored-by: Lachlan Miller <[email protected]>
1 parent 70b553b commit 9d5b642

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/api/wrapper/find.md

+20
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,24 @@ const fooRef = wrapper.find({ ref: 'foo' })
3232
expect(fooRef.is(Foo)).toBe(true)
3333
```
3434

35+
- **Note:**
36+
37+
- When chaining `find` calls together, only DOM selectors can be used
38+
39+
```js
40+
let button
41+
42+
// Will throw an error
43+
button = wrapper.find({ ref: 'testButton' })
44+
expect(button.find(Icon).exists()).toBe(true)
45+
46+
// Will throw an error
47+
button = wrapper.find({ ref: 'testButton' })
48+
expect(button.find({ name: 'icon' }).exists()).toBe(true)
49+
50+
// Will work as expected
51+
button = wrapper.find({ ref: 'testButton' })
52+
expect(button.find('.icon').exists()).toBe(true)
53+
```
54+
3555
See also: [get](./get.md).

0 commit comments

Comments
 (0)