open Tailwind let test_tw_combinator () = let classes = Css.tw [ Color.bg (Color.make `Blue ~variant:`V500 ()); Effects.rounded_md; Spacing.(to_class (p (Size.rem 1.0))); ] in let result = to_string classes in Alcotest.(check bool) "contains bg-blue-500" (String.contains_s result "bg-blue-500"); Alcotest.(check bool) "contains rounded-md" (String.contains_s result "rounded-md") let test_class_list_conditional () = let classes = class_list [ (Color.bg (Color.make `Red ()), true); (Color.text (Color.make `White ()), false); (Effects.shadow_lg, true); ] in let result = to_string classes in Alcotest.(check bool) "contains red background" (String.contains_s result "bg-red"); Alcotest.(check bool) "excludes white text" (not (String.contains_s result "text-white")); Alcotest.(check bool) "contains shadow" (String.contains_s result "shadow-lg") let test_focus_ring () = let ring = focus_ring () in let result = to_string ring in Alcotest.(check bool) "contains focus styles" (String.contains_s result "focus") let test_focus_ring_with_color () = let blue = Color.make `Blue ~variant:`V500 () in let ring = focus_ring ~color:blue () in let result = to_string ring in Alcotest.(check bool) "contains focus styles" (String.contains_s result "focus") let test_sr_only () = let sr = sr_only in let result = to_string sr in Alcotest.(check string) "screen reader only" "sr-only" result let test_module_integration () = let complex_button = Css.tw [ Color.bg (Color.make `Blue ~variant:`V500 ()); Color.text (Color.make `White ()); Spacing.(to_class (px (Size.rem 1.0))); Spacing.(to_class (py (Size.rem 0.5))); Effects.rounded_md; Effects.shadow_sm; Effects.transition `Colors; Variants.hover (Color.bg (Color.make `Blue ~variant:`V600 ())); ] in let result = to_string complex_button in Alcotest.(check bool) "integration works" (String.length result > 0) let suite = [ "tw_combinator", `Quick, test_tw_combinator; "class_list_conditional", `Quick, test_class_list_conditional; "focus_ring", `Quick, test_focus_ring; "focus_ring_with_color", `Quick, test_focus_ring_with_color; "sr_only", `Quick, test_sr_only; "module_integration", `Quick, test_module_integration; ]