@@ -573,17 +573,17 @@ describeWithMountingMethods('options.slots', mountingMethod => {
573573
574574 itDoNotRunIf (
575575 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 ' ,
577577 ( ) => {
578578 const localVue = createLocalVue ( )
579579 localVue . prototype . bar = 'FOO'
580- const wrapperComponent = mount (
580+ const ParentComponent = mount (
581581 {
582582 name : 'parentComponent' ,
583583 template : '<div><slot /></div>' ,
584584 data ( ) {
585585 return {
586- childName : ''
586+ childComponentName : ''
587587 }
588588 }
589589 } ,
@@ -592,13 +592,19 @@ describeWithMountingMethods('options.slots', mountingMethod => {
592592 ComponentWithParentName
593593 } ,
594594 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+ ]
596599 } ,
597600 localVue
598601 }
599602 )
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>' )
602608 }
603609 )
604610} )
0 commit comments