Skip to content

Transition javascript hooks firing? #1603

Closed
@joelworsham

Description

@joelworsham

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

  1. Take any component that has a transition expected to fire, and add emitters to those hooks. E.G. @enter="$emit('show').
  2. 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
  3. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions