fix(runtime-core): fix erraneous emits warnings w/ mixins

fix #2651
This commit is contained in:
Evan You
2021-03-26 16:29:40 -04:00
parent d5824b97c5
commit 60d777d228
2 changed files with 20 additions and 2 deletions

View File

@@ -175,6 +175,21 @@ describe('component: emit', () => {
expect(`event validation failed for event "foo"`).toHaveBeenWarned()
})
// #2651
test('should not attach normalized object when mixins do not contain emits', () => {
const Foo = defineComponent({
mixins: [{}],
render() {},
created() {
this.$emit('foo')
}
})
render(h(Foo), nodeOps.createElement('div'))
expect(
`Component emitted event "foo" but it is neither declared`
).not.toHaveBeenWarned()
})
test('.once', () => {
const Foo = defineComponent({
render() {},