mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Pass extensions to javascript_path and stylesheet_path helpers. Closes #3417
This commit is contained in:
parent
180edc84f1
commit
cbe918093b
2 changed files with 8 additions and 2 deletions
|
@ -69,12 +69,12 @@ module Sprockets
|
||||||
alias_method :path_to_font, :font_path # aliased to avoid conflicts with an font_path named route
|
alias_method :path_to_font, :font_path # aliased to avoid conflicts with an font_path named route
|
||||||
|
|
||||||
def javascript_path(source)
|
def javascript_path(source)
|
||||||
path_to_asset(source)
|
path_to_asset(source, :ext => 'js')
|
||||||
end
|
end
|
||||||
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with an javascript_path named route
|
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with an javascript_path named route
|
||||||
|
|
||||||
def stylesheet_path(source)
|
def stylesheet_path(source)
|
||||||
path_to_asset(source)
|
path_to_asset(source, :ext => 'css')
|
||||||
end
|
end
|
||||||
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with an stylesheet_path named route
|
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with an stylesheet_path named route
|
||||||
|
|
||||||
|
|
|
@ -157,6 +157,9 @@ class SprocketsHelperTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test "javascript_path" do
|
test "javascript_path" do
|
||||||
|
assert_match %r{/assets/application-[0-9a-f]+.js},
|
||||||
|
javascript_path("application")
|
||||||
|
|
||||||
assert_match %r{/assets/application-[0-9a-f]+.js},
|
assert_match %r{/assets/application-[0-9a-f]+.js},
|
||||||
javascript_path("application.js")
|
javascript_path("application.js")
|
||||||
|
|
||||||
|
@ -165,6 +168,9 @@ class SprocketsHelperTest < ActionView::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
test "stylesheet_path" do
|
test "stylesheet_path" do
|
||||||
|
assert_match %r{/assets/application-[0-9a-f]+.css},
|
||||||
|
stylesheet_path("application")
|
||||||
|
|
||||||
assert_match %r{/assets/application-[0-9a-f]+.css},
|
assert_match %r{/assets/application-[0-9a-f]+.css},
|
||||||
stylesheet_path("application.css")
|
stylesheet_path("application.css")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue