Description
Subject of the issue
I have a component which is entirely wrapped in a transition. This component begins with isShowing
as false
, waits a tick, then sets it to true
, thus kicking off the transition.
In all visual testing and building of the component, this works great. They fire, all is well. In my test, however, they don't seem to fire.
Steps to reproduce
- Take any component that has a transition expected to fire, and add emitters to those hooks. E.G.
@enter="$emit('show')
. - Test this in jest/vue-test-utils. In your test, make sure you await a
$nextTick
or something, even a timeout, so that the event would hav efired - Test with:
expect(wrapper.emitted('show')).toBeTruthy()
This will not pass (for me)
Expected behaviour
Test should pass, becuase the transition @enter
hook should have fired, which should have emitted the show
event
Actual behaviour
wrapper.emitted()
is totally blank. Even after a manual, 5second timeout, just to be sure. Nothing was emitted. I even tested against this by tossing the emitter right in mounted()
, and then it worked and was seen. So I know it isn't the emitting logic.
Possible Solution
Not sure. Does vue test utils "silence" these transition hooks? Or perhaps not account for them?