Skip to content

Bug: findComponent doesn't work properly if child component is root of parent component #2300

@ElVisPL

Description

@ElVisPL

Describe the bug
This is known issue in vue test utils v1, but the previous workaround doesn't work anymore

<template>
  <WelcomeItem :test="2"> </WelcomeItem>
</template>

vs

<template>
  <div>
    <WelcomeItem :test="2"> </WelcomeItem>
  </div>
</template>

To Reproduce

https://stackblitz.com/edit/github-orekbd?file=src%2Fcomponents%2F__tests__%2FTheWelcome.spec.ts

run yarn test:utils TheWelcome

Expected behavior

findComponent.props() returns props of child component

Related information:

In vue test utils v1 there was workaround:

const childWrapper = createWrapper(wrapper.vm.$children[0])

Now there is no wrapper.vm.$children

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions