|
@@ -245,21 +245,27 @@ describe('component: emit', () => {
|
|
|
const Foo = defineComponent({
|
|
const Foo = defineComponent({
|
|
|
render() {},
|
|
render() {},
|
|
|
emits: {
|
|
emits: {
|
|
|
- foo: null
|
|
|
|
|
|
|
+ foo: null,
|
|
|
|
|
+ bar: null
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
this.$emit('foo')
|
|
this.$emit('foo')
|
|
|
this.$emit('foo')
|
|
this.$emit('foo')
|
|
|
|
|
+ this.$emit('bar')
|
|
|
|
|
+ this.$emit('bar')
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
const fn = jest.fn()
|
|
const fn = jest.fn()
|
|
|
|
|
+ const barFn = jest.fn()
|
|
|
render(
|
|
render(
|
|
|
h(Foo, {
|
|
h(Foo, {
|
|
|
- onFooOnce: fn
|
|
|
|
|
|
|
+ onFooOnce: fn,
|
|
|
|
|
+ onBarOnce: barFn
|
|
|
}),
|
|
}),
|
|
|
nodeOps.createElement('div')
|
|
nodeOps.createElement('div')
|
|
|
)
|
|
)
|
|
|
expect(fn).toHaveBeenCalledTimes(1)
|
|
expect(fn).toHaveBeenCalledTimes(1)
|
|
|
|
|
+ expect(barFn).toHaveBeenCalledTimes(1)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
test('.once with normal listener of the same name', () => {
|
|
test('.once with normal listener of the same name', () => {
|