From: Evan You Date: Tue, 7 Apr 2020 15:41:48 +0000 (-0400) Subject: test: fix runtime-dom v-on test X-Git-Tag: v3.0.0-alpha.12~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f87d6b501eb71b8a9b9fdc725012e9b05b2e2bf1;p=thirdparty%2Fvuejs%2Fcore.git test: fix runtime-dom v-on test --- diff --git a/packages/runtime-dom/__tests__/directives/vOn.spec.ts b/packages/runtime-dom/__tests__/directives/vOn.spec.ts index a9d3271333..4b9c14716e 100644 --- a/packages/runtime-dom/__tests__/directives/vOn.spec.ts +++ b/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:
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:
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])) })