@@ -573,17 +573,17 @@ describeWithMountingMethods('options.slots', mountingMethod => {
573
573
574
574
itDoNotRunIf (
575
575
mountingMethod . name === 'renderToString' ,
576
- 'sets a component which can access the parent component' ,
576
+ 'sets a component which can access the parent component and the child component ' ,
577
577
( ) => {
578
578
const localVue = createLocalVue ( )
579
579
localVue . prototype . bar = 'FOO'
580
- const wrapperComponent = mount (
580
+ const ParentComponent = mount (
581
581
{
582
582
name : 'parentComponent' ,
583
583
template : '<div><slot /></div>' ,
584
584
data ( ) {
585
585
return {
586
- childName : ''
586
+ childComponentName : ''
587
587
}
588
588
}
589
589
} ,
@@ -592,13 +592,19 @@ describeWithMountingMethods('options.slots', mountingMethod => {
592
592
ComponentWithParentName
593
593
} ,
594
594
slots : {
595
- default : '<component-with-parent-name :foo="bar" />'
595
+ default : [
596
+ '<component-with-parent-name :fromLocalVue="bar" />' ,
597
+ '<component-with-parent-name :fromLocalVue="bar" />'
598
+ ]
596
599
} ,
597
600
localVue
598
601
}
599
602
)
600
- expect ( wrapperComponent . vm . childName ) . to . equal ( 'component-with-parent-name' )
601
- expect ( wrapperComponent . html ( ) ) . to . equal ( '<div><div foo="FOO"><span baz="qux">quux</span></div></div>' )
603
+ const childComponentName = 'component-with-parent-name'
604
+ expect ( ParentComponent . vm . childComponentName ) . to . equal ( childComponentName )
605
+ expect ( ParentComponent . vm . $children . length ) . to . equal ( 2 )
606
+ expect ( ParentComponent . vm . $children . every ( c => c . $options . name === childComponentName ) ) . to . equal ( true )
607
+ expect ( ParentComponent . html ( ) ) . to . equal ( '<div><div><span baz="qux">FOO,quux</span></div><div><span baz="qux">FOO,quux</span></div></div>' )
602
608
}
603
609
)
604
610
} )
0 commit comments