]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
test: add more tests
authordaiwei <daiwei521@126.com>
Fri, 24 Jan 2025 01:28:07 +0000 (09:28 +0800)
committerdaiwei <daiwei521@126.com>
Fri, 24 Jan 2025 01:28:07 +0000 (09:28 +0800)
packages/compiler-core/__tests__/transforms/vSkip.spec.ts
packages/compiler-core/src/errors.ts

index d1251ffeeebc2072dd350c2eaaf4a88776feef5b..6987fb5202272252f74becdb9d298e1436ad1545 100644 (file)
@@ -408,6 +408,21 @@ describe('compiler: v-skip', () => {
       ])
     })
 
+    test('on component with default slot and slot props', () => {
+      const onError = vi.fn()
+      parseWithSkipTransform(
+        `<Comp v-skip="ok">
+          <template #default="foo">foo</template>
+        </Comp>`,
+        { onError },
+      )
+      expect(onError.mock.calls[0]).toMatchObject([
+        {
+          code: ErrorCodes.X_V_SKIP_UNEXPECTED_SLOT,
+        },
+      ])
+    })
+
     test('with v-for', () => {
       const onError = vi.fn()
       parseWithSkipTransform(`<div v-for="i in items" v-skip="ok"/>`, {
index 048902be604eefcdf6fc1faae5ecb038250c534a..683981143e2c5cdbf227f2cc03955c1cf20b4c4c 100644 (file)
@@ -185,7 +185,7 @@ export const errorMessages: Record<ErrorCodes, string> = {
   [ErrorCodes.X_VNODE_HOOKS]: `@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.`,
   [ErrorCodes.X_V_SKIP_NO_EXPRESSION]: `v-skip is missing expression.`,
   [ErrorCodes.X_V_SKIP_ON_TEMPLATE]: `v-skip cannot be used on <template> or <slot> tags.`,
-  [ErrorCodes.X_V_SKIP_UNEXPECTED_SLOT]: `v-skip directive requires the component to have a default slot without slot props`,
+  [ErrorCodes.X_V_SKIP_UNEXPECTED_SLOT]: `v-skip requires the component to have a default slot without slot props`,
   [ErrorCodes.X_V_SKIP_WITH_V_FOR]: `v-skip with v-for is not supported.`,
 
   // generic errors