@@ -1157,7 +1157,7 @@ describe('properties: custom property', () => {
11571157 test ( 'legacy strings' , ( ) => {
11581158 const options = {
11591159 customProperties : {
1160- rootColor : 'red'
1160+ '-- rootColor' : 'red'
11611161 }
11621162 } ;
11631163 expect (
@@ -1183,7 +1183,8 @@ describe('properties: custom property', () => {
11831183 themeAwareColor : {
11841184 default : 'blue' ,
11851185 '@media (prefers-color-scheme: dark)' : 'green'
1186- }
1186+ } ,
1187+ '--pass-through' : 'purple'
11871188 } ) ;
11881189 expect ( tokens ) . toMatchSnapshot ( 'tokens' ) ;
11891190 expect ( css . __customProperties ) . toMatchSnapshot ( 'css.__customProperties' ) ;
@@ -1193,6 +1194,9 @@ describe('properties: custom property', () => {
11931194 expect (
11941195 resolveCustomPropertyValue ( options , [ 'color' , tokens . themeAwareColor ] )
11951196 ) . toEqual ( 'blue' ) ;
1197+ expect (
1198+ resolveCustomPropertyValue ( options , [ 'color' , 'var(--pass-through)' ] )
1199+ ) . toEqual ( 'purple' ) ;
11961200 // dark theme
11971201 expect (
11981202 resolveCustomPropertyValue ( { colorScheme : 'dark' } , [
@@ -1255,7 +1259,9 @@ describe('properties: custom property', () => {
12551259
12561260 test ( 'parses a basic var correctly' , ( ) => {
12571261 const options = {
1258- customProperties : { test : 'red' }
1262+ customProperties : {
1263+ '--test' : 'red'
1264+ }
12591265 } ;
12601266 expect (
12611267 resolveCustomPropertyValue ( options , [ 'color' , 'var(--test)' ] )
@@ -1264,7 +1270,9 @@ describe('properties: custom property', () => {
12641270
12651271 test ( 'parses a var with a default value' , ( ) => {
12661272 const options = {
1267- customProperties : { test : 'red' }
1273+ customProperties : {
1274+ '--test' : 'red'
1275+ }
12681276 } ;
12691277 expect (
12701278 resolveCustomPropertyValue ( options , [ 'color' , 'var(--test, blue)' ] )
@@ -1274,32 +1282,11 @@ describe('properties: custom property', () => {
12741282 ) . toEqual ( 'blue' ) ;
12751283 } ) ;
12761284
1277- // TODO: this transform should not be supported. Custom properties are case sensitive.
1278- test ( 'parses kebab case var to camel case' , ( ) => {
1279- const options = {
1280- customProperties : { testVar : 'red' }
1281- } ;
1282- expect (
1283- resolveCustomPropertyValue ( options , [ 'color' , 'var(--test-var)' ] )
1284- ) . toEqual ( 'red' ) ;
1285- } ) ;
1286-
1287- // TODO: this transform should not be supported. Custom properties are case sensitive.
1288- test ( 'parses kebab case var with a default value' , ( ) => {
1289- const options = {
1290- customProperties : { testVar : 'red' }
1291- } ;
1292- expect (
1293- resolveCustomPropertyValue ( options , [ 'color' , 'var(--test-var, blue)' ] )
1294- ) . toEqual ( 'red' ) ;
1295- expect (
1296- resolveCustomPropertyValue ( options , [ 'color' , 'var(--not-found, blue)' ] )
1297- ) . toEqual ( 'blue' ) ;
1298- } ) ;
1299-
13001285 test ( 'parses a var with a default value containing spaces' , ( ) => {
13011286 const options = {
1302- customProperties : { color : 'rgb(0,0,0)' }
1287+ customProperties : {
1288+ '--color' : 'rgb(0,0,0)'
1289+ }
13031290 } ;
13041291 expect (
13051292 resolveCustomPropertyValue ( options , [
@@ -1317,7 +1304,9 @@ describe('properties: custom property', () => {
13171304
13181305 test ( 'parses a var and falls back to default value containing a var' , ( ) => {
13191306 const options = {
1320- customProperties : { color : 'red' }
1307+ customProperties : {
1308+ '--color' : 'red'
1309+ }
13211310 } ;
13221311 expect (
13231312 resolveCustomPropertyValue ( options , [
@@ -1330,7 +1319,7 @@ describe('properties: custom property', () => {
13301319 test ( 'parses a var and falls back to a default value containing spaces and embedded var' , ( ) => {
13311320 const options = {
13321321 customProperties : {
1333- test : '255'
1322+ '-- test' : '255'
13341323 }
13351324 } ;
13361325 expect (
@@ -1343,7 +1332,9 @@ describe('properties: custom property', () => {
13431332
13441333 test ( 'basic var value lookup works' , ( ) => {
13451334 const options = {
1346- customProperties : { number : 10 }
1335+ customProperties : {
1336+ '--number' : 10
1337+ }
13471338 } ;
13481339 expect (
13491340 resolveCustomPropertyValue ( options , [ 'borderWidth' , 'var(--number)' ] )
@@ -1352,7 +1343,9 @@ describe('properties: custom property', () => {
13521343
13531344 test ( 'var value lookup with pixel prop conversion' , ( ) => {
13541345 const options = {
1355- customProperties : { pxNumber : '10px' }
1346+ customProperties : {
1347+ '--pxNumber' : '10px'
1348+ }
13561349 } ;
13571350 expect (
13581351 resolveCustomPropertyValue ( options , [ 'borderWidth' , 'var(--pxNumber)' ] )
@@ -1361,7 +1354,9 @@ describe('properties: custom property', () => {
13611354
13621355 test ( 'var value lookup with em prop conversion' , ( ) => {
13631356 const options = {
1364- customProperties : { emNumber : '10em' }
1357+ customProperties : {
1358+ '--emNumber' : '10em'
1359+ }
13651360 } ;
13661361 expect (
13671362 resolveCustomPropertyValue ( options , [ 'borderWidth' , 'var(--emNumber)' ] )
@@ -1371,9 +1366,9 @@ describe('properties: custom property', () => {
13711366 test ( 'var value lookup with reference to another var' , ( ) => {
13721367 const options = {
13731368 customProperties : {
1374- number : 10 ,
1375- refToNumber : 'var(--number)' ,
1376- refToRefToNumber : 'var(--refToNumber)'
1369+ '-- number' : 10 ,
1370+ '-- refToNumber' : 'var(--number)' ,
1371+ '-- refToRefToNumber' : 'var(--refToNumber)'
13771372 }
13781373 } ;
13791374 expect (
@@ -1389,7 +1384,9 @@ describe('properties: custom property', () => {
13891384
13901385 test ( 'var with hover styles' , ( ) => {
13911386 const options = {
1392- customProperties : { test : '#333' } ,
1387+ customProperties : {
1388+ '--test' : '#333'
1389+ } ,
13931390 hover : true
13941391 } ;
13951392 const { underTest } = css . create ( {
@@ -1413,7 +1410,9 @@ describe('properties: custom property', () => {
14131410
14141411 test ( 'rgb(a) function with args applied through a single var' , ( ) => {
14151412 const options = {
1416- customProperties : { example : '24, 48, 96' }
1413+ customProperties : {
1414+ '--example' : '24, 48, 96'
1415+ }
14171416 } ;
14181417 expect (
14191418 resolveCustomPropertyValue ( options , [ 'color' , 'rgb(var(--example))' ] )
@@ -1429,11 +1428,11 @@ describe('properties: custom property', () => {
14291428 test ( 'rgba function with args applied through multiple (& nested) vars' , ( ) => {
14301429 const options = {
14311430 customProperties : {
1432- red : 255 ,
1433- green : 96 ,
1434- blue : 16 ,
1435- rgb : 'var(--red), var(--green), var(--blue)' ,
1436- alpha : 0.42
1431+ '-- red' : 255 ,
1432+ '-- green' : 96 ,
1433+ '-- blue' : 16 ,
1434+ '-- rgb' : 'var(--red), var(--green), var(--blue)' ,
1435+ '-- alpha' : 0.42
14371436 }
14381437 } ;
14391438 expect (
@@ -1447,11 +1446,11 @@ describe('properties: custom property', () => {
14471446 test ( 'textShadow with nested/multiple vars' , ( ) => {
14481447 const options = {
14491448 customProperties : {
1450- height : '20px' ,
1451- width : '10px' ,
1452- size : 'var(--width) var(--height)' ,
1453- radius : '30px' ,
1454- red : 'red'
1449+ '-- height' : '20px' ,
1450+ '-- width' : '10px' ,
1451+ '-- size' : 'var(--width) var(--height)' ,
1452+ '-- radius' : '30px' ,
1453+ '-- red' : 'red'
14551454 }
14561455 } ;
14571456 const styles = css . create ( {
@@ -1474,10 +1473,10 @@ describe('properties: custom property', () => {
14741473 test ( 'transform with nested/multiple vars' , ( ) => {
14751474 const options = {
14761475 customProperties : {
1477- distance : 20 ,
1478- angle : '45deg' ,
1479- translateX : 'translateX(var(--distance))' ,
1480- rotateX : 'rotateX(var(--angle))'
1476+ '-- distance' : 20 ,
1477+ '-- angle' : '45deg' ,
1478+ '-- translateX' : 'translateX(var(--distance))' ,
1479+ '-- rotateX' : 'rotateX(var(--angle))'
14811480 }
14821481 } ;
14831482 const styles = css . create ( {
@@ -1495,7 +1494,7 @@ describe('properties: custom property', () => {
14951494 test ( 'css variable declaration inside a media query' , ( ) => {
14961495 const options = {
14971496 customProperties : {
1498- example : '42px'
1497+ '-- example' : '42px'
14991498 } ,
15001499 viewportWidth : 450
15011500 } ;
0 commit comments