@@ -402,7 +402,7 @@ describe('Advanced Features', () => {
402402 gen . generate ( 'space-x-8' )
403403 gen . generate ( 'space-x-reverse' )
404404 const css = gen . toCSS ( false )
405- expect ( css ) . toContain ( '--tw -space-x-reverse' )
405+ expect ( css ) . toContain ( '--hw -space-x-reverse' )
406406 expect ( css ) . toContain ( 'margin-right' )
407407 expect ( css ) . toContain ( 'margin-left' )
408408 } )
@@ -414,7 +414,7 @@ describe('Advanced Features', () => {
414414 gen . generate ( 'space-y-8' )
415415 gen . generate ( 'space-y-reverse' )
416416 const css = gen . toCSS ( false )
417- expect ( css ) . toContain ( '--tw -space-y-reverse' )
417+ expect ( css ) . toContain ( '--hw -space-y-reverse' )
418418 expect ( css ) . toContain ( 'margin-top' )
419419 expect ( css ) . toContain ( 'margin-bottom' )
420420 } )
@@ -687,4 +687,216 @@ describe('Advanced Features', () => {
687687 expect ( css ) . toContain ( 'animation' )
688688 } )
689689 } )
690+
691+ describe ( 'Multi-segment color names' , ( ) => {
692+ it ( 'should handle blue-gray color' , ( ) => {
693+ const gen = new CSSGenerator ( defaultConfig )
694+ gen . generate ( 'text-blue-gray-200' )
695+ gen . generate ( 'bg-blue-gray-500' )
696+ gen . generate ( 'border-blue-gray-700' )
697+ const css = gen . toCSS ( false )
698+ expect ( css ) . toContain ( '#e2e8f0' ) // blue-gray-200
699+ expect ( css ) . toContain ( '#64748b' ) // blue-gray-500
700+ expect ( css ) . toContain ( '#334155' ) // blue-gray-700
701+ } )
702+
703+ it ( 'should handle sky color' , ( ) => {
704+ const gen = new CSSGenerator ( defaultConfig )
705+ gen . generate ( 'text-sky-400' )
706+ gen . generate ( 'bg-sky-500' )
707+ gen . generate ( 'border-sky-600' )
708+ const css = gen . toCSS ( false )
709+ expect ( css ) . toContain ( '#38bdf8' ) // sky-400
710+ expect ( css ) . toContain ( '#0ea5e9' ) // sky-500
711+ expect ( css ) . toContain ( '#0284c7' ) // sky-600
712+ } )
713+
714+ it ( 'should handle cyan color' , ( ) => {
715+ const gen = new CSSGenerator ( defaultConfig )
716+ gen . generate ( 'text-cyan-400' )
717+ gen . generate ( 'bg-cyan-500' )
718+ gen . generate ( 'border-cyan-600' )
719+ const css = gen . toCSS ( false )
720+ expect ( css ) . toContain ( '#22d3ee' ) // cyan-400
721+ expect ( css ) . toContain ( '#06b6d4' ) // cyan-500
722+ expect ( css ) . toContain ( '#0891b2' ) // cyan-600
723+ } )
724+ } )
725+
726+ describe ( 'Ring offset colors' , ( ) => {
727+ it ( 'should handle ring-offset width' , ( ) => {
728+ const gen = new CSSGenerator ( defaultConfig )
729+ gen . generate ( 'ring-offset-0' )
730+ gen . generate ( 'ring-offset-1' )
731+ gen . generate ( 'ring-offset-2' )
732+ gen . generate ( 'ring-offset-4' )
733+ const css = gen . toCSS ( false )
734+ expect ( css ) . toContain ( '--hw-ring-offset-width' )
735+ expect ( css ) . toContain ( '0px' )
736+ expect ( css ) . toContain ( '1px' )
737+ expect ( css ) . toContain ( '2px' )
738+ expect ( css ) . toContain ( '4px' )
739+ } )
740+
741+ it ( 'should handle ring-offset with single color' , ( ) => {
742+ const gen = new CSSGenerator ( defaultConfig )
743+ gen . generate ( 'ring-offset-black' )
744+ gen . generate ( 'ring-offset-white' )
745+ const css = gen . toCSS ( false )
746+ expect ( css ) . toContain ( '--hw-ring-offset-color' )
747+ expect ( css ) . toContain ( '#000' )
748+ expect ( css ) . toContain ( '#fff' )
749+ } )
750+
751+ it ( 'should handle ring-offset with two-segment color' , ( ) => {
752+ const gen = new CSSGenerator ( defaultConfig )
753+ gen . generate ( 'ring-offset-blue-500' )
754+ gen . generate ( 'ring-offset-red-500' )
755+ gen . generate ( 'ring-offset-gray-300' )
756+ const css = gen . toCSS ( false )
757+ expect ( css ) . toContain ( '--hw-ring-offset-color' )
758+ expect ( css ) . toContain ( '#3b82f6' ) // blue-500
759+ expect ( css ) . toContain ( '#ef4444' ) // red-500
760+ expect ( css ) . toContain ( '#d1d5db' ) // gray-300
761+ } )
762+
763+ it ( 'should handle ring-offset with multi-segment color names' , ( ) => {
764+ const gen = new CSSGenerator ( defaultConfig )
765+ gen . generate ( 'ring-offset-blue-gray-500' )
766+ gen . generate ( 'ring-offset-sky-400' )
767+ gen . generate ( 'ring-offset-cyan-600' )
768+ const css = gen . toCSS ( false )
769+ expect ( css ) . toContain ( '--hw-ring-offset-color' )
770+ expect ( css ) . toContain ( '#64748b' ) // blue-gray-500
771+ expect ( css ) . toContain ( '#38bdf8' ) // sky-400
772+ expect ( css ) . toContain ( '#0891b2' ) // cyan-600
773+ } )
774+ } )
775+
776+ describe ( 'Gradient utilities' , ( ) => {
777+ it ( 'should handle gradient direction utilities' , ( ) => {
778+ const gen = new CSSGenerator ( defaultConfig )
779+ gen . generate ( 'bg-gradient-to-r' )
780+ gen . generate ( 'bg-gradient-to-l' )
781+ gen . generate ( 'bg-gradient-to-t' )
782+ gen . generate ( 'bg-gradient-to-b' )
783+ gen . generate ( 'bg-gradient-to-tr' )
784+ gen . generate ( 'bg-gradient-to-br' )
785+ gen . generate ( 'bg-gradient-to-bl' )
786+ gen . generate ( 'bg-gradient-to-tl' )
787+ const css = gen . toCSS ( false )
788+ expect ( css ) . toContain ( 'linear-gradient' )
789+ expect ( css ) . toContain ( 'to right' )
790+ expect ( css ) . toContain ( 'to left' )
791+ expect ( css ) . toContain ( 'to top' )
792+ expect ( css ) . toContain ( 'to bottom' )
793+ } )
794+
795+ it ( 'should handle gradient color stops' , ( ) => {
796+ const gen = new CSSGenerator ( defaultConfig )
797+ gen . generate ( 'from-blue-500' )
798+ gen . generate ( 'via-gray-300' )
799+ gen . generate ( 'to-red-500' )
800+ const css = gen . toCSS ( false )
801+ expect ( css ) . toContain ( '--hw-gradient-from' )
802+ expect ( css ) . toContain ( '--hw-gradient-to' )
803+ expect ( css ) . toContain ( '--hw-gradient-stops' )
804+ expect ( css ) . toContain ( '#3b82f6' ) // blue-500
805+ expect ( css ) . toContain ( '#ef4444' ) // red-500
806+ } )
807+
808+ it ( 'should handle gradient with multi-segment colors' , ( ) => {
809+ const gen = new CSSGenerator ( defaultConfig )
810+ gen . generate ( 'from-blue-gray-500' )
811+ gen . generate ( 'via-sky-400' )
812+ gen . generate ( 'to-cyan-600' )
813+ const css = gen . toCSS ( false )
814+ expect ( css ) . toContain ( '--hw-gradient-from' )
815+ expect ( css ) . toContain ( '--hw-gradient-to' )
816+ expect ( css ) . toContain ( '--hw-gradient-stops' )
817+ expect ( css ) . toContain ( '#64748b' ) // blue-gray-500
818+ expect ( css ) . toContain ( '#38bdf8' ) // sky-400
819+ expect ( css ) . toContain ( '#0891b2' ) // cyan-600
820+ } )
821+
822+ it ( 'should handle gradient with hover variants' , ( ) => {
823+ const gen = new CSSGenerator ( defaultConfig )
824+ gen . generate ( 'hover:from-sky-500' )
825+ gen . generate ( 'hover:to-cyan-500' )
826+ gen . generate ( 'hover:via-blue-500' )
827+ const css = gen . toCSS ( false )
828+ expect ( css ) . toContain ( ':hover' )
829+ expect ( css ) . toContain ( '--hw-gradient-from' )
830+ expect ( css ) . toContain ( '--hw-gradient-to' )
831+ expect ( css ) . toContain ( '#0ea5e9' ) // sky-500
832+ expect ( css ) . toContain ( '#06b6d4' ) // cyan-500
833+ } )
834+
835+ it ( 'should handle complete gradient combination' , ( ) => {
836+ const gen = new CSSGenerator ( defaultConfig )
837+ gen . generate ( 'bg-gradient-to-r' )
838+ gen . generate ( 'from-sky-500' )
839+ gen . generate ( 'to-cyan-500' )
840+ const css = gen . toCSS ( false )
841+ expect ( css ) . toContain ( 'linear-gradient(to right, var(--hw-gradient-stops))' )
842+ expect ( css ) . toContain ( '--hw-gradient-from: #0ea5e9' ) // sky-500
843+ expect ( css ) . toContain ( '--hw-gradient-to: #06b6d4' ) // cyan-500
844+ } )
845+
846+ it ( 'should properly update gradient stops when using to-{color}' , ( ) => {
847+ const gen = new CSSGenerator ( defaultConfig )
848+ gen . generate ( 'from-blue-500' )
849+ gen . generate ( 'to-red-500' )
850+ const css = gen . toCSS ( false )
851+ // Both from and to should set --hw-gradient-stops
852+ const fromMatch = css . match ( / \. f r o m - b l u e - 5 0 0 \s * \{ [ ^ } ] * \} / )
853+ const toMatch = css . match ( / \. t o - r e d - 5 0 0 \s * \{ [ ^ } ] * \} / )
854+ expect ( fromMatch ) . toBeTruthy ( )
855+ expect ( toMatch ) . toBeTruthy ( )
856+ expect ( fromMatch ! [ 0 ] ) . toContain ( '--hw-gradient-stops' )
857+ expect ( toMatch ! [ 0 ] ) . toContain ( '--hw-gradient-stops' )
858+ } )
859+ } )
860+
861+ describe ( 'Accessibility utilities' , ( ) => {
862+ it ( 'should handle sr-only utility' , ( ) => {
863+ const gen = new CSSGenerator ( defaultConfig )
864+ gen . generate ( 'sr-only' )
865+ const css = gen . toCSS ( false )
866+ expect ( css ) . toContain ( 'position: absolute' )
867+ expect ( css ) . toContain ( 'width: 1px' )
868+ expect ( css ) . toContain ( 'height: 1px' )
869+ expect ( css ) . toContain ( 'padding: 0' )
870+ expect ( css ) . toContain ( 'margin: -1px' )
871+ expect ( css ) . toContain ( 'overflow: hidden' )
872+ expect ( css ) . toContain ( 'clip: rect(0, 0, 0, 0)' )
873+ expect ( css ) . toContain ( 'white-space: nowrap' )
874+ expect ( css ) . toContain ( 'border-width: 0' )
875+ } )
876+
877+ it ( 'should handle not-sr-only utility' , ( ) => {
878+ const gen = new CSSGenerator ( defaultConfig )
879+ gen . generate ( 'not-sr-only' )
880+ const css = gen . toCSS ( false )
881+ expect ( css ) . toContain ( 'position: static' )
882+ expect ( css ) . toContain ( 'width: auto' )
883+ expect ( css ) . toContain ( 'height: auto' )
884+ expect ( css ) . toContain ( 'padding: 0' )
885+ expect ( css ) . toContain ( 'margin: 0' )
886+ expect ( css ) . toContain ( 'overflow: visible' )
887+ expect ( css ) . toContain ( 'clip: auto' )
888+ expect ( css ) . toContain ( 'white-space: normal' )
889+ } )
890+
891+ it ( 'should handle accessibility in forms' , ( ) => {
892+ const gen = new CSSGenerator ( defaultConfig )
893+ // sr-only is typically used for labels and screen reader text
894+ gen . generate ( 'sr-only' )
895+ const css = gen . toCSS ( false )
896+ // Verify all required properties for accessibility
897+ expect ( css ) . toContain ( 'position' )
898+ expect ( css ) . toContain ( 'width' )
899+ expect ( css ) . toContain ( 'height' )
900+ } )
901+ } )
690902} )
0 commit comments