Skip to content

Commit

Permalink
Merge pull request rails#3718 from lest/fix-javascript-include-tag
Browse files Browse the repository at this point in the history
javascript_include_tag should add '.js' to sources that contain '.'
  • Loading branch information
josevalim committed Nov 22, 2011
2 parents 39ecbfd + aa491f6 commit b13b49c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/sprockets/helpers/rails_helper.rb
Expand Up @@ -154,7 +154,7 @@ def rewrite_asset_path(source, dir, options = {})
end

def rewrite_extension(source, dir, ext)
if ext && File.extname(source).empty?
if ext && File.extname(source) != ".#{ext}"
"#{source}.#{ext}"
else
source
Expand Down
3 changes: 3 additions & 0 deletions actionpack/test/template/sprockets_helper_test.rb
Expand Up @@ -217,6 +217,9 @@ def config
assert_match %r{<script src="/assets/xmlhr-[0-9a-f]+.js\?body=1" type="text/javascript"></script>\n<script src="/assets/application-[0-9a-f]+.js\?body=1" type="text/javascript"></script>},
javascript_include_tag(:application, :debug => true)

assert_match %r{<script src="/assets/jquery.plugin.js" type="text/javascript"></script>},
javascript_include_tag('jquery.plugin', :digest => false)

@config.assets.compile = true
@config.assets.debug = true
assert_match %r{<script src="/javascripts/application.js" type="text/javascript"></script>},
Expand Down

0 comments on commit b13b49c

Please sign in to comment.