@@ -169,10 +169,12 @@ describe('component: slots', () => {
169169 } )
170170
171171 test ( 'slot should be rendered correctly with slot props' , async ( ) => {
172+ const src = ref ( 'header' )
173+
172174 const Comp = defineVaporComponent ( ( ) => {
173175 const n0 = template ( '<div></div>' ) ( )
174176 insert (
175- createSlot ( 'header' , { title : ( ) => 'header' } ) ,
177+ createSlot ( 'header' , { title : ( ) => src . value } ) ,
176178 n0 as any as ParentNode ,
177179 )
178180 return n0
@@ -191,6 +193,10 @@ describe('component: slots', () => {
191193 } ) . render ( )
192194
193195 expect ( host . innerHTML ) . toBe ( '<div><h1>header</h1><!--slot--></div>' )
196+
197+ src . value = 'footer'
198+ await nextTick ( )
199+ expect ( host . innerHTML ) . toBe ( '<div><h1>footer</h1><!--slot--></div>' )
194200 } )
195201
196202 test ( 'dynamic slot props' , async ( ) => {
@@ -263,17 +269,23 @@ describe('component: slots', () => {
263269 $ : [
264270 ( ) => ( {
265271 name : 'header' ,
266- fn : ( props : any ) => template ( props . title ) ( ) ,
272+ fn : ( props : any ) => {
273+ const el = template ( '<h1></h1>' ) ( )
274+ renderEffect ( ( ) => {
275+ setText ( el , props . title )
276+ } )
277+ return el
278+ } ,
267279 } ) ,
268280 ] ,
269281 } )
270282 } ) . render ( )
271283
272- expect ( host . innerHTML ) . toBe ( '<div>header<!--slot--></div>' )
284+ expect ( host . innerHTML ) . toBe ( '<div><h1> header</h1> <!--slot--></div>' )
273285
274286 val . value = 'footer'
275287 await nextTick ( )
276- expect ( host . innerHTML ) . toBe ( '<div>footer<!--slot--></div>' )
288+ expect ( host . innerHTML ) . toBe ( '<div><h1> footer</h1> <!--slot--></div>' )
277289 } )
278290
279291 test ( 'dynamic slot outlet should be render correctly with slot props' , async ( ) => {
0 commit comments