From 1d49d53d07835d49c640957032b2f06378bd5086 Mon Sep 17 00:00:00 2001 From: daiwei Date: Fri, 24 Jan 2025 09:28:07 +0800 Subject: [PATCH] test: add more tests --- .../__tests__/transforms/vSkip.spec.ts | 15 +++++++++++++++ packages/compiler-core/src/errors.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/compiler-core/__tests__/transforms/vSkip.spec.ts b/packages/compiler-core/__tests__/transforms/vSkip.spec.ts index d1251ffeeeb..6987fb52022 100644 --- a/packages/compiler-core/__tests__/transforms/vSkip.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vSkip.spec.ts @@ -408,6 +408,21 @@ describe('compiler: v-skip', () => { ]) }) + test('on component with default slot and slot props', () => { + const onError = vi.fn() + parseWithSkipTransform( + ` + + `, + { onError }, + ) + expect(onError.mock.calls[0]).toMatchObject([ + { + code: ErrorCodes.X_V_SKIP_UNEXPECTED_SLOT, + }, + ]) + }) + test('with v-for', () => { const onError = vi.fn() parseWithSkipTransform(`
`, { diff --git a/packages/compiler-core/src/errors.ts b/packages/compiler-core/src/errors.ts index 048902be604..683981143e2 100644 --- a/packages/compiler-core/src/errors.ts +++ b/packages/compiler-core/src/errors.ts @@ -185,7 +185,7 @@ export const errorMessages: Record = { [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