Преглед изворни кода

test: fix runtime-dom v-on test

Evan You пре 6 година
родитељ
комит
f87d6b501e
1 измењених фајлова са 7 додато и 7 уклоњено
  1. 7 7
      packages/runtime-dom/__tests__/directives/vOn.spec.ts

+ 7 - 7
packages/runtime-dom/__tests__/directives/vOn.spec.ts

@@ -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]))
       })