chore: fix all test cases
This commit is contained in:
parent
68416e988f
commit
ff4d4ec249
@ -129,7 +129,7 @@ return function render(_ctx, _cache) {
|
|||||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue
|
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue
|
||||||
|
|
||||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||||
return _renderSlot($slots, \\"default\\")
|
return _renderSlot($slots, \\"default\\", {}, undefined, true)
|
||||||
}), 256 /* UNKEYED_FRAGMENT */))
|
}), 256 /* UNKEYED_FRAGMENT */))
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@ -143,7 +143,7 @@ return function render(_ctx, _cache) {
|
|||||||
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue
|
const { renderList: _renderList, Fragment: _Fragment, openBlock: _openBlock, createBlock: _createBlock, renderSlot: _renderSlot } = _Vue
|
||||||
|
|
||||||
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
return (_openBlock(true), _createBlock(_Fragment, null, _renderList(items, (item) => {
|
||||||
return _renderSlot($slots, \\"default\\")
|
return _renderSlot($slots, \\"default\\", {}, undefined, true)
|
||||||
}), 256 /* UNKEYED_FRAGMENT */))
|
}), 256 /* UNKEYED_FRAGMENT */))
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
@ -80,7 +80,7 @@ return function render(_ctx, _cache) {
|
|||||||
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
|
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
|
||||||
|
|
||||||
return ok
|
return ok
|
||||||
? _renderSlot($slots, \\"default\\", { key: 0 })
|
? _renderSlot($slots, \\"default\\", { key: 0 }, undefined, true)
|
||||||
: _createCommentVNode(\\"v-if\\", true)
|
: _createCommentVNode(\\"v-if\\", true)
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
@ -140,7 +140,7 @@ return function render(_ctx, _cache) {
|
|||||||
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
|
const { renderSlot: _renderSlot, createCommentVNode: _createCommentVNode } = _Vue
|
||||||
|
|
||||||
return ok
|
return ok
|
||||||
? _renderSlot($slots, \\"default\\", { key: 0 })
|
? _renderSlot($slots, \\"default\\", { key: 0 }, undefined, true)
|
||||||
: _createCommentVNode(\\"v-if\\", true)
|
: _createCommentVNode(\\"v-if\\", true)
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
@ -67,7 +67,7 @@ return function render(_ctx, _cache) {
|
|||||||
return (_openBlock(), _createBlock(\\"div\\", null, [
|
return (_openBlock(), _createBlock(\\"div\\", null, [
|
||||||
_cache[1] || (
|
_cache[1] || (
|
||||||
_setBlockTracking(-1),
|
_setBlockTracking(-1),
|
||||||
_cache[1] = _renderSlot($slots, \\"default\\"),
|
_cache[1] = _renderSlot($slots, \\"default\\", {}, undefined, true),
|
||||||
_setBlockTracking(1),
|
_setBlockTracking(1),
|
||||||
_cache[1]
|
_cache[1]
|
||||||
)
|
)
|
||||||
|
@ -16,6 +16,7 @@ import { transformSlotOutlet } from '../../src/transforms/transformSlotOutlet'
|
|||||||
function parseWithSlots(template: string, options: CompilerOptions = {}) {
|
function parseWithSlots(template: string, options: CompilerOptions = {}) {
|
||||||
const ast = parse(template)
|
const ast = parse(template)
|
||||||
transform(ast, {
|
transform(ast, {
|
||||||
|
slotted: false,
|
||||||
nodeTransforms: [
|
nodeTransforms: [
|
||||||
...(options.prefixIdentifiers ? [transformExpression] : []),
|
...(options.prefixIdentifiers ? [transformExpression] : []),
|
||||||
transformSlotOutlet,
|
transformSlotOutlet,
|
||||||
|
@ -404,7 +404,13 @@ describe('compiler: v-if', () => {
|
|||||||
expect(codegenNode.consequent).toMatchObject({
|
expect(codegenNode.consequent).toMatchObject({
|
||||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||||
callee: RENDER_SLOT,
|
callee: RENDER_SLOT,
|
||||||
arguments: ['$slots', '"default"', createObjectMatcher({ key: `[0]` })]
|
arguments: [
|
||||||
|
'$slots',
|
||||||
|
'"default"',
|
||||||
|
createObjectMatcher({ key: `[0]` }),
|
||||||
|
'undefined',
|
||||||
|
'true'
|
||||||
|
]
|
||||||
})
|
})
|
||||||
expect(generate(root).code).toMatchSnapshot()
|
expect(generate(root).code).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
@ -417,7 +423,13 @@ describe('compiler: v-if', () => {
|
|||||||
expect(codegenNode.consequent).toMatchObject({
|
expect(codegenNode.consequent).toMatchObject({
|
||||||
type: NodeTypes.JS_CALL_EXPRESSION,
|
type: NodeTypes.JS_CALL_EXPRESSION,
|
||||||
callee: RENDER_SLOT,
|
callee: RENDER_SLOT,
|
||||||
arguments: ['$slots', '"default"', createObjectMatcher({ key: `[0]` })]
|
arguments: [
|
||||||
|
'$slots',
|
||||||
|
'"default"',
|
||||||
|
createObjectMatcher({ key: `[0]` }),
|
||||||
|
'undefined',
|
||||||
|
'true'
|
||||||
|
]
|
||||||
})
|
})
|
||||||
expect(generate(root).code).toMatchSnapshot()
|
expect(generate(root).code).toMatchSnapshot()
|
||||||
})
|
})
|
||||||
|
@ -6,7 +6,8 @@ import {
|
|||||||
openBlock,
|
openBlock,
|
||||||
createBlock,
|
createBlock,
|
||||||
Fragment,
|
Fragment,
|
||||||
createCommentVNode
|
createCommentVNode,
|
||||||
|
Slot
|
||||||
} from '../../src'
|
} from '../../src'
|
||||||
import { PatchFlags } from '@vue/shared'
|
import { PatchFlags } from '@vue/shared'
|
||||||
|
|
||||||
@ -38,7 +39,7 @@ describe('renderSlot', () => {
|
|||||||
},
|
},
|
||||||
// mock instance
|
// mock instance
|
||||||
{ type: {} } as any
|
{ type: {} } as any
|
||||||
)
|
) as Slot
|
||||||
|
|
||||||
// manual invocation should not track
|
// manual invocation should not track
|
||||||
const manual = (openBlock(), createBlock(Fragment, null, slot()))
|
const manual = (openBlock(), createBlock(Fragment, null, slot()))
|
||||||
|
Loading…
Reference in New Issue
Block a user