Skip to content

Can't find functional component #296

Closed
@LucienLee

Description

@LucienLee

Hi there,
I found that find can't get functional component.
For instance:

import { mount } from 'vue-test-utils'
import functionalComponent from './functionalComponent'
import ParentComponent from './ParentComponent'

const wrapper = mount(ParentComponent);
wrapper.find(functionalComponent); // Can't find it

I know that functional component is instanceless, so it's understandable that wrapper can't find it directly. However, that is really hard to test. One way is use ref to mark component but that is not ease-to-use when using multiple functional components in the same time.

Any suggestions to test functional component? Otherwise, how do you think about supporting finding functional component?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions