@@ -430,3 +430,237 @@ it('supports multiple backgrounds as arbitrary values even if only some are quot
430
430
` )
431
431
} )
432
432
} )
433
+
434
+ it ( 'The "default" ring opacity is used by the default ring color when not using respectDefaultRingColorOpacity (1)' , ( ) => {
435
+ let config = {
436
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
437
+ corePlugins : { preflight : false } ,
438
+ }
439
+
440
+ let input = css `
441
+ @tailwind base;
442
+ @tailwind utilities;
443
+ `
444
+
445
+ return run ( input , config ) . then ( ( result ) => {
446
+ expect ( result . css ) . toMatchFormattedCss ( css `
447
+ ${ defaults ( { defaultRingColor : 'rgb(59 130 246 / 0.5)' } ) }
448
+ .ring {
449
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
450
+ var (--tw-ring-offset-color );
451
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
452
+ var (--tw-ring-color );
453
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
454
+ }
455
+ ` )
456
+ } )
457
+ } )
458
+
459
+ it ( 'The "default" ring opacity is used by the default ring color when not using respectDefaultRingColorOpacity (2)' , ( ) => {
460
+ let config = {
461
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
462
+ corePlugins : { preflight : false } ,
463
+ theme : {
464
+ ringOpacity : {
465
+ DEFAULT : 0.75 ,
466
+ } ,
467
+ } ,
468
+ }
469
+
470
+ let input = css `
471
+ @tailwind base;
472
+ @tailwind utilities;
473
+ `
474
+
475
+ return run ( input , config ) . then ( ( result ) => {
476
+ expect ( result . css ) . toMatchFormattedCss ( css `
477
+ ${ defaults ( { defaultRingColor : 'rgb(59 130 246 / 0.75)' } ) }
478
+ .ring {
479
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
480
+ var (--tw-ring-offset-color );
481
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
482
+ var (--tw-ring-color );
483
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
484
+ }
485
+ ` )
486
+ } )
487
+ } )
488
+
489
+ it ( 'Customizing the default ring color uses the "default" opacity when not using respectDefaultRingColorOpacity (1)' , ( ) => {
490
+ let config = {
491
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
492
+ corePlugins : { preflight : false } ,
493
+ theme : {
494
+ ringColor : {
495
+ DEFAULT : '#ff7f7f' ,
496
+ } ,
497
+ } ,
498
+ }
499
+
500
+ let input = css `
501
+ @tailwind base;
502
+ @tailwind utilities;
503
+ `
504
+
505
+ return run ( input , config ) . then ( ( result ) => {
506
+ expect ( result . css ) . toMatchFormattedCss ( css `
507
+ ${ defaults ( { defaultRingColor : 'rgb(255 127 127 / 0.5)' } ) }
508
+ .ring {
509
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
510
+ var (--tw-ring-offset-color );
511
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
512
+ var (--tw-ring-color );
513
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
514
+ }
515
+ ` )
516
+ } )
517
+ } )
518
+
519
+ it ( 'Customizing the default ring color uses the "default" opacity when not using respectDefaultRingColorOpacity (2)' , ( ) => {
520
+ let config = {
521
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
522
+ corePlugins : { preflight : false } ,
523
+ theme : {
524
+ ringColor : {
525
+ DEFAULT : '#ff7f7f00' ,
526
+ } ,
527
+ } ,
528
+ }
529
+
530
+ let input = css `
531
+ @tailwind base;
532
+ @tailwind utilities;
533
+ `
534
+
535
+ return run ( input , config ) . then ( ( result ) => {
536
+ expect ( result . css ) . toMatchFormattedCss ( css `
537
+ ${ defaults ( { defaultRingColor : 'rgb(255 127 127 / 0.5)' } ) }
538
+ .ring {
539
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
540
+ var (--tw-ring-offset-color );
541
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
542
+ var (--tw-ring-color );
543
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
544
+ }
545
+ ` )
546
+ } )
547
+ } )
548
+
549
+ it ( 'The "default" ring color ignores the default opacity when using respectDefaultRingColorOpacity (1)' , ( ) => {
550
+ let config = {
551
+ future : { respectDefaultRingColorOpacity : true } ,
552
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
553
+ corePlugins : { preflight : false } ,
554
+ }
555
+
556
+ let input = css `
557
+ @tailwind base;
558
+ @tailwind utilities;
559
+ `
560
+
561
+ return run ( input , config ) . then ( ( result ) => {
562
+ expect ( result . css ) . toMatchFormattedCss ( css `
563
+ ${ defaults ( { defaultRingColor : '#3b82f67f' } ) }
564
+ .ring {
565
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
566
+ var (--tw-ring-offset-color );
567
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
568
+ var (--tw-ring-color );
569
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
570
+ }
571
+ ` )
572
+ } )
573
+ } )
574
+
575
+ it ( 'The "default" ring color ignores the default opacity when using respectDefaultRingColorOpacity (2)' , ( ) => {
576
+ let config = {
577
+ future : { respectDefaultRingColorOpacity : true } ,
578
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
579
+ corePlugins : { preflight : false } ,
580
+ theme : {
581
+ ringOpacity : {
582
+ DEFAULT : 0.75 ,
583
+ } ,
584
+ } ,
585
+ }
586
+
587
+ let input = css `
588
+ @tailwind base;
589
+ @tailwind utilities;
590
+ `
591
+
592
+ return run ( input , config ) . then ( ( result ) => {
593
+ expect ( result . css ) . toMatchFormattedCss ( css `
594
+ ${ defaults ( { defaultRingColor : '#3b82f67f' } ) }
595
+ .ring {
596
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
597
+ var (--tw-ring-offset-color );
598
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
599
+ var (--tw-ring-color );
600
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
601
+ }
602
+ ` )
603
+ } )
604
+ } )
605
+
606
+ it ( 'Customizing the default ring color preserves its opacity when using respectDefaultRingColorOpacity (1)' , ( ) => {
607
+ let config = {
608
+ future : { respectDefaultRingColorOpacity : true } ,
609
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
610
+ corePlugins : { preflight : false } ,
611
+ theme : {
612
+ ringColor : {
613
+ DEFAULT : '#ff7f7f' ,
614
+ } ,
615
+ } ,
616
+ }
617
+
618
+ let input = css `
619
+ @tailwind base;
620
+ @tailwind utilities;
621
+ `
622
+
623
+ return run ( input , config ) . then ( ( result ) => {
624
+ expect ( result . css ) . toMatchFormattedCss ( css `
625
+ ${ defaults ( { defaultRingColor : '#ff7f7f' } ) }
626
+ .ring {
627
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
628
+ var (--tw-ring-offset-color );
629
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
630
+ var (--tw-ring-color );
631
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
632
+ }
633
+ ` )
634
+ } )
635
+ } )
636
+
637
+ it ( 'Customizing the default ring color preserves its opacity when using respectDefaultRingColorOpacity (2)' , ( ) => {
638
+ let config = {
639
+ future : { respectDefaultRingColorOpacity : true } ,
640
+ content : [ { raw : html `<div class= "ring" > </ div> ` } ] ,
641
+ corePlugins : { preflight : false } ,
642
+ theme : {
643
+ ringColor : {
644
+ DEFAULT : '#ff7f7f00' ,
645
+ } ,
646
+ } ,
647
+ }
648
+
649
+ let input = css `
650
+ @tailwind base;
651
+ @tailwind utilities;
652
+ `
653
+
654
+ return run ( input , config ) . then ( ( result ) => {
655
+ expect ( result . css ) . toMatchFormattedCss ( css `
656
+ ${ defaults ( { defaultRingColor : '#ff7f7f00' } ) }
657
+ .ring {
658
+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
659
+ var (--tw-ring-offset-color );
660
+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (3px + var (--tw-ring-offset-width ))
661
+ var (--tw-ring-color );
662
+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
663
+ }
664
+ ` )
665
+ } )
666
+ } )
0 commit comments