Skip to content

find throws error when using refs #1477

Closed
@unclejustin

Description

@unclejustin

Version

1.0.0-beta.30

Reproduction link

https://gitlab.com/unclejustin/test-utils-but

Steps to reproduce

In a test reference an element by ref. Then try to find anything in that element using anything other than a dom selector:

const button = wrapper.find({ ref: "testButton" });
expect(button.find(Icon).exists()).toBe(true);

This will throw the errror "[vue-test-utils]: cannot find a Vue instance on a DOM node. The node you are calling find on does not exist in the VDom. Are you adding the node as innerHTML?"

What is expected?

That found elements have the same functionality as root wrappers.

What is actually happening?

Throwing an error.


I think this should work as described, but if I am wrong then maybe the docs just need to be updated to reflect the actual functionality?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions