Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Transition javascript hooks firing? #1603
Comments
Hi! You are right - Vue Test Utils stubs out This change was made in #1411. You should be able to get them to trigger like this, I think: #1411 (comment) If you can share your test, I might be able to suggest some strategies to test it, if that doesn't work. |
Thanks for the response! I checked, and that solution does appear to fix most issues, but still doesn't fire any hooks. If this is simply isn't possible right now, totally fine. But if it is, I'd love to hear how :) Here's the test suite:
|
Oh!!! I just realized I was mucking around with that trying to get it to work, and I changed the emitter name. So, thanks so much :) |
well, actually, it appears the from above, here's the updated test suite that is failing the
And the beginning of the component that fires these transitions:
|
I have never tested those transition hooks. I don't see why they wouldn't trigger, though. Maybe you can wrap it in a |
Subject of the issue
I have a component which is entirely wrapped in a transition. This component begins with
isShowing
asfalse
, waits a tick, then sets it totrue
, 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
@enter="$emit('show')
.$nextTick
or something, even a timeout, so that the event would hav efiredexpect(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 theshow
eventActual 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 inmounted()
, 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?