Parsing event fails when event name is non-primitive value
Summary
If first argument to $emit is an object property, the parser does not handle this correctly.
Steps to reproduce
const EVENTS = {
CLOSE: 'close'
}
export default {
methods: {
/**
* Close modal
*/
close () {
/**
* Emit the `close` event on click
*/
this.$emit(EVENTS.CLOSE, true)
}
}
}
The end result of this rendered via @vuedoc/md is:
****unhandled-event-name****
What is the current bug behavior?
The parser does not accept non-primitive values.
What is the expected correct behavior?
The parser accepts non-primitive values.
Possible fixes
A possible solution for this could be to allow specifying a name for the event via JSDoc annotation:
const EVENTS = {
CLOSE: 'close'
}
export default {
methods: {
/**
* Close modal
*/
close () {
/**
* Emit the `close` event on click
* @event `close`
*/
this.$emit(EVENTS.CLOSE, true)
}
}
}
Context
My goal here is to be able to export a hash with component events, for use in unit testing.