@@ -261,6 +261,82 @@ describe('stylex-define-vars test', () => {
261
261
` ) ;
262
262
} ) ;
263
263
264
+ test ( 'converts set of vars with nested at rules to CSS and does not include key prefix in debug mode with debug classnames off' , ( ) => {
265
+ const themeName = 'TestTheme.stylex.js//buttonTheme' ;
266
+ const classNamePrefix = 'x' ;
267
+ const defaultVars = {
268
+ bgColor : {
269
+ default : 'blue' ,
270
+ '@media (prefers-color-scheme: dark)' : {
271
+ default : 'lightblue' ,
272
+ '@supports (color: oklab(0 0 0))' : 'oklab(0.7 -0.3 -0.4)' ,
273
+ } ,
274
+ '@media print' : 'white' ,
275
+ } ,
276
+ bgColorDisabled : {
277
+ default : {
278
+ default : 'grey' ,
279
+ '@supports (color: oklab(0 0 0))' : 'oklab(0.7 -0.3 -0.4)' ,
280
+ } ,
281
+ '@media (prefers-color-scheme: dark)' : {
282
+ default : 'rgba(0, 0, 0, 0.8)' ,
283
+ '@supports (color: oklab(0 0 0))' : 'oklab(0.7 -0.3 -0.4)' ,
284
+ } ,
285
+ } ,
286
+ cornerRadius : '10px' ,
287
+ fgColor : {
288
+ default : 'pink' ,
289
+ } ,
290
+ } ;
291
+ const [ jsOutput , cssOutput ] = styleXDefineVars ( defaultVars , {
292
+ themeName,
293
+ enableDebugClassNames : false ,
294
+ debug : false ,
295
+ } ) ;
296
+
297
+ expect ( jsOutput ) . toEqual ( {
298
+ __themeName__ : classNamePrefix + createHash ( themeName ) ,
299
+ bgColor : `var(--${ classNamePrefix + createHash ( `${ themeName } .bgColor` ) } )` ,
300
+ bgColorDisabled : `var(--${
301
+ classNamePrefix + createHash ( `${ themeName } .bgColorDisabled` )
302
+ } )`,
303
+ cornerRadius : `var(--${
304
+ classNamePrefix + createHash ( `${ themeName } .cornerRadius` )
305
+ } )`,
306
+ fgColor : `var(--${ classNamePrefix + createHash ( `${ themeName } .fgColor` ) } )` ,
307
+ } ) ;
308
+
309
+ expect ( cssOutput ) . toMatchInlineSnapshot ( `
310
+ {
311
+ "x568ih9": {
312
+ "ltr": ":root, .x568ih9{--xgck17p:blue;--xpegid5:grey;--xrqfjmn:10px;--x4y59db:pink;}",
313
+ "priority": 0,
314
+ "rtl": null,
315
+ },
316
+ "x568ih9-1e6ryz3": {
317
+ "ltr": "@supports (color: oklab(0 0 0)){@media (prefers-color-scheme: dark){:root, .x568ih9{--xgck17p:oklab(0.7 -0.3 -0.4);--xpegid5:oklab(0.7 -0.3 -0.4);}}}",
318
+ "priority": 0.2,
319
+ "rtl": null,
320
+ },
321
+ "x568ih9-1lveb7": {
322
+ "ltr": "@media (prefers-color-scheme: dark){:root, .x568ih9{--xgck17p:lightblue;--xpegid5:rgba(0, 0, 0, 0.8);}}",
323
+ "priority": 0.1,
324
+ "rtl": null,
325
+ },
326
+ "x568ih9-bdddrq": {
327
+ "ltr": "@media print{:root, .x568ih9{--xgck17p:white;}}",
328
+ "priority": 0.1,
329
+ "rtl": null,
330
+ },
331
+ "x568ih9-kpd015": {
332
+ "ltr": "@supports (color: oklab(0 0 0)){:root, .x568ih9{--xpegid5:oklab(0.7 -0.3 -0.4);}}",
333
+ "priority": 0.1,
334
+ "rtl": null,
335
+ },
336
+ }
337
+ ` ) ;
338
+ } ) ;
339
+
264
340
test ( 'converts set of typed vars with nested at rules to CSS' , ( ) => {
265
341
const themeName = 'TestTheme.stylex.js//buttonTheme' ;
266
342
const classNamePrefix = 'x' ;
0 commit comments