@@ -19,17 +19,25 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
1919 const wrapper = mountingMethod ( ComponentWithScopedSlots , {
2020 slots : { default : '<span>123</span>' } ,
2121 scopedSlots : {
22- 'foo' : '<p slot-scope="foo">{{foo.index}},{{foo.text}}</p>' ,
23- 'bar' : '<p slot-scope="bar">{{bar.text}},{{bar.index}}</p>'
22+ destructuring : '<p slot-scope="{ index, item }">{{index}},{{item}}</p>' ,
23+ list : '<p slot-scope="foo">{{foo.index}},{{foo.text}}</p>' ,
24+ single : '<p slot-scope="bar">{{bar.text}}</p>' ,
25+ noProps : '<p slot-scope="baz">baz</p>'
2426 }
2527 } )
28+ expect ( wrapper . find ( '#destructuring' ) . html ( ) ) . to . equal ( '<div id="destructuring"><p>0,1</p><p>1,2</p><p>2,3</p></div>' )
2629 expect ( wrapper . find ( '#slots' ) . html ( ) ) . to . equal ( '<div id="slots"><span>123</span></div>' )
27- expect ( wrapper . find ( '#foo' ) . html ( ) ) . to . equal ( '<div id="foo"><p>0,a1</p><p>1,a2</p><p>2,a3</p></div>' )
28- expect ( wrapper . find ( '#bar' ) . html ( ) ) . to . equal ( '<div id="bar"><p>A1,0</p><p>A2,1</p><p>A3,2</p></div>' )
30+ expect ( wrapper . find ( '#list' ) . html ( ) ) . to . equal ( '<div id="list"><p>0,a1</p><p>1,a2</p><p>2,a3</p></div>' )
31+ expect ( wrapper . find ( '#single' ) . html ( ) ) . to . equal ( '<div id="single"><p>abc</p></div>' )
32+ expect ( wrapper . find ( '#noProps' ) . html ( ) ) . to . equal ( '<div id="noProps"><p>baz</p></div>' )
33+ wrapper . vm . items = [ 4 , 5 , 6 ]
2934 wrapper . vm . foo = [ { text : 'b1' } , { text : 'b2' } , { text : 'b3' } ]
30- wrapper . vm . bar = [ { text : 'B1' } , { text : 'B2' } , { text : 'B3' } ]
31- expect ( wrapper . find ( '#foo' ) . html ( ) ) . to . equal ( '<div id="foo"><p>0,b1</p><p>1,b2</p><p>2,b3</p></div>' )
32- expect ( wrapper . find ( '#bar' ) . html ( ) ) . to . equal ( '<div id="bar"><p>B1,0</p><p>B2,1</p><p>B3,2</p></div>' )
35+ wrapper . vm . bar = 'ABC'
36+ expect ( wrapper . find ( '#destructuring' ) . html ( ) ) . to . equal ( '<div id="destructuring"><p>0,4</p><p>1,5</p><p>2,6</p></div>' )
37+ expect ( wrapper . find ( '#slots' ) . html ( ) ) . to . equal ( '<div id="slots"><span>123</span></div>' )
38+ expect ( wrapper . find ( '#list' ) . html ( ) ) . to . equal ( '<div id="list"><p>0,b1</p><p>1,b2</p><p>2,b3</p></div>' )
39+ expect ( wrapper . find ( '#single' ) . html ( ) ) . to . equal ( '<div id="single"><p>ABC</p></div>' )
40+ expect ( wrapper . find ( '#noProps' ) . html ( ) ) . to . equal ( '<div id="noProps"><p>baz</p></div>' )
3341 }
3442 )
3543
@@ -38,7 +46,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
3846 const fn = ( ) => {
3947 mountingMethod ( ComponentWithScopedSlots , {
4048 scopedSlots : {
41- 'foo' : '<template></template>'
49+ single : '<template></template>'
4250 }
4351 } )
4452 }
@@ -52,7 +60,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
5260 const fn = ( ) => {
5361 mountingMethod ( ComponentWithScopedSlots , {
5462 scopedSlots : {
55- 'foo' : '<p slot-scope="foo">{{foo.index}},{{foo.text}}</p>'
63+ list : '<p slot-scope="foo">{{foo.index}},{{foo.text}}</p>'
5664 }
5765 } )
5866 }
@@ -70,7 +78,7 @@ describeWithShallowAndMount('scopedSlots', (mountingMethod) => {
7078 const fn = ( ) => {
7179 mountingMethod ( ComponentWithScopedSlots , {
7280 scopedSlots : {
73- 'foo' : '<p slot-scope="foo">{{foo.index}},{{foo.text}}</p>'
81+ list : '<p slot-scope="foo">{{foo.index}},{{foo.text}}</p>'
7482 }
7583 } )
7684 }
0 commit comments