Skip to content

Feature request: trigger does not work on vue componentsΒ #2087

Open
@ghost

Description

Describe the bug
I just kinda expected vue test utils to be able to trigger Vue component events out of the box. VueWrapper does not have a trigger implementation that works for Vue components. You have to use $emit on the vm instance.

To Reproduce
https://stackblitz.com/edit/github-kdgtxj?file=src%2Fcomponents%2FHelloWorld.vue,src%2FApp.vue,src%2Fcomponents%2F__tests__%2FHelloWorld.spec.ts,src%2F__tests__%2FApp.spec.ts

Expected behavior
mount(VueComponent).findComponent({ name: 'VueComponent' }).trigger('vueComponentEvent')

should work like

mount(VueComponent).findComponent({ name: 'VueComponent' }).vm.$emit('vueComponentEvent')

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions