Testing emit from $root
See original GitHub issueAny recommendations on testing functionality that depends on listening to events emitted via $root.$emit
? Like you would via wrapper.vm.$root.$emit
for example using vue-test-utils
. Haven’t been able to find anything in the docs.
Thanks for a great library!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Testing this.$root.$emit with wrapper.emitted #980 - GitHub
In version 1.0.0-beta.16 , the wrapper.emitted('say') test passes for the event emitted on the component's root. What is ...
Read more >How to test events on the root element of component in vue 2?
Another possibility it's to find your element in the dom and check the emitted value of your root component.
Read more >emitted | Vue Test Utils
Return an object containing custom events emitted by the Wrapper vm . Returns: { [name: string]: Array<Array<any>> }. Example:.
Read more >Testing emitted events - Vue Testing Handbook
Some times you might want to test emitted events without actually mounting the component. You can do this by using call . Let's...
Read more >Emitting events on root component in Vue - CodeSandbox
Emitting events on root component in Vue. 0. Embed Fork Create Sandbox Sign in. Sandbox Info ... Tests. (0.46x). Mobile. Console.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let me know if this is a feature the library needs and I’ll send in a PR!
Thank you! Can’t believe I didn’t think of this sooner. This was my solution:
Thanks for the heads up!