@@ -31,13 +31,7 @@ describe('compiler: v-if', () => {
31
31
expect ( vaporHelpers ) . contains ( 'createIf' )
32
32
expect ( helpers . size ) . toBe ( 0 )
33
33
34
- expect ( ir . template ) . lengthOf ( 1 )
35
- expect ( ir . template ) . toMatchObject ( [
36
- {
37
- template : '<div></div>' ,
38
- type : IRNodeTypes . TEMPLATE_FACTORY ,
39
- } ,
40
- ] )
34
+ expect ( ir . template ) . toEqual ( [ '<div></div>' ] )
41
35
expect ( ir . operation ) . toMatchObject ( [
42
36
{
43
37
type : IRNodeTypes . IF ,
@@ -72,13 +66,7 @@ describe('compiler: v-if', () => {
72
66
)
73
67
expect ( code ) . matchSnapshot ( )
74
68
75
- expect ( ir . template ) . lengthOf ( 1 )
76
- expect ( ir . template ) . toMatchObject ( [
77
- {
78
- template : '<div></div>hello<p></p>' ,
79
- type : IRNodeTypes . TEMPLATE_FACTORY ,
80
- } ,
81
- ] )
69
+ expect ( ir . template ) . toEqual ( [ '<div></div>hello<p></p>' ] )
82
70
83
71
expect ( ir . effect ) . toEqual ( [ ] )
84
72
expect ( ( ir . operation [ 0 ] as IfIRNode ) . positive . effect ) . toMatchObject ( [
@@ -109,13 +97,7 @@ describe('compiler: v-if', () => {
109
97
`<div v-if="ok">hello</div><div v-if="ok">hello</div>` ,
110
98
)
111
99
expect ( code ) . matchSnapshot ( )
112
- expect ( ir . template ) . lengthOf ( 1 )
113
- expect ( ir . template ) . toMatchObject ( [
114
- {
115
- template : '<div>hello</div>' ,
116
- type : 2 ,
117
- } ,
118
- ] )
100
+ expect ( ir . template ) . toEqual ( [ '<div>hello</div>' ] )
119
101
expect ( ir . returns ) . toEqual ( [ 1 , 3 ] )
120
102
} )
121
103
@@ -127,17 +109,7 @@ describe('compiler: v-if', () => {
127
109
`<div v-if="ok"/><p v-else/>` ,
128
110
)
129
111
expect ( code ) . matchSnapshot ( )
130
- expect ( ir . template ) . lengthOf ( 2 )
131
- expect ( ir . template ) . toMatchObject ( [
132
- {
133
- template : '<div></div>' ,
134
- type : IRNodeTypes . TEMPLATE_FACTORY ,
135
- } ,
136
- {
137
- template : '<p></p>' ,
138
- type : IRNodeTypes . TEMPLATE_FACTORY ,
139
- } ,
140
- ] )
112
+ expect ( ir . template ) . toEqual ( [ '<div></div>' , '<p></p>' ] )
141
113
142
114
expect ( vaporHelpers ) . contains ( 'createIf' )
143
115
expect ( ir . effect ) . lengthOf ( 0 )
@@ -169,17 +141,7 @@ describe('compiler: v-if', () => {
169
141
`<div v-if="ok"/><p v-else-if="orNot"/>` ,
170
142
)
171
143
expect ( code ) . matchSnapshot ( )
172
- expect ( ir . template ) . lengthOf ( 2 )
173
- expect ( ir . template ) . toMatchObject ( [
174
- {
175
- template : '<div></div>' ,
176
- type : IRNodeTypes . TEMPLATE_FACTORY ,
177
- } ,
178
- {
179
- template : '<p></p>' ,
180
- type : IRNodeTypes . TEMPLATE_FACTORY ,
181
- } ,
182
- ] )
144
+ expect ( ir . template ) . toEqual ( [ '<div></div>' , '<p></p>' ] )
183
145
184
146
expect ( ir . operation ) . toMatchObject ( [
185
147
{
@@ -216,21 +178,7 @@ describe('compiler: v-if', () => {
216
178
`<div v-if="ok"/><p v-else-if="orNot"/><template v-else>fine</template>` ,
217
179
)
218
180
expect ( code ) . matchSnapshot ( )
219
- expect ( ir . template ) . lengthOf ( 3 )
220
- expect ( ir . template ) . toMatchObject ( [
221
- {
222
- template : '<div></div>' ,
223
- type : IRNodeTypes . TEMPLATE_FACTORY ,
224
- } ,
225
- {
226
- template : '<p></p>' ,
227
- type : IRNodeTypes . TEMPLATE_FACTORY ,
228
- } ,
229
- {
230
- template : 'fine' ,
231
- type : IRNodeTypes . TEMPLATE_FACTORY ,
232
- } ,
233
- ] )
181
+ expect ( ir . template ) . toEqual ( [ '<div></div>' , '<p></p>' , 'fine' ] )
234
182
235
183
expect ( ir . returns ) . toEqual ( [ 1 ] )
236
184
expect ( ir . operation ) . toMatchObject ( [
@@ -266,24 +214,12 @@ describe('compiler: v-if', () => {
266
214
<input v-text="text" />
267
215
` )
268
216
expect ( code ) . matchSnapshot ( )
269
- expect ( ir . template ) . lengthOf ( 4 )
270
- expect ( ir . template ) . toMatchObject ( [
271
- {
272
- template : '<div></div>' ,
273
- type : IRNodeTypes . TEMPLATE_FACTORY ,
274
- } ,
275
- {
276
- template : '<!--foo--><p></p>' ,
277
- type : IRNodeTypes . TEMPLATE_FACTORY ,
278
- } ,
279
- {
280
- template : '<!--bar-->fine' ,
281
- type : IRNodeTypes . TEMPLATE_FACTORY ,
282
- } ,
283
- {
284
- type : IRNodeTypes . TEMPLATE_FACTORY ,
285
- template : '<input>' ,
286
- } ,
217
+ expect ( ir . template ) . toEqual ( [
218
+ '<div></div>' ,
219
+ '<!--foo--><p></p>' ,
220
+ '<!--bar-->fine' ,
221
+
222
+ '<input>' ,
287
223
] )
288
224
} )
289
225
0 commit comments