@@ -13,6 +13,8 @@ class ActionText::Generators::InstallGeneratorTest < Rails::Generators::TestCase
13
13
FileUtils . mkdir_p ( "#{ destination_root } /app/javascript" )
14
14
FileUtils . touch ( "#{ destination_root } /app/javascript/application.js" )
15
15
16
+ FileUtils . mkdir_p ( "#{ destination_root } /app/assets/stylesheets" )
17
+
16
18
FileUtils . mkdir_p ( "#{ destination_root } /config" )
17
19
FileUtils . touch ( "#{ destination_root } /config/importmap.rb" )
18
20
end
@@ -56,6 +58,32 @@ class ActionText::Generators::InstallGeneratorTest < Rails::Generators::TestCase
56
58
assert_file "app/assets/stylesheets/actiontext.css"
57
59
end
58
60
61
+ test "appends @import 'actiontext.css' to base scss file" do
62
+ FileUtils . touch ( "#{ destination_root } /app/assets/stylesheets/application.bootstrap.scss" )
63
+
64
+ run_generator_instance
65
+
66
+ assert_file "app/assets/stylesheets/application.bootstrap.scss" do |content |
67
+ assert_match "@import 'actiontext.css';" , content
68
+ end
69
+ end
70
+
71
+
72
+ test "appends @import 'actiontext.css'; to base css file" do
73
+ FileUtils . touch ( "#{ destination_root } /app/assets/stylesheets/application.postcss.css" )
74
+
75
+ run_generator_instance
76
+
77
+ assert_file "app/assets/stylesheets/application.postcss.css" do |content |
78
+ assert_match "@import 'actiontext.css';" , content
79
+ end
80
+ end
81
+
82
+ test "throws a warning for missing base (s)css file" do
83
+ assert_match "To use the Trix editor, you must require 'app/assets/stylesheets/actiontext.css' in your base stylesheet." ,
84
+ run_generator_instance
85
+ end
86
+
59
87
test "creates Active Storage view partial" do
60
88
run_generator_instance
61
89
assert_file "app/views/active_storage/blobs/_blob.html.erb"
0 commit comments