@@ -280,46 +280,92 @@ describe('ssr: components', () => {
280280 ` )
281281 } )
282282
283- test ( 'built-in fallthroughs' , ( ) => {
284- expect ( compile ( `<transition><div/></transition>` ) . code )
285- . toMatchInlineSnapshot ( `
286- "const { ssrRenderAttrs: _ssrRenderAttrs } = require(\\"vue/server-renderer\\")
283+ describe ( 'built-in fallthroughs' , ( ) => {
284+ test ( 'transition' , ( ) => {
285+ expect ( compile ( `<transition><div/></transition>` ) . code )
286+ . toMatchInlineSnapshot ( `
287+ "const { ssrRenderAttrs: _ssrRenderAttrs } = require(\\"vue/server-renderer\\")
288+
289+ return function ssrRender(_ctx, _push, _parent, _attrs) {
290+ _push(\`<div\${_ssrRenderAttrs(_attrs)}></div>\`)
291+ }"
292+ ` )
293+ } )
287294
288- return function ssrRender(_ctx, _push, _parent, _attrs) {
289- _push(\`<div\${_ssrRenderAttrs(_attrs)}></div>\`)
290- }"
291- ` )
295+ test ( 'keep-alive' , ( ) => {
296+ expect ( compile ( `<keep-alive><foo/></keep-alive>` ) . code )
297+ . toMatchInlineSnapshot ( `
298+ "const { resolveComponent: _resolveComponent } = require(\\"vue\\")
299+ const { ssrRenderComponent: _ssrRenderComponent } = require(\\"vue/server-renderer\\")
292300
293- // should inject attrs if root with coomments
294- expect ( compile ( `<!--root--><transition><div/></transition>` ) . code )
295- . toMatchInlineSnapshot ( `
296- "const { ssrRenderAttrs: _ssrRenderAttrs } = require(\\"vue/server-renderer\\")
301+ return function ssrRender(_ctx, _push, _parent, _attrs) {
302+ const _component_foo = _resolveComponent(\\"foo\\")
297303
298- return function ssrRender(_ctx, _push, _parent, _attrs) {
299- _push(\`<!--[--><!--root--><div\${_ssrRenderAttrs(_attrs)}></div><!--]-->\`)
300- }"
301- ` )
304+ _push(_ssrRenderComponent(_component_foo, _attrs, null, _parent))
305+ }"
306+ ` )
307+ } )
302308
303- // should not inject attrs if not root
304- expect ( compile ( `<div/><transition><div/></transition>` ) . code )
305- . toMatchInlineSnapshot ( `
306- "
307- return function ssrRender(_ctx, _push, _parent, _attrs) {
308- _push(\`<!--[--><div></div><div></div><!--]-->\`)
309- }"
310- ` )
309+ test ( 'should inject attrs if root with coomments' , ( ) => {
310+ expect ( compile ( `<!--root--><transition><div/></transition>` ) . code )
311+ . toMatchInlineSnapshot ( `
312+ "const { ssrRenderAttrs: _ssrRenderAttrs } = require(\\"vue/server-renderer\\")
311313
312- expect ( compile ( `<keep-alive><foo/></keep-alive>` ) . code )
313- . toMatchInlineSnapshot ( `
314- "const { resolveComponent: _resolveComponent } = require(\\"vue\\")
315- const { ssrRenderComponent: _ssrRenderComponent } = require(\\"vue/server-renderer\\")
314+ return function ssrRender(_ctx, _push, _parent, _attrs) {
315+ _push(\`<!--[--><!--root--><div\${_ssrRenderAttrs(_attrs)}></div><!--]-->\`)
316+ }"
317+ ` )
318+ } )
316319
317- return function ssrRender(_ctx, _push, _parent, _attrs) {
318- const _component_foo = _resolveComponent(\\"foo\\")
320+ test ( 'should not inject attrs if not root' , ( ) => {
321+ expect ( compile ( `<div/><transition><div/></transition>` ) . code )
322+ . toMatchInlineSnapshot ( `
323+ "
324+ return function ssrRender(_ctx, _push, _parent, _attrs) {
325+ _push(\`<!--[--><div></div><div></div><!--]-->\`)
326+ }"
327+ ` )
328+ } )
319329
320- _push(_ssrRenderComponent(_component_foo, _attrs, null, _parent))
321- }"
322- ` )
330+ // #5352
331+ test ( 'should push marker string if is slot root' , ( ) => {
332+ expect (
333+ compile ( `<foo><transition><div v-if="false"/></transition></foo>` )
334+ . code
335+ ) . toMatchInlineSnapshot ( `
336+ "const { resolveComponent: _resolveComponent, withCtx: _withCtx, openBlock: _openBlock, createBlock: _createBlock, createCommentVNode: _createCommentVNode, Transition: _Transition, createVNode: _createVNode } = require(\\"vue\\")
337+ const { ssrRenderComponent: _ssrRenderComponent } = require(\\"vue/server-renderer\\")
338+
339+ return function ssrRender(_ctx, _push, _parent, _attrs) {
340+ const _component_foo = _resolveComponent(\\"foo\\")
341+
342+ _push(_ssrRenderComponent(_component_foo, _attrs, {
343+ default: _withCtx((_, _push, _parent, _scopeId) => {
344+ if (_push) {
345+ _push(\`\`)
346+ if (false) {
347+ _push(\`<div\${_scopeId}></div>\`)
348+ } else {
349+ _push(\`<!---->\`)
350+ }
351+ } else {
352+ return [
353+ _createVNode(_Transition, null, {
354+ default: _withCtx(() => [
355+ false
356+ ? (_openBlock(), _createBlock(\\"div\\", { key: 0 }))
357+ : _createCommentVNode(\\"v-if\\", true)
358+ ]),
359+ _: 1 /* STABLE */
360+ })
361+ ]
362+ }
363+ }),
364+ _: 1 /* STABLE */
365+ }, _parent))
366+ }"
367+ ` )
368+ } )
323369 } )
324370
325371 // transition-group should flatten and concat its children fragments into
0 commit comments