@@ -842,3 +842,58 @@ test('no defaults and apply without @tailwind base', () => {
842842 ` )
843843 } )
844844} )
845+
846+ test ( 'optimize universal defaults groups :has separately' , ( ) => {
847+ let config = {
848+ experimental : { optimizeUniversalDefaults : true } ,
849+ content : [
850+ { raw : html `<div class= "ring-1" > </ div> ` } ,
851+ { raw : html `<div class= "has-[:checked]:ring-1" > </ div> ` } ,
852+ ] ,
853+ corePlugins : { preflight : false } ,
854+ }
855+
856+ let input = css `
857+ @tailwind base;
858+ @tailwind utilities;
859+ `
860+
861+ return run ( input , config ) . then ( ( result ) => {
862+ return expect ( result . css ) . toMatchFormattedCss ( css `
863+ .ring-1 {
864+ --tw-ring-inset : ;
865+ --tw-ring-offset-width : 0px ;
866+ --tw-ring-offset-color : # fff ;
867+ --tw-ring-color : # 3b82f680 ;
868+ --tw-ring-offset-shadow : 0 0 # 0000 ;
869+ --tw-ring-shadow : 0 0 # 0000 ;
870+ --tw-shadow : 0 0 # 0000 ;
871+ --tw-shadow-colored : 0 0 # 0000 ;
872+ }
873+ .has-\[\:checked\]\:ring-1 : has (: checked ) {
874+ --tw-ring-inset : ;
875+ --tw-ring-offset-width : 0px ;
876+ --tw-ring-offset-color : # fff ;
877+ --tw-ring-color : # 3b82f680 ;
878+ --tw-ring-offset-shadow : 0 0 # 0000 ;
879+ --tw-ring-shadow : 0 0 # 0000 ;
880+ --tw-shadow : 0 0 # 0000 ;
881+ --tw-shadow-colored : 0 0 # 0000 ;
882+ }
883+ .ring-1 {
884+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
885+ var (--tw-ring-offset-color );
886+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (1px + var (--tw-ring-offset-width ))
887+ var (--tw-ring-color );
888+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
889+ }
890+ .has-\[\:checked\]\:ring-1 : has (: checked ) {
891+ --tw-ring-offset-shadow : var (--tw-ring-inset ) 0 0 0 var (--tw-ring-offset-width )
892+ var (--tw-ring-offset-color );
893+ --tw-ring-shadow : var (--tw-ring-inset ) 0 0 0 calc (1px + var (--tw-ring-offset-width ))
894+ var (--tw-ring-color );
895+ box-shadow : var (--tw-ring-offset-shadow ), var (--tw-ring-shadow ), var (--tw-shadow , 0 0 # 0000 );
896+ }
897+ ` )
898+ } )
899+ } )
0 commit comments