Function
triggerEvent
(
target: Element,
event: string,
process?: (e: any) => any,
)
Source from the content-addressed store, hash-verified
| 2 | import { withKeys, withModifiers } from '@vue/runtime-dom' |
| 3 | |
| 4 | function triggerEvent( |
| 5 | target: Element, |
| 6 | event: string, |
| 7 | process?: (e: any) => any, |
| 8 | ) { |
| 9 | const e = new Event(event, { |
| 10 | bubbles: true, |
| 11 | cancelable: true, |
| 12 | }) |
| 13 | if (event === 'click') { |
| 14 | ;(e as any).button = 0 |
| 15 | } |
| 16 | if (process) process(e) |
| 17 | target.dispatchEvent(e) |
| 18 | return e |
| 19 | } |
| 20 | |
| 21 | describe('runtime-dom: v-on directive', () => { |
| 22 | test('it should support "stop" and "prevent"', () => { |
Tested by
no test coverage detected