@@ -25,7 +25,6 @@ describe('compiler: template ref transform', () => {
25
25
test ( 'static ref' , ( ) => {
26
26
const { ir, code } = compileWithTransformRef ( `<div ref="foo" />` )
27
27
28
- expect ( code ) . matchSnapshot ( )
29
28
expect ( ir . block . dynamic . children [ 0 ] ) . toMatchObject ( {
30
29
id : 0 ,
31
30
flags : DynamicFlag . REFERENCED ,
@@ -44,13 +43,13 @@ describe('compiler: template ref transform', () => {
44
43
} ,
45
44
} ,
46
45
} )
46
+ expect ( code ) . matchSnapshot ( )
47
47
expect ( code ) . contains ( '_setRef(n0, "foo")' )
48
48
} )
49
49
50
50
test ( 'dynamic ref' , ( ) => {
51
51
const { ir, code } = compileWithTransformRef ( `<div :ref="foo" />` )
52
52
53
- expect ( code ) . matchSnapshot ( )
54
53
expect ( ir . block . dynamic . children [ 0 ] ) . toMatchObject ( {
55
54
id : 0 ,
56
55
flags : DynamicFlag . REFERENCED ,
@@ -76,6 +75,7 @@ describe('compiler: template ref transform', () => {
76
75
] ,
77
76
} ,
78
77
] )
78
+ expect ( code ) . matchSnapshot ( )
79
79
expect ( code ) . contains ( '_setRef(n0, _ctx.foo, r0)' )
80
80
} )
81
81
@@ -84,7 +84,6 @@ describe('compiler: template ref transform', () => {
84
84
`<div ref="foo" v-if="true" />` ,
85
85
)
86
86
87
- expect ( code ) . matchSnapshot ( )
88
87
expect ( ir . block . operation ) . lengthOf ( 1 )
89
88
expect ( ir . block . operation [ 0 ] . type ) . toBe ( IRNodeTypes . IF )
90
89
@@ -100,6 +99,7 @@ describe('compiler: template ref transform', () => {
100
99
effect : false ,
101
100
} ,
102
101
] )
102
+ expect ( code ) . matchSnapshot ( )
103
103
expect ( code ) . contains ( '_setRef(n2, "foo")' )
104
104
} )
105
105
@@ -108,7 +108,6 @@ describe('compiler: template ref transform', () => {
108
108
`<div ref="foo" v-for="item in [1,2,3]" />` ,
109
109
)
110
110
111
- expect ( code ) . matchSnapshot ( )
112
111
const { render } = ir . block . operation [ 0 ] as ForIRNode
113
112
expect ( render . operation ) . toMatchObject ( [
114
113
{
@@ -122,6 +121,7 @@ describe('compiler: template ref transform', () => {
122
121
effect : false ,
123
122
} ,
124
123
] )
124
+ expect ( code ) . matchSnapshot ( )
125
125
expect ( code ) . contains ( '_setRef(n2, "foo", void 0, true)' )
126
126
} )
127
127
} )
0 commit comments