aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorthenickcox <nick@nickcox.me>2013-02-07 23:07:42 -0800
committerthenickcox <nick@nickcox.me>2013-02-09 20:29:52 -0800
commitdd9f8bc84740654057ddfc26428a4411f151c957 (patch)
treea5450b75f577acff436f03afce589b668c135316 /actionpack/test/template
parent408227d9c5ed7de26310d72a1a99c1ee02311c63 (diff)
downloadrails-dd9f8bc84740654057ddfc26428a4411f151c957.tar.gz
rails-dd9f8bc84740654057ddfc26428a4411f151c957.tar.bz2
rails-dd9f8bc84740654057ddfc26428a4411f151c957.zip
Improve img alt attribute for screen readers
Currently, the img_alt method in ActionView keeps underscores in the alt attribute. Because underscores are pronounced in Apple's VoiceOver Utility, this has serious implications for accessibility. This patch makes underscored or hyphenated file names (both common in projects) read more naturally in screen readers by replacing them with spaces. See method documentation for details. Added documentation to image_alt method
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/asset_tag_helper_test.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb
index 82c9d383ac..11614a45dc 100644
--- a/actionpack/test/template/asset_tag_helper_test.rb
+++ b/actionpack/test/template/asset_tag_helper_test.rb
@@ -443,7 +443,8 @@ class AssetTagHelperTest < ActionView::TestCase
[nil, '/', '/foo/bar/', 'foo/bar/'].each do |prefix|
assert_equal 'Rails', image_alt("#{prefix}rails.png")
assert_equal 'Rails', image_alt("#{prefix}rails-9c0a079bdd7701d7e729bd956823d153.png")
- assert_equal 'Avatar-0000', image_alt("#{prefix}avatar-0000.png")
+ assert_equal 'Long file name with hyphens', image_alt("#{prefix}long-file-name-with-hyphens.png")
+ assert_equal 'Long file name with underscores', image_alt("#{prefix}long_file_name_with_underscores.png")
end
end