From 9d5b6421137d37835cdfa0de1a9ca1943c73a0b8 Mon Sep 17 00:00:00 2001 From: Justin Boyson Date: Thu, 26 Mar 2020 06:47:47 -0500 Subject: [PATCH] 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 --- docs/api/wrapper/find.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/api/wrapper/find.md b/docs/api/wrapper/find.md index 5d4bb8934..fa9ab48e5 100644 --- a/docs/api/wrapper/find.md +++ b/docs/api/wrapper/find.md @@ -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).