@@ -31,13 +31,7 @@ describe('compiler: v-if', () => {
3131 expect ( vaporHelpers ) . contains ( 'createIf' )
3232 expect ( helpers . size ) . toBe ( 0 )
3333
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>' ] )
4135 expect ( ir . operation ) . toMatchObject ( [
4236 {
4337 type : IRNodeTypes . IF ,
@@ -72,13 +66,7 @@ describe('compiler: v-if', () => {
7266 )
7367 expect ( code ) . matchSnapshot ( )
7468
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>' ] )
8270
8371 expect ( ir . effect ) . toEqual ( [ ] )
8472 expect ( ( ir . operation [ 0 ] as IfIRNode ) . positive . effect ) . toMatchObject ( [
@@ -109,13 +97,7 @@ describe('compiler: v-if', () => {
10997 `<div v-if="ok">hello</div><div v-if="ok">hello</div>` ,
11098 )
11199 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>' ] )
119101 expect ( ir . returns ) . toEqual ( [ 1 , 3 ] )
120102 } )
121103
@@ -127,17 +109,7 @@ describe('compiler: v-if', () => {
127109 `<div v-if="ok"/><p v-else/>` ,
128110 )
129111 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>' ] )
141113
142114 expect ( vaporHelpers ) . contains ( 'createIf' )
143115 expect ( ir . effect ) . lengthOf ( 0 )
@@ -169,17 +141,7 @@ describe('compiler: v-if', () => {
169141 `<div v-if="ok"/><p v-else-if="orNot"/>` ,
170142 )
171143 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>' ] )
183145
184146 expect ( ir . operation ) . toMatchObject ( [
185147 {
@@ -216,21 +178,7 @@ describe('compiler: v-if', () => {
216178 `<div v-if="ok"/><p v-else-if="orNot"/><template v-else>fine</template>` ,
217179 )
218180 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' ] )
234182
235183 expect ( ir . returns ) . toEqual ( [ 1 ] )
236184 expect ( ir . operation ) . toMatchObject ( [
@@ -266,24 +214,12 @@ describe('compiler: v-if', () => {
266214 <input v-text="text" />
267215 ` )
268216 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>' ,
287223 ] )
288224 } )
289225
0 commit comments