File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 11require "test_helper"
22
33class 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+
49 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 )
912
10- assert_not purger . purge =~ /.mt-6 \{ /
11- assert purger . purge =~ /.mt-10 \{ /
13+ assert_not purged =~ /.mt-6 \{ /
14+ assert purged =~ /.mt-10 \{ /
1215 end
1316end
You can’t perform that action at this time.
0 commit comments