Vue-test-utils: $parent of a child component defined on a slot, reference to itself

Created on 3 Jul 2018  路  2Comments  路  Source: vuejs/vue-test-utils

Version

1.0.0-beta.20

Reproduction link

https://codesandbox.io/s/wqo716rm55

Steps to reproduce

Run the test written on sandbox

What is expected?

It should work as works on the browser so this.$parent should return the parent of the component and not itself.

What is actually happening?

I have a scenario similar to what I reproduce in the sandbox. I have a few components that are inserted on the default slot of a "wrapper" component, each of these components are registered on the parent when are mounted using a method on the parent this.$parent.register.
All work on the browser but when I tried to test the this.$parent of the child component refers to itself and the test fails because it doesn't find the register method.


For example If I change this.$parent by this.$parent.$parent all works.

bug

All 2 comments

This is a nice issue.

@eddyerburgh @38elements thanks, good work!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eddyerburgh picture eddyerburgh  路  4Comments

lusarz picture lusarz  路  3Comments

alexanderstudte picture alexanderstudte  路  3Comments

dlumbrer picture dlumbrer  路  3Comments

kjugi picture kjugi  路  3Comments