@@ -61,9 +61,9 @@ describe('Component slot', () => {
61
61
` ,
62
62
parentContent : '<p slot="b">slot b</p>'
63
63
} )
64
- expect ( child . $el . childNodes . length ) . toBe ( 2 )
65
- expect ( child . $el . firstChild . textContent ) . toBe ( 'fallback a' )
66
- expect ( child . $el . lastChild . textContent ) . toBe ( 'slot b' )
64
+ expect ( child . $el . children . length ) . toBe ( 2 )
65
+ expect ( child . $el . children [ 0 ] . textContent ) . toBe ( 'fallback a' )
66
+ expect ( child . $el . children [ 1 ] . textContent ) . toBe ( 'slot b' )
67
67
} )
68
68
69
69
it ( 'fallback content with mixed named/unamed slots' , ( ) => {
@@ -76,9 +76,9 @@ describe('Component slot', () => {
76
76
` ,
77
77
parentContent : '<p slot="b">slot b</p>'
78
78
} )
79
- expect ( child . $el . childNodes . length ) . toBe ( 2 )
80
- expect ( child . $el . firstChild . textContent ) . toBe ( 'fallback a' )
81
- expect ( child . $el . lastChild . textContent ) . toBe ( 'slot b' )
79
+ expect ( child . $el . children . length ) . toBe ( 2 )
80
+ expect ( child . $el . children [ 0 ] . textContent ) . toBe ( 'fallback a' )
81
+ expect ( child . $el . children [ 1 ] . textContent ) . toBe ( 'slot b' )
82
82
} )
83
83
84
84
it ( 'selector matching multiple elements' , ( ) => {
@@ -100,16 +100,16 @@ describe('Component slot', () => {
100
100
` ,
101
101
parentContent : '<div>foo</div><p slot="a">1</p><p slot="b">2</p>'
102
102
} )
103
- expect ( child . $el . innerHTML ) . toBe ( '<p>1</p><div>foo</div><p>2</p>' )
103
+ expect ( child . $el . innerHTML ) . toBe ( '<p>1</p> <div>foo</div> <p>2</p>' )
104
104
} )
105
105
106
106
it ( 'name should only match children' , function ( ) {
107
107
mount ( {
108
108
childTemplate : `
109
109
<div>
110
110
<slot name="a"><p>fallback a</p></slot>
111
- <slot name="b">fallback b</slot>
112
- <slot name="c">fallback c</slot>
111
+ <slot name="b"><p> fallback b</p> </slot>
112
+ <slot name="c"><p> fallback c</p> </slot>
113
113
</div>
114
114
` ,
115
115
parentContent : `
@@ -118,10 +118,10 @@ describe('Component slot', () => {
118
118
'<span><p slot="c">nested c</p></span>
119
119
`
120
120
} )
121
- expect ( child . $el . childNodes . length ) . toBe ( 3 )
122
- expect ( child . $el . firstChild . textContent ) . toBe ( 'fallback a' )
123
- expect ( child . $el . childNodes [ 1 ] . textContent ) . toBe ( 'select b' )
124
- expect ( child . $el . lastChild . textContent ) . toBe ( 'fallback c' )
121
+ expect ( child . $el . children . length ) . toBe ( 3 )
122
+ expect ( child . $el . children [ 0 ] . textContent ) . toBe ( 'fallback a' )
123
+ expect ( child . $el . children [ 1 ] . textContent ) . toBe ( 'select b' )
124
+ expect ( child . $el . children [ 2 ] . textContent ) . toBe ( 'fallback c' )
125
125
} )
126
126
127
127
it ( 'should accept expressions in slot attribute and slot names' , ( ) => {
0 commit comments