@@ -326,3 +326,99 @@ test('access cjs module default from es6', async () => {
326
326
await page . close ( ) ;
327
327
} ) ;
328
328
329
+
330
+
331
+ test ( 'nested with slot' , async ( ) => {
332
+
333
+ const { page, output, textContent } = await createPage ( {
334
+ files : {
335
+ ...defaultFiles ,
336
+ '/component.vue' : `
337
+ <template>
338
+ <foo><bar>test</bar></foo>
339
+ </template>
340
+ <script>
341
+ import foo from './foo.vue'
342
+ import bar from './bar.vue'
343
+
344
+ export default {
345
+ components: {
346
+ foo,
347
+ bar,
348
+ },
349
+ created: () => console.log('main created'),
350
+ mounted: () => console.log('main mounted'),
351
+ }
352
+ </script>
353
+ ` ,
354
+
355
+ '/foo.vue' : `
356
+ <template>
357
+ foo (<slot></slot>)
358
+ </template>
359
+ <script>
360
+ export default {
361
+ created: () => console.log('foo created'),
362
+ mounted: () => console.log('foo mounted'),
363
+ }
364
+ </script>
365
+ ` ,
366
+
367
+ '/bar.vue' : `
368
+ <template>
369
+ bar (<slot></slot>)
370
+ </template>
371
+ <script>
372
+ export default {
373
+ created: () => console.log('bar created'),
374
+ mounted: () => console.log('bar mounted'),
375
+ }
376
+ </script>
377
+ `
378
+ }
379
+ } ) ;
380
+
381
+ expect ( output . filter ( e => e . type === 'log' ) . map ( e => e . content ) . flat ( ) . join ( ',' ) ) . toBe ( 'main created,foo created,bar created,bar mounted,foo mounted,main mounted' ) ;
382
+
383
+ expect ( await page . content ( ) ) . toEqual ( expect . stringContaining ( 'foo ( bar (test) )' ) ) ;
384
+
385
+ await page . close ( ) ;
386
+ } ) ;
387
+
388
+
389
+
390
+ test . only ( 'should not hang' , async ( ) => {
391
+
392
+ const { page, output } = await createPage ( {
393
+ files : {
394
+ ...defaultFiles ,
395
+ '/component.vue' : `
396
+ <script>
397
+ import bar from '/foo.vue';
398
+
399
+ console.log('component');
400
+
401
+ export default {
402
+ }
403
+ </script>
404
+ ` ,
405
+
406
+ '/foo.vue' : `
407
+ <script>
408
+ import component from '/component.vue';
409
+
410
+ console.log('foo');
411
+
412
+ export default {
413
+ }
414
+ </script>
415
+ ` ,
416
+ }
417
+ } ) ;
418
+
419
+ await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
420
+
421
+ expect ( output . filter ( e => e . type === 'log' ) . map ( e => e . content ) . flat ( ) . join ( ',' ) ) . toBe ( 'component,foo' ) ;
422
+
423
+ await page . close ( ) ;
424
+ } ) ;
0 commit comments