diff options
author | Marc-Andre Lafortune <github@marc-andre.ca> | 2010-05-15 09:42:02 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-05-15 09:43:15 +0200 |
commit | 9869ee77cdbf8f0e9c7eb6e33738d0aa8f5dc70a (patch) | |
tree | 6cd35f18999bfafa552fe017f9ff0ea14d70cff5 /actionpack | |
parent | 7ffe76046ad142377bf6b286f4477b09513d1e37 (diff) | |
download | rails-9869ee77cdbf8f0e9c7eb6e33738d0aa8f5dc70a.tar.gz rails-9869ee77cdbf8f0e9c7eb6e33738d0aa8f5dc70a.tar.bz2 rails-9869ee77cdbf8f0e9c7eb6e33738d0aa8f5dc70a.zip |
Accept :alt => nil on image_tag [#4558 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 8731ed0ef3..e1fbc118d5 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -620,7 +620,7 @@ module ActionView options.symbolize_keys! src = options[:src] = path_to_image(source) - options[:alt] ||= File.basename(src, '.*').capitalize + options[:alt] = options.fetch(:alt){ File.basename(src, '.*').capitalize } if size = options.delete(:size) options[:width], options[:height] = size.split("x") if size =~ %r{^\d+x\d+$} diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 124bf734ac..b6a6f52876 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -154,7 +154,8 @@ class AssetTagHelperTest < ActionView::TestCase %(image_tag(".pdf.png")) => %(<img alt=".pdf" src="/images/.pdf.png" />), %(image_tag("http://www.rubyonrails.com/images/rails.png")) => %(<img alt="Rails" src="http://www.rubyonrails.com/images/rails.png" />), %(image_tag("mouse.png", :mouseover => "/images/mouse_over.png")) => %(<img alt="Mouse" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" src="/images/mouse.png" />), - %(image_tag("mouse.png", :mouseover => image_path("mouse_over.png"))) => %(<img alt="Mouse" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" src="/images/mouse.png" />) + %(image_tag("mouse.png", :mouseover => image_path("mouse_over.png"))) => %(<img alt="Mouse" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" src="/images/mouse.png" />), + %(image_tag("mouse.png", :alt => nil)) => %(<img src="/images/mouse.png" />) } FaviconLinkToTag = { |