You’re browsing the documentation for Vue Test Utils for Vue v2.x and earlier.
To read docs for Vue Test Utils for Vue 3, click here.
emittedByOrder
Deprecation warning
emittedByOrder
is deprecated and will be removed in future releases.
Use wrapper.emitted
instead.
Return an Array containing custom events emitted by the Wrapper
vm
.
Returns:
Array<{ name: string, args: Array<any> }>
Example:
import { mount } from '@vue/test-utils'
const wrapper = mount(Component)
wrapper.vm.$emit('foo')
wrapper.vm.$emit('bar', 123)
/*
wrapper.emittedByOrder() returns the following Array:
[
{ name: 'foo', args: [] },
{ name: 'bar', args: [123] }
]
*/
// assert event emit order
expect(wrapper.emittedByOrder().map(e => e.name)).toEqual(['foo', 'bar'])