Skip to content

Commit 557766d

Browse files
committed
Add failing test to cover empty to value
1 parent 9eec49a commit 557766d

File tree

5 files changed

+8
-0
lines changed

5 files changed

+8
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
//= link_tree ../images
22
//= link_directory ../stylesheets .css
33
//= link_tree ../../javascript .js
4+
//= link_tree ../../components .js
45
//= link_tree ../../../lib/assets/javascripts .js

test/dummy/app/components/another_component_controller.js

Whitespace-only changes.

test/dummy/app/components/spina/component_controller.js

Whitespace-only changes.

test/dummy/config/initializers/assets.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
# Add additional assets to the asset load path.
77
# Rails.application.config.assets.paths << Emoji.images_path
8+
Rails.application.config.assets.paths << "app/components"
89

910
# Precompile additional assets.
1011
# application.js, application.css, and all non-JS/CSS in the app/assets

test/importmap_test.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def setup
1414
pin_all_from "app/javascript/spina/controllers", under: "controllers/spina", to: "spina/controllers", preload: true
1515
pin_all_from "app/javascript/helpers", under: "helpers", preload: true
1616
pin_all_from "lib/assets/javascripts", preload: true
17+
pin_all_from "app/components", under: "controllers", to: "", preload: true
1718
end
1819
end
1920
end
@@ -52,6 +53,11 @@ def setup
5253
assert_match %r|assets/spina/controllers/deeper/again_controller-.*\.js|, generate_importmap_json["imports"]["controllers/spina/deeper/again_controller"]
5354
end
5455

56+
test "directory pin under custom asset path with empty to" do
57+
assert_match %r|assets/spina/component_controller-.*\.js|, generate_importmap_json["imports"]["controllers/spina/component_controller"]
58+
assert_match %r|assets/another_component_controller-.*\.js|, generate_importmap_json["imports"]["controllers/another_component_controller"]
59+
end
60+
5561
test "directory pin without path or under" do
5662
assert_match %r|assets/my_lib-.*\.js|, generate_importmap_json["imports"]["my_lib"]
5763
end

0 commit comments

Comments
 (0)