@@ -117,7 +117,7 @@ describe('inject-cssvars', () => {
117117 test ( 'isScriptSetup=true, has=false, hash=false, isRef=true' , ( ) => {
118118 const vbindVariableList = [ { value : 'color' , has : false , hash : false , isRef : true } ]
119119 const result = createCSSVarsObjCode ( vbindVariableList as any , true )
120- expect ( result ) . toContain ( 'color.value ' )
120+ expect ( result ) . toContain ( '_ctx.color ' )
121121 } )
122122
123123 test ( 'isScriptSetup=true, has=false, hash=true, isRef=false' , ( ) => {
@@ -130,7 +130,7 @@ describe('inject-cssvars', () => {
130130 test ( 'isScriptSetup=true, has=false, hash=true, isRef=true' , ( ) => {
131131 const vbindVariableList = [ { value : 'color' , has : false , hash : 'color' , isRef : true } ]
132132 const result = createCSSVarsObjCode ( vbindVariableList as any , true )
133- expect ( result ) . toContain ( 'color.value ' )
133+ expect ( result ) . toContain ( '_ctx.color ' )
134134 expect ( result ) . toContain ( '"color":' )
135135 } )
136136
@@ -143,7 +143,7 @@ describe('inject-cssvars', () => {
143143 test ( 'isScriptSetup=true, has=true, hash=false, isRef=true' , ( ) => {
144144 const vbindVariableList = [ { value : 'color' , has : true , hash : false , isRef : true } ]
145145 const result = createCSSVarsObjCode ( vbindVariableList as any , true )
146- expect ( result ) . toContain ( 'color.value ' )
146+ expect ( result ) . toContain ( '_ctx.color ' )
147147 } )
148148
149149 test ( 'isScriptSetup=true, has=true, hash=true, isRef=false' , ( ) => {
@@ -156,12 +156,12 @@ describe('inject-cssvars', () => {
156156 test ( 'isScriptSetup=true, has=true, hash=true, isRef=true' , ( ) => {
157157 const vbindVariableList = [ { value : 'color' , has : true , hash : 'color' , isRef : true } ]
158158 const result = createCSSVarsObjCode ( vbindVariableList as any , true )
159- expect ( result ) . toContain ( 'color.value ' )
159+ expect ( result ) . toContain ( '_ctx.color ' )
160160 expect ( result ) . toContain ( '"color":' )
161161 } )
162162
163163 test ( 'avoid repeated injections' , ( ) => {
164- const mockCode = '\n "color": color.value ,'
164+ const mockCode = '\n "color": _ctx.color ,'
165165 const vbindVariableList = [ { value : 'color' , has : true , hash : 'color' , isRef : true } ]
166166 const result = createCSSVarsObjCode ( vbindVariableList as any , true , new MagicString ( mockCode ) )
167167 expect ( result ) . not . toBeTruthy ( )
@@ -274,7 +274,7 @@ describe('inject-cssvars', () => {
274274 true ,
275275 parseRes ,
276276 mgcStr )
277- expect ( res . mgcStr . toString ( ) ) . toContain ( 'color.value ' )
277+ expect ( res . mgcStr . toString ( ) ) . toContain ( '_ctx.color ' )
278278 } )
279279
280280 test ( 'isScriptSetup=false hasUseCssVars=true' , ( ) => {
@@ -317,7 +317,7 @@ describe('inject-cssvars', () => {
317317 true ,
318318 parseRes ,
319319 mgcStr )
320- expect ( res . mgcStr . toString ( ) ) . toContain ( 'color.value ' )
320+ expect ( res . mgcStr . toString ( ) ) . toContain ( '_ctx.color ' )
321321 expect ( res . mgcStr . toString ( ) ) . toContain ( '_useCssVars' )
322322 } )
323323 } )
@@ -340,7 +340,7 @@ describe('inject-cssvars', () => {
340340 true ,
341341 parseRes ,
342342 mgcStr )
343- expect ( res . mgcStr . toString ( ) ) . toContain ( 'color.value ' )
343+ expect ( res . mgcStr . toString ( ) ) . toContain ( '_ctx.color ' )
344344 expect ( res . mgcStr . toString ( ) ) . toContain ( '_useCssVars' )
345345 } )
346346
0 commit comments