File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
require "test_helper"
2
2
3
3
class Tailwindcss ::PurgerTest < ActiveSupport ::TestCase
4
+ test "extract class names" do
5
+ assert_equal %w[ div class max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 ] . sort ,
6
+ %(<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">) . scan ( Tailwindcss ::Purger ::CLASS_NAME_PATTERN ) . flatten . sort
7
+ end
8
+
4
9
test "basic purge" do
5
- purger = Tailwindcss ::Purger . new (
6
- stylesheet_path : Pathname . new ( __FILE__ ) . join ( "../../app/assets/stylesheets/tailwindcss/tailwind.css" ) ,
7
- paths_with_css_class_names : [ "app/views/**/*.html*" , "app/helpers/**/*.rb" ]
8
- )
10
+ purger = Tailwindcss ::Purger . new ( paths_with_css_class_names : [ "app/views/**/*.html*" , "app/helpers/**/*.rb" ] )
11
+ purged = purger . purge ( Pathname . new ( __FILE__ ) . join ( "../../app/assets/stylesheets/tailwind.css" ) . read )
9
12
10
- assert_not purger . purge =~ /.mt-6 \{ /
11
- assert purger . purge =~ /.mt-10 \{ /
13
+ assert_not purged =~ /.mt-6 \{ /
14
+ assert purged =~ /.mt-10 \{ /
12
15
end
13
16
end
You can’t perform that action at this time.
0 commit comments