diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/vFor.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/vFor.spec.ts.snap index aa98188d..860db2b2 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/vFor.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/vFor.spec.ts.snap @@ -129,7 +129,7 @@ return function render(_ctx, _cache) { const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => { - return _renderSlot($slots, \\"default\\") + return _renderSlot($slots, \\"default\\", {}, undefined, true) }), 256 /* UNKEYED_FRAGMENT */)) } }" @@ -143,7 +143,7 @@ return function render(_ctx, _cache) { const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => { - return _renderSlot($slots, \\"default\\") + return _renderSlot($slots, \\"default\\", {}, undefined, true) }), 256 /* UNKEYED_FRAGMENT */)) } }" diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/vIf.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/vIf.spec.ts.snap index def7f945..ec8bf762 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/vIf.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/vIf.spec.ts.snap @@ -80,7 +80,7 @@ return function render(_ctx, _cache) { const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue return ok - ? _renderSlot($slots, \\"default\\", { key: 0 }) + ? _renderSlot($slots, \\"default\\", { key: 0 }, undefined, true) : _createCommentVNode(\\"v-if\\", true) } }" @@ -140,7 +140,7 @@ return function render(_ctx, _cache) { const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue return ok - ? _renderSlot($slots, \\"default\\", { key: 0 }) + ? _renderSlot($slots, \\"default\\", { key: 0 }, undefined, true) : _createCommentVNode(\\"v-if\\", true) } }" diff --git a/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap b/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap index 1fc484fe..aadd8143 100644 --- a/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap +++ b/packages/compiler-core/__tests__/transforms/__snapshots__/vOnce.spec.ts.snap @@ -67,7 +67,7 @@ return function render(_ctx, _cache) { return (_openBlock(), _createBlock(\\"div\\", null, [ _cache[1] || ( _setBlockTracking(-1), - _cache[1] = _renderSlot($slots, \\"default\\"), + _cache[1] = _renderSlot($slots, \\"default\\", {}, undefined, true), _setBlockTracking(1), _cache[1] ) diff --git a/packages/compiler-core/__tests__/transforms/transformSlotOutlet.spec.ts b/packages/compiler-core/__tests__/transforms/transformSlotOutlet.spec.ts index 1a4ea3da..3cfa8d07 100644 --- a/packages/compiler-core/__tests__/transforms/transformSlotOutlet.spec.ts +++ b/packages/compiler-core/__tests__/transforms/transformSlotOutlet.spec.ts @@ -16,6 +16,7 @@ import { transformSlotOutlet } from '../../src/transforms/transformSlotOutlet' function parseWithSlots(template: string, options: CompilerOptions = {}) { const ast = parse(template) transform(ast, { + slotted: false, nodeTransforms: [ ...(options.prefixIdentifiers ? [transformExpression] : []), transformSlotOutlet, diff --git a/packages/compiler-core/__tests__/transforms/vIf.spec.ts b/packages/compiler-core/__tests__/transforms/vIf.spec.ts index f1b91cc4..846a4d9a 100644 --- a/packages/compiler-core/__tests__/transforms/vIf.spec.ts +++ b/packages/compiler-core/__tests__/transforms/vIf.spec.ts @@ -404,7 +404,13 @@ describe('compiler: v-if', () => { expect(codegenNode.consequent).toMatchObject({ type: NodeTypes.JS_CALL_EXPRESSION, callee: RENDER_SLOT, - arguments: ['$slots', '"default"', createObjectMatcher({ key: `[0]` })] + arguments: [ + '$slots', + '"default"', + createObjectMatcher({ key: `[0]` }), + 'undefined', + 'true' + ] }) expect(generate(root).code).toMatchSnapshot() }) @@ -417,7 +423,13 @@ describe('compiler: v-if', () => { expect(codegenNode.consequent).toMatchObject({ type: NodeTypes.JS_CALL_EXPRESSION, callee: RENDER_SLOT, - arguments: ['$slots', '"default"', createObjectMatcher({ key: `[0]` })] + arguments: [ + '$slots', + '"default"', + createObjectMatcher({ key: `[0]` }), + 'undefined', + 'true' + ] }) expect(generate(root).code).toMatchSnapshot() }) diff --git a/packages/runtime-core/__tests__/helpers/renderSlot.spec.ts b/packages/runtime-core/__tests__/helpers/renderSlot.spec.ts index 0cc8f3ba..14d20f13 100644 --- a/packages/runtime-core/__tests__/helpers/renderSlot.spec.ts +++ b/packages/runtime-core/__tests__/helpers/renderSlot.spec.ts @@ -6,7 +6,8 @@ import { openBlock, createBlock, Fragment, - createCommentVNode + createCommentVNode, + Slot } from '../../src' import { PatchFlags } from '@vue/shared' @@ -38,7 +39,7 @@ describe('renderSlot', () => { }, // mock instance { type: {} } as any - ) + ) as Slot // manual invocation should not track const manual = (openBlock(), createBlock(Fragment, null, slot()))