@@ -25,7 +25,6 @@ describe('compiler: template ref transform', () => {
2525 test ( 'static ref' , ( ) => {
2626 const { ir, code } = compileWithTransformRef ( `<div ref="foo" />` )
2727
28- expect ( code ) . matchSnapshot ( )
2928 expect ( ir . block . dynamic . children [ 0 ] ) . toMatchObject ( {
3029 id : 0 ,
3130 flags : DynamicFlag . REFERENCED ,
@@ -44,13 +43,13 @@ describe('compiler: template ref transform', () => {
4443 } ,
4544 } ,
4645 } )
46+ expect ( code ) . matchSnapshot ( )
4747 expect ( code ) . contains ( '_setRef(n0, "foo")' )
4848 } )
4949
5050 test ( 'dynamic ref' , ( ) => {
5151 const { ir, code } = compileWithTransformRef ( `<div :ref="foo" />` )
5252
53- expect ( code ) . matchSnapshot ( )
5453 expect ( ir . block . dynamic . children [ 0 ] ) . toMatchObject ( {
5554 id : 0 ,
5655 flags : DynamicFlag . REFERENCED ,
@@ -76,6 +75,7 @@ describe('compiler: template ref transform', () => {
7675 ] ,
7776 } ,
7877 ] )
78+ expect ( code ) . matchSnapshot ( )
7979 expect ( code ) . contains ( '_setRef(n0, _ctx.foo, r0)' )
8080 } )
8181
@@ -84,7 +84,6 @@ describe('compiler: template ref transform', () => {
8484 `<div ref="foo" v-if="true" />` ,
8585 )
8686
87- expect ( code ) . matchSnapshot ( )
8887 expect ( ir . block . operation ) . lengthOf ( 1 )
8988 expect ( ir . block . operation [ 0 ] . type ) . toBe ( IRNodeTypes . IF )
9089
@@ -100,6 +99,7 @@ describe('compiler: template ref transform', () => {
10099 effect : false ,
101100 } ,
102101 ] )
102+ expect ( code ) . matchSnapshot ( )
103103 expect ( code ) . contains ( '_setRef(n2, "foo")' )
104104 } )
105105
@@ -108,7 +108,6 @@ describe('compiler: template ref transform', () => {
108108 `<div ref="foo" v-for="item in [1,2,3]" />` ,
109109 )
110110
111- expect ( code ) . matchSnapshot ( )
112111 const { render } = ir . block . operation [ 0 ] as ForIRNode
113112 expect ( render . operation ) . toMatchObject ( [
114113 {
@@ -122,6 +121,7 @@ describe('compiler: template ref transform', () => {
122121 effect : false ,
123122 } ,
124123 ] )
124+ expect ( code ) . matchSnapshot ( )
125125 expect ( code ) . contains ( '_setRef(n2, "foo", void 0, true)' )
126126 } )
127127} )
0 commit comments