tl;dr
I call wrapper.setProps() and the element (elm prop) in my slot disappears.
Background
My component operates on the element it gets into its slot - I need to grab the element's height in runtime.
In unit tests, I want to setProps to change the state of the component but once I do that, it loses the information about the element which was passed to its slot, as if I stopped passing the element.
Steps to reproduce
Mount a component with non-empty slots, using either mount() or shallowMount().
Call wrapper.setProps().
See that the elm property inside of one of wrapper.vm.$slots is falsy. Before calling wrapper.setProps() it was not.
(Using @vue/test-utils 1.3.5).
Subject of the issue
tl;dr I call
wrapper.setProps()
and the element (elm
prop) in my slot disappears.Background My component operates on the element it gets into its slot - I need to grab the element's height in runtime.
In unit tests, I want to
setProps
to change the state of the component but once I do that, it loses the information about the element which was passed to its slot, as if I stopped passing the element.Steps to reproduce
slots
, using eithermount()
orshallowMount()
.wrapper.setProps()
.elm
property inside of one ofwrapper.vm.$slots
is falsy. Before callingwrapper.setProps()
it was not.See the working and simplified example.
Expected behaviour
In the example,
wrapper.vm.$slots.footer[0].elm
should not be empty after callingwrapper.setProps()
.Actual behaviour
In the example,
wrapper.vm.$slots.footer[0].elm
is empty after callingwrapper.setProps()
.Possible Solution
Keep the
elm
property intact.