testing-library / vue-testing-library

🦎 Simple and complete Vue.js testing utilities that encourage good testing practices.
http://testing-library.com/vue
MIT License
1.07k stars 111 forks source link

feat: fireEvent.emit #234

Closed epszaw closed 3 years ago

epszaw commented 3 years ago

Hello! I've already asked for help with custom vue events emitting in #233, but I think, it would be nice to have unified way to fire both DOM and vue events. I propose to use fireEvent.emit as syntax sugar over the __vue__.$emit method.

afontcu commented 3 years ago

Hi! Thank you for the initiative here.

I think this is already solvable by clicking the button and using emitted() to inspect the result. With this addition, tests would rely on implementation details (the custom event) instead of interacting with the component as a user would.

epszaw commented 3 years ago

Hi! Thank you for the initiative here.

I think this is already solvable by clicking the button and using emitted() to inspect the result. With this addition, tests would rely on implementation details (the custom event) instead of interacting with the component as a user would.

I see, what you mean. I'll try to follow this way and return back, if something goes wrong or I'll have example to continue the discussion.