]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: fix runtime-dom v-on test
authorEvan You <yyx990803@gmail.com>
Tue, 7 Apr 2020 15:41:48 +0000 (11:41 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 7 Apr 2020 15:41:48 +0000 (11:41 -0400)
packages/runtime-dom/__tests__/directives/vOn.spec.ts

index a9d3271333180968b2d870832c120f87f0109d3d..4b9c14716e2a5495ede60013e956f7169c79513a 100644 (file)
@@ -22,9 +22,9 @@ describe('runtime-dom: v-on directive', () => {
     const child = document.createElement('input')
     parent.appendChild(child)
     const childNextValue = withModifiers(jest.fn(), ['prevent', 'stop'])
-    patchEvent(child, 'click', null, childNextValue, null)
+    patchEvent(child, 'onClick', null, childNextValue, null)
     const parentNextValue = jest.fn()
-    patchEvent(parent, 'click', null, parentNextValue, null)
+    patchEvent(parent, 'onClick', null, parentNextValue, null)
     expect(triggerEvent(child, 'click').defaultPrevented).toBe(true)
     expect(parentNextValue).not.toBeCalled()
   })
@@ -35,7 +35,7 @@ describe('runtime-dom: v-on directive', () => {
     parent.appendChild(child)
     const fn = jest.fn()
     const handler = withModifiers(fn, ['self'])
-    patchEvent(parent, 'click', null, handler, null)
+    patchEvent(parent, 'onClick', null, handler, null)
     triggerEvent(child, 'click')
     expect(fn).not.toBeCalled()
   })
@@ -48,7 +48,7 @@ describe('runtime-dom: v-on directive', () => {
       'esc',
       'arrow-left'
     ])
-    patchEvent(el, 'keyup', null, nextValue, null)
+    patchEvent(el, 'onKeyup', null, nextValue, null)
 
     triggerEvent(el, 'keyup', e => (e.key = 'a'))
     expect(fn).not.toBeCalled()
@@ -77,7 +77,7 @@ describe('runtime-dom: v-on directive', () => {
     // Case 1: <div @keyup.exact="test"/>
     const fn1 = jest.fn()
     const next1 = withModifiers(fn1, ['exact'])
-    patchEvent(el, 'keyup', null, next1, null)
+    patchEvent(el, 'onKeyup', null, next1, null)
     triggerEvent(el, 'keyup')
     expect(fn1.mock.calls.length).toBe(1)
     triggerEvent(el, 'keyup', e => (e.ctrlKey = true))
@@ -85,7 +85,7 @@ describe('runtime-dom: v-on directive', () => {
     // Case 2: <div @keyup.ctrl.a.exact="test"/>
     const fn2 = jest.fn()
     const next2 = withKeys(withModifiers(fn2, ['ctrl', 'exact']), ['a'])
-    patchEvent(el, 'keyup', null, next2, null)
+    patchEvent(el, 'onKeyup', null, next2, null)
     triggerEvent(el, 'keyup', e => (e.key = 'a'))
     expect(fn2).not.toBeCalled()
     triggerEvent(el, 'keyup', e => {
@@ -109,7 +109,7 @@ describe('runtime-dom: v-on directive', () => {
       const el = document.createElement('div')
       const fn = jest.fn()
       const handler = withModifiers(fn, [button])
-      patchEvent(el, 'mousedown', null, handler, null)
+      patchEvent(el, 'onMousedown', null, handler, null)
       buttons.filter(b => b !== button).forEach(button => {
         triggerEvent(el, 'mousedown', e => (e.button = buttonCodes[button]))
       })