vue3-core/packages/vue-compat/__tests__/utils.ts

14 lines
239 B
TypeScript
Raw Normal View History

2021-04-30 04:21:55 +08:00
export function triggerEvent(
target: Element,
event: string,
process?: (e: any) => any
) {
const e = new Event(event, {
bubbles: true,
cancelable: true
})
2021-04-30 04:21:55 +08:00
if (process) process(e)
target.dispatchEvent(e)
return e
}