You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If `ref` in component points to HTML element, `findComponent` will return empty wrapper. This is intended behaviour
1166
1167
:::
1167
1168
1169
+
1168
1170
**NOTE** `getComponent` and `findComponent` will not work on functional components, because they do not have an internal Vue instance (this is what makes functional components more performant). That means the following will **not** work:
1169
1171
1170
1172
```js
@@ -1179,6 +1181,31 @@ wrapper.findComponent(Foo)
1179
1181
1180
1182
For tests using functional component, consider using `get` or `find` and treating them like standard DOM nodes.
1181
1183
1184
+
:::warning Usage with CSS selectors
1185
+
Using `findComponent` with CSS selector might have confusing behavior
expect(childByCss.vm.$options.name).toBe('Root') // => still Root
1204
+
```
1205
+
1206
+
The reason for such behavior is that `RootComponent` and `ChildComponent` are sharing same DOM node and only first matching component is included for each unique DOM node
0 commit comments