Skip to content

Conversation

@alecgibson
Copy link
Contributor

@alecgibson alecgibson commented Aug 10, 2023

Consider an empty emitter function:

@Component class MyComponent { @Emit public foo(): void {} }

We would expect this to emit a 'foo' event with no arguments (since the return value is undefined).

However, when testing with @vue/test-utils, we have to write:

expect(component.emitted('foo')).to.eql([[undefined]])

But it would be nicer - and more consistent with vue-property-decorator - if we instead called $emit() with no arguments in this case to be able to write:

expect(component.emitted('foo')).to.eql([[]])
Consider an empty emitter function: ```ts @component class MyComponent { @emit public foo(): void {} } ``` We would expect this to emit a `'foo'` event with no arguments (since the return value is `undefined`). However, when testing with `@vue/test-utils`, we have to write: ```ts expect(component.emitted('foo')).to.eql([[undefined]]) ``` But it would be nicer - and more consistent with [`vue-property-decorator`][1] - if we instead called `$emit()` with no arguments in this case to be able to write: ```ts expect(component.emitted('foo')).to.eql([[]]) ``` [1]: https://github.com/kaorun343/vue-property-decorator/blob/e04872349bab357e6d08b01442f83abc9976eb50/src/decorators/Emit.ts#L22
@ruojianll ruojianll merged commit 3954c58 into facing-dev:master Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants