Skip to content

Commit

Permalink
docs #1477 Note exception to chaining find calls (#1481)
Browse files Browse the repository at this point in the history
* 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 <lachlan.miller.1990@outlook.com>
  • Loading branch information
unclejustin and lmiller1990 committed Mar 26, 2020
1 parent 70b553b commit 9d5b642
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions docs/api/wrapper/find.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,24 @@ const fooRef = wrapper.find({ ref: 'foo' })
expect(fooRef.is(Foo)).toBe(true)
```

- **Note:**

- When chaining `find` calls together, only DOM selectors can be used

```js
let button

// Will throw an error
button = wrapper.find({ ref: 'testButton' })
expect(button.find(Icon).exists()).toBe(true)

// Will throw an error
button = wrapper.find({ ref: 'testButton' })
expect(button.find({ name: 'icon' }).exists()).toBe(true)

// Will work as expected
button = wrapper.find({ ref: 'testButton' })
expect(button.find('.icon').exists()).toBe(true)
```

See also: [get](./get.md).

0 comments on commit 9d5b642

Please sign in to comment.