]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test(compiler-core): add test case for v-on event case conversion
authorEvan You <yyx990803@gmail.com>
Tue, 6 Oct 2020 22:31:04 +0000 (18:31 -0400)
committerEvan You <yyx990803@gmail.com>
Tue, 6 Oct 2020 22:31:04 +0000 (18:31 -0400)
packages/compiler-core/__tests__/transforms/vOn.spec.ts

index 19c44c3daee455c259ac8a464dfe98819486ab3b..4f7cd6c17c4a34bfb8dcd3c5a0c7e55aa07c2485 100644 (file)
@@ -406,6 +406,22 @@ describe('compiler: transform v-on', () => {
     expect(onError).not.toHaveBeenCalled()
   })
 
+  test('case conversion for kebab-case events', () => {
+    const { node } = parseWithVOn(`<div v-on:foo-bar="onMount"/>`)
+    expect((node.codegenNode as VNodeCall).props).toMatchObject({
+      properties: [
+        {
+          key: {
+            content: `onFooBar`
+          },
+          value: {
+            content: `onMount`
+          }
+        }
+      ]
+    })
+  })
+
   test('case conversion for vnode hooks', () => {
     const { node } = parseWithVOn(`<div v-on:vnode-mounted="onMount"/>`)
     expect((node.codegenNode as VNodeCall).props).toMatchObject({