@@ -355,6 +355,101 @@ test('colors can be referenced from the theme with a closure', () => {
355
355
} ) ;
356
356
} ) ;
357
357
358
+ test ( 'color keywords are accepted' , ( ) => {
359
+ return generatePluginCss ( {
360
+ theme : {
361
+ colors : {
362
+ 'white' : 'white' ,
363
+ 'black' : 'black' ,
364
+ 'transparent' : 'transparent' ,
365
+ 'current' : 'currentColor' ,
366
+ } ,
367
+ linearGradients : theme => ( {
368
+ directions : {
369
+ 't' : 'to top' ,
370
+ } ,
371
+ colors : theme ( 'colors' ) ,
372
+ } ) ,
373
+ radialGradients : theme => ( {
374
+ positions : {
375
+ 't' : 'top' ,
376
+ } ,
377
+ colors : theme ( 'colors' ) ,
378
+ } ) ,
379
+ } ,
380
+ variants : {
381
+ linearGradients : [ ] ,
382
+ radialGradients : [ ] ,
383
+ } ,
384
+ } ) . then ( css => {
385
+ expect ( css ) . toMatchCss ( `
386
+ .bg-gradient-t-white {
387
+ background-image: linear-gradient(to top, rgba(255, 255, 255, 0), white)
388
+ }
389
+ .bg-gradient-t-black {
390
+ background-image: linear-gradient(to top, rgba(0, 0, 0, 0), black)
391
+ }
392
+ .bg-gradient-t-transparent {
393
+ background-image: linear-gradient(to top, rgba(0, 0, 0, 0), transparent)
394
+ }
395
+ .bg-gradient-t-current {
396
+ background-image: linear-gradient(to top, transparent, currentColor)
397
+ }
398
+ .bg-radial-t-white {
399
+ background-image: radial-gradient(ellipse closest-side at top, white, rgba(255, 255, 255, 0))
400
+ }
401
+ .bg-radial-t-black {
402
+ background-image: radial-gradient(ellipse closest-side at top, black, rgba(0, 0, 0, 0))
403
+ }
404
+ .bg-radial-t-transparent {
405
+ background-image: radial-gradient(ellipse closest-side at top, transparent, rgba(0, 0, 0, 0))
406
+ }
407
+ .bg-radial-t-current {
408
+ background-image: radial-gradient(ellipse closest-side at top, currentColor, transparent)
409
+ }
410
+ ` ) ;
411
+ } ) ;
412
+ } ) ;
413
+
414
+ test ( 'some keywords such as inherit are skipped' , ( ) => {
415
+ return generatePluginCss ( {
416
+ theme : {
417
+ colors : {
418
+ 'inherit' : 'inherit' ,
419
+ 'red' : '#f00' ,
420
+ 'initial' : 'initial' ,
421
+ 'unset' : 'unset' ,
422
+ 'revert' : 'revert' ,
423
+ } ,
424
+ linearGradients : theme => ( {
425
+ directions : {
426
+ 't' : 'to top' ,
427
+ } ,
428
+ colors : theme ( 'colors' ) ,
429
+ } ) ,
430
+ radialGradients : theme => ( {
431
+ positions : {
432
+ 't' : 'top' ,
433
+ } ,
434
+ colors : theme ( 'colors' ) ,
435
+ } ) ,
436
+ } ,
437
+ variants : {
438
+ linearGradients : [ ] ,
439
+ radialGradients : [ ] ,
440
+ } ,
441
+ } ) . then ( css => {
442
+ expect ( css ) . toMatchCss ( `
443
+ .bg-gradient-t-red {
444
+ background-image: linear-gradient(to top, rgba(255, 0, 0, 0), #f00)
445
+ }
446
+ .bg-radial-t-red {
447
+ background-image: radial-gradient(ellipse closest-side at top, #f00, rgba(255, 0, 0, 0))
448
+ }
449
+ ` ) ;
450
+ } ) ;
451
+ } ) ;
452
+
358
453
test ( 'radial gradient shapes and sizes can be customized' , ( ) => {
359
454
return generatePluginCss ( {
360
455
theme : {
0 commit comments