@@ -12,9 +12,7 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase
12
12
end
13
13
14
14
test "basic purge" do
15
- purged = Tailwindcss ::Purger . purge \
16
- Pathname . new ( __FILE__ ) . join ( "../../app/assets/stylesheets/tailwind.css" ) . read ,
17
- keeping_class_names_from_files : Pathname ( __dir__ ) . glob ( "fixtures/*.html.erb" )
15
+ purged = purged_tailwind_from_fixtures
18
16
19
17
assert purged !~ /.mt-6 \{ /
20
18
@@ -23,4 +21,28 @@ class Tailwindcss::PurgerTest < ActiveSupport::TestCase
23
21
assert purged =~ /.translate-x-1\\ \/ 2 \{ /
24
22
assert purged =~ /.mt-10 \{ /
25
23
end
24
+
25
+ test "purge shouldn't remove hover or focus classes" do
26
+ purged = purged_tailwind_from_fixtures
27
+ assert purged =~ /.hover\\ \: text-gray-500\: hover \{ /
28
+ assert purged =~ /.focus\\ \: outline-none\: focus \{ /
29
+ assert purged =~ /.focus-within\\ \: outline-black\: focus-within \{ /
30
+ end
31
+
32
+ test "purge shouldn't remove placeholder selectors" do
33
+ purged = Tailwindcss ::Purger . purge \
34
+ Pathname . new ( __FILE__ ) . join ( "../../app/assets/stylesheets/tailwind.css" ) . read ,
35
+ keeping_class_names_from_files : Pathname ( __dir__ ) . join ( "fixtures/placeholders.html.erb" )
36
+
37
+ assert purged =~ /.placeholder-transparent\: \: -moz-placeholder \{ /
38
+ assert purged =~ /.placeholder-transparent\: -ms-input-placeholder \{ /
39
+ assert purged =~ /.placeholder-transparent\: \: placeholder \{ /
40
+ end
41
+
42
+ private
43
+ def purged_tailwind_from_fixtures
44
+ Tailwindcss ::Purger . purge \
45
+ Pathname . new ( __FILE__ ) . join ( "../../app/assets/stylesheets/tailwind.css" ) . read ,
46
+ keeping_class_names_from_files : Pathname ( __dir__ ) . glob ( "fixtures/*.html.erb" )
47
+ end
26
48
end
0 commit comments