callumacrae / vue-test

:checkered_flag: DEPRECATED: Component testing for Vue.js
90 stars 6 forks source link

Add ability to test emitted events #8

Open asselin opened 7 years ago

asselin commented 7 years ago

Before merging, we should probably have a discussion on whether adding another parameter to mount is a good idea...

callumacrae commented 7 years ago

An alternative could be to turn the returned object into an event emitter instead of adding another argument:

const mounted = mount(Events);
mounted.on('anEvent', spy);
mounted.find('a:first-child').trigger('click');

Wonder if that would be a better idea anyway.

Also, could you test that the event is being passed in as an argument?