@@ -111,23 +111,38 @@ describe('ssr: slot', () => {
111111 } )
112112
113113 test ( 'transition slot' , async ( ) => {
114+ const ReusableTransition = {
115+ template : `<transition><slot/></transition>` ,
116+ }
117+
118+ const ReusableTransitionWithAppear = {
119+ template : `<transition appear><slot/></transition>` ,
120+ }
121+
114122 expect (
115123 await renderToString (
116124 createApp ( {
117125 components : {
118- one : {
119- template : `<transition><slot/></transition>` ,
120- } ,
126+ one : ReusableTransition ,
121127 } ,
122128 template : `<one><div v-if="false">foo</div></one>` ,
123129 } ) ,
124130 ) ,
125131 ) . toBe ( `<!---->` )
126132
133+ expect ( await renderToString ( createApp ( ReusableTransition ) ) ) . toBe ( `<!---->` )
134+
135+ expect ( await renderToString ( createApp ( ReusableTransitionWithAppear ) ) ) . toBe (
136+ `<template><!----></template>` ,
137+ )
138+
127139 expect (
128140 await renderToString (
129141 createApp ( {
130- template : `<transition><slot/></transition>` ,
142+ components : {
143+ one : ReusableTransition ,
144+ } ,
145+ template : `<one><slot/></one>` ,
131146 } ) ,
132147 ) ,
133148 ) . toBe ( `<!---->` )
@@ -136,43 +151,66 @@ describe('ssr: slot', () => {
136151 await renderToString (
137152 createApp ( {
138153 components : {
139- one : {
140- template : `<transition><slot/></transition>` ,
141- } ,
154+ one : ReusableTransitionWithAppear ,
142155 } ,
143156 template : `<one><slot/></one>` ,
144157 } ) ,
145158 ) ,
159+ ) . toBe ( `<template><!----></template>` )
160+
161+ expect (
162+ await renderToString (
163+ createApp ( {
164+ render ( ) {
165+ return h ( ReusableTransition , null , {
166+ default : ( ) => null ,
167+ } )
168+ } ,
169+ } ) ,
170+ ) ,
146171 ) . toBe ( `<!---->` )
147172
148173 expect (
149174 await renderToString (
150175 createApp ( {
151- template : `<transition appear><slot/></transition>` ,
176+ render ( ) {
177+ return h ( ReusableTransitionWithAppear , null , {
178+ default : ( ) => null ,
179+ } )
180+ } ,
152181 } ) ,
153182 ) ,
154183 ) . toBe ( `<template><!----></template>` )
155184
156185 expect (
157186 await renderToString (
158187 createApp ( {
159- components : {
160- one : {
161- template : `<transition appear><slot/></transition>` ,
162- } ,
188+ render ( ) {
189+ return h ( ReusableTransitionWithAppear , null , {
190+ default : ( ) => [ ] ,
191+ } )
163192 } ,
164- template : `<one><slot/></one>` ,
165193 } ) ,
166194 ) ,
167195 ) . toBe ( `<template><!----></template>` )
168196
197+ expect (
198+ await renderToString (
199+ createApp ( {
200+ render ( ) {
201+ return h ( ReusableTransition , null , {
202+ default : ( ) => [ ] ,
203+ } )
204+ } ,
205+ } ) ,
206+ ) ,
207+ ) . toBe ( `<!---->` )
208+
169209 expect (
170210 await renderToString (
171211 createApp ( {
172212 components : {
173- one : {
174- template : `<transition><slot/></transition>` ,
175- } ,
213+ one : ReusableTransition ,
176214 } ,
177215 template : `<one><div v-if="true">foo</div></one>` ,
178216 } ) ,
0 commit comments