mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 13:21:35 +03:00
927df167d7
- Closes #8072 - Implement handlers for the corresponding buttons on the circular menu - Add missing icons and styles - Add functionality to match and extract ASTs # Important Notes None
20 lines
592 B
TypeScript
20 lines
592 B
TypeScript
import { type VueWrapper } from '@vue/test-utils'
|
|
import { nextTick } from 'vue'
|
|
|
|
// It is currently not feasible to use generics here, as the type of the component's emits
|
|
// is not exposed.
|
|
export function handleEmit(wrapper: VueWrapper<any>, event: string, fn: (...args: any[]) => void) {
|
|
let previousLength = 0
|
|
return {
|
|
async run() {
|
|
const emitted = wrapper.emitted(event)
|
|
if (!emitted) return
|
|
for (let i = previousLength; i < emitted.length; i += 1) {
|
|
fn(...emitted[i]!)
|
|
}
|
|
previousLength = emitted.length
|
|
await nextTick()
|
|
},
|
|
}
|
|
}
|