Skip to content

Commit

Permalink
chore: fix all test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Mar 5, 2021
1 parent 68416e9 commit ff4d4ec
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 */))
}
}"
Expand All @@ -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 */))
}
}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}"
Expand Down Expand Up @@ -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)
}
}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 14 additions & 2 deletions packages/compiler-core/__tests__/transforms/vIf.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand All @@ -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()
})
Expand Down
5 changes: 3 additions & 2 deletions packages/runtime-core/__tests__/helpers/renderSlot.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
openBlock,
createBlock,
Fragment,
createCommentVNode
createCommentVNode,
Slot
} from '../../src'
import { PatchFlags } from '@vue/shared'

Expand Down Expand Up @@ -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()))
Expand Down

0 comments on commit ff4d4ec

Please sign in to comment.