Skip to content

Commit 2bea430

Browse files
authored
Merge pull request #1838 from psu-libraries/1822-thumbnail-alt-text
add alt text to thumbnails
2 parents 88a3ba9 + a5fbdbf commit 2bea430

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="<%= html_classes %>">
22
<% if display_thumbnail? %>
3-
<img src="<%= thumbnail_url %>" class="bordered-thumbnail-image" alt="">
3+
<img src="<%= thumbnail_url %>" class="bordered-thumbnail-image" alt="Thumbnail image for <%= resource.title %>">
44
<% else %>
5-
<i class='material-icons material-icons--thumbnail'><%= icon %></i>
5+
<i class='material-icons material-icons--thumbnail' alt="Default thumbnail image for <%= resource.title %>"><%= icon %></i>
66
<% end %>
77
</div>

spec/features/resources_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@
313313
it 'displays the thumbnail' do
314314
expect(page).to have_css("img[src='url.com/path/file']")
315315
expect(page).to have_css('.thumbnail-card')
316+
thumbnail_img = page.find("img[src='url.com/path/file']")
317+
expect(thumbnail_img['alt']).to eq("Thumbnail image for #{work.latest_published_version.title}")
316318
end
317319
end
318320
end
@@ -439,6 +441,8 @@
439441
it 'displays the thumbnail' do
440442
expect(page).to have_css("img[src='url.com/path/file']")
441443
expect(page).to have_css('.thumbnail-card')
444+
thumbnail_img = page.find("img[src='url.com/path/file']")
445+
expect(thumbnail_img['alt']).to eq("Thumbnail image for #{collection.title}")
442446
end
443447
end
444448
end

0 commit comments

Comments
 (0)