diff options
author | Cameron Cundiff <github@ckundo.com> | 2017-08-16 14:34:02 -0400 |
---|---|---|
committer | Cameron Cundiff <github@ckundo.com> | 2017-08-17 16:13:15 -0400 |
commit | 9a74c7b99bf0ac901f86bb38372a68e157cf9c73 (patch) | |
tree | 35baa306f1853c73aeb1088fa1fbfda5ea8e0d13 /actionmailer/test | |
parent | d2f493c7ed7a95f48730aecdcfbcc7bbee30921b (diff) | |
download | rails-9a74c7b99bf0ac901f86bb38372a68e157cf9c73.tar.gz rails-9a74c7b99bf0ac901f86bb38372a68e157cf9c73.tar.bz2 rails-9a74c7b99bf0ac901f86bb38372a68e157cf9c73.zip |
Do not generate default alt text in image tags
- Auto-generating content from the filename of an image is not suitable
alternative text; alt text that isn't fully considered can be
distracting and fatiguing for screen readers users (blind, low vision,
dyslexic people).
- Setting a filename fallback short circuits screen reader default
behavior and configuration for blank descriptions.
- Setting poor defaults also creates false negatives for accessibility
linting and testing software, that makes it harder to improve
application accessibility.
***
- After this change, if authors leave images without alt text, screen
readers will fallback to default behavior for missing alt text.
- Also with this change, Automated linting and testing tools will
correctly generate warnings.
[Fixes #30096]
Diffstat (limited to 'actionmailer/test')
-rw-r--r-- | actionmailer/test/asset_host_test.rb | 4 | ||||
-rw-r--r-- | actionmailer/test/base_test.rb | 4 | ||||
-rw-r--r-- | actionmailer/test/url_test.rb | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/actionmailer/test/asset_host_test.rb b/actionmailer/test/asset_host_test.rb index 2a14248488..9cd8cae88c 100644 --- a/actionmailer/test/asset_host_test.rb +++ b/actionmailer/test/asset_host_test.rb @@ -24,7 +24,7 @@ class AssetHostTest < ActionMailer::TestCase def test_asset_host_as_string mail = AssetHostMailer.email_with_asset - assert_dom_equal '<img alt="Somelogo" src="http://www.example.com/images/somelogo.png" />', mail.body.to_s.strip + assert_dom_equal '<img src="http://www.example.com/images/somelogo.png" />', mail.body.to_s.strip end def test_asset_host_as_one_argument_proc @@ -34,6 +34,6 @@ class AssetHostTest < ActionMailer::TestCase end } mail = AssetHostMailer.email_with_asset - assert_dom_equal '<img alt="Somelogo" src="http://images.example.com/images/somelogo.png" />', mail.body.to_s.strip + assert_dom_equal '<img src="http://images.example.com/images/somelogo.png" />', mail.body.to_s.strip end end diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb index d029329497..0da969c349 100644 --- a/actionmailer/test/base_test.rb +++ b/actionmailer/test/base_test.rb @@ -578,7 +578,7 @@ class BaseTest < ActiveSupport::TestCase mail = AssetMailer.welcome - assert_dom_equal(%{<img alt="Dummy" src="http://global.com/images/dummy.png" />}, mail.body.to_s.strip) + assert_dom_equal(%{<img src="http://global.com/images/dummy.png" />}, mail.body.to_s.strip) end test "assets tags should use a Mailer's asset_host settings when available" do @@ -592,7 +592,7 @@ class BaseTest < ActiveSupport::TestCase mail = TempAssetMailer.welcome - assert_dom_equal(%{<img alt="Dummy" src="http://local.com/images/dummy.png" />}, mail.body.to_s.strip) + assert_dom_equal(%{<img src="http://local.com/images/dummy.png" />}, mail.body.to_s.strip) end test "the view is not rendered when mail was never called" do diff --git a/actionmailer/test/url_test.rb b/actionmailer/test/url_test.rb index 0bd3371878..82035689ad 100644 --- a/actionmailer/test/url_test.rb +++ b/actionmailer/test/url_test.rb @@ -121,7 +121,7 @@ class ActionMailerUrlTest < ActionMailer::TestCase expected = new_mail expected.to = @recipient expected.subject = "[Signed up] Welcome #{@recipient}" - expected.body = "Hello there,\n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting http://www.basecamphq.com/welcome\n\n<img alt=\"Somelogo\" src=\"/images/somelogo.png\" />" + expected.body = "Hello there,\n\nMr. #{@recipient}. Please see our greeting at http://example.com/welcome/greeting http://www.basecamphq.com/welcome\n\n<img src=\"/images/somelogo.png\" />" expected.from = "system@loudthinking.com" expected.date = Time.local(2004, 12, 12) expected.content_type = "text/html" |