1- import { getCssVarName } from './css-variables' ;
1+ import { parseCssVar } from './css-variables' ;
22
33// ----------------------------------------------------------------------
44
5- describe ( 'getCssVarName ()' , ( ) => {
5+ describe ( 'parseCssVar ()' , ( ) => {
66 const errorSpy = vi . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
77
88 afterEach ( ( ) => {
@@ -14,11 +14,11 @@ describe('getCssVarName()', () => {
1414 } ) ;
1515
1616 it ( '1. Extracts variable without fallback' , ( ) => {
17- expect ( getCssVarName ( 'var(--palette-Tooltip-bg)' ) ) . toBe ( '--palette-Tooltip-bg' ) ;
17+ expect ( parseCssVar ( 'var(--palette-Tooltip-bg)' ) ) . toBe ( '--palette-Tooltip-bg' ) ;
1818 } ) ;
1919
2020 it ( '2. Extracts variable with fallback' , ( ) => {
21- expect ( getCssVarName ( 'var(--palette-Tooltip-bg, rgba(69, 79, 91, 0.92))' ) ) . toBe (
21+ expect ( parseCssVar ( 'var(--palette-Tooltip-bg, rgba(69, 79, 91, 0.92))' ) ) . toBe (
2222 '--palette-Tooltip-bg'
2323 ) ;
2424 } ) ;
@@ -27,7 +27,7 @@ describe('getCssVarName()', () => {
2727 const badInputs = [ null , undefined , '' , 123 , { } , true ] ;
2828
2929 for ( const val of badInputs ) {
30- expect ( getCssVarName ( val ) ) . toBe ( '' ) ;
30+ expect ( parseCssVar ( val ) ) . toBe ( '' ) ;
3131 }
3232
3333 expect ( errorSpy ) . toHaveBeenCalledTimes ( badInputs . length ) ;
@@ -38,7 +38,7 @@ describe('getCssVarName()', () => {
3838 const invalidFormats = [ 'rgba(0,0,0,0.5)' , 'var(-bad)' , 'var()' , 'var(--bad value)' ] ;
3939
4040 for ( const val of invalidFormats ) {
41- expect ( getCssVarName ( val ) ) . toBe ( '' ) ;
41+ expect ( parseCssVar ( val ) ) . toBe ( '' ) ;
4242 }
4343
4444 expect ( errorSpy ) . toHaveBeenCalledTimes ( invalidFormats . length ) ;
0 commit comments