Feature request: trigger does not work on vue components
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 291
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 18
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.
Expected behavior
mount(VueComponent).findComponent({ name: 'VueComponent' }).trigger('vueComponentEvent')
should work like
mount(VueComponent).findComponent({ name: 'VueComponent' }).vm.$emit('vueComponentEvent')
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the StackBlitz reproduction, especially src/components/tests/HelloWorld.spec.ts and src/tests/App.spec.ts, then inspect VueWrapper's trigger behavior. Confirm that triggering an event on a component matches the expected vm.$emit behavior and that the reproduction tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100