mirror of https://github.com/vuejs/core.git
chore(test): replace deprecated `initEvent` (#8490)
This commit is contained in:
parent
7c2e44ff5f
commit
736cf154cc
|
@ -6,8 +6,10 @@ function triggerEvent(
|
||||||
event: string,
|
event: string,
|
||||||
process?: (e: any) => any
|
process?: (e: any) => any
|
||||||
) {
|
) {
|
||||||
const e = document.createEvent('HTMLEvents')
|
const e = new Event(event, {
|
||||||
e.initEvent(event, true, true)
|
bubbles: true,
|
||||||
|
cancelable: true
|
||||||
|
})
|
||||||
if (event === 'click') {
|
if (event === 'click') {
|
||||||
;(e as any).button = 0
|
;(e as any).button = 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,10 @@ export function triggerEvent(
|
||||||
event: string,
|
event: string,
|
||||||
process?: (e: any) => any
|
process?: (e: any) => any
|
||||||
) {
|
) {
|
||||||
const e = document.createEvent('HTMLEvents')
|
const e = new Event(event, {
|
||||||
e.initEvent(event, true, true)
|
bubbles: true,
|
||||||
|
cancelable: true
|
||||||
|
})
|
||||||
if (process) process(e)
|
if (process) process(e)
|
||||||
target.dispatchEvent(e)
|
target.dispatchEvent(e)
|
||||||
return e
|
return e
|
||||||
|
|
Loading…
Reference in New Issue