Skip to content

this.$children is empty in the created lifecycle hook #827

Closed
@KyleMayes

Description

@KyleMayes

Version

1.0.0-beta.20

Reproduction link

https://codesandbox.io/s/q89qro9yq?module=%2Fsrc%2Fcomponents%2FTabs.spec.js

Steps to reproduce

  1. Run the unit tests (click on "Tests" at the bottom)

What is expected?

The mount function in the test will render the tabs component as it is seen in the browser on the right, with three li elements in the ul element representing the three child tab components.

What is actually happening?

In the tabs component, there is a created lifecycle hook:

created() {
  this.tabs = this.$children;
}

This works in the browser, but $children is empty when rendered by vue-test-utils.
This results in the li elements (which are produced by iterating over this tabs data field) are not rendered.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions