-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use tidy-html5 to validate the term-table page
Errors corrected: - An "img" element must have an "alt" attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images. (All occurrences)
- Loading branch information
1 parent
d2ba218
commit 5662448
Showing
2 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# frozen_string_literal: true | ||
require 'test_helper' | ||
require_relative '../../../app' | ||
|
||
describe 'Phillipines' do | ||
subject { Nokogiri::HTML(last_response.body) } | ||
let(:dina) { subject.css('#mem-c5c42ac6-4942-4c32-baf7-3dae194f83bf') } | ||
let(:dimaporo) { subject.css('#mem-236420bc-a15a-4727-a98a-75f870c5641f') } | ||
let(:tiangco) { subject.css('#mem-8fd6197f-f9fa-47a8-974f-50c54f08bbdd') } | ||
|
||
before do | ||
stub_popolo('ba933fa', 'Philippines/House') | ||
get '/philippines/house/term-table/16.html' | ||
end | ||
|
||
describe 'alt attribute on avatars' do | ||
it 'has the person name in a normal image' do | ||
img = dina.css('img.person-card__image') | ||
img.attr('alt').text.must_equal 'Member headshot for Abad, Henedina R.' | ||
end | ||
|
||
it 'has the person name in a placeholder image' do | ||
img = dimaporo.css('img.person-card__image') | ||
img.attr('alt').text.must_equal 'Placeholder image for Dimaporo, Abdullah D.' | ||
end | ||
|
||
it 'doesnt break for names with double quotes' do | ||
img = tiangco.css('img.person-card__image') | ||
img.attr('alt').text.must_equal 'Member headshot for Tiangco, Tobias "Toby" M.' | ||
end | ||
end | ||
|
||
describe 'HTML validation' do | ||
it 'has no errors in the term-table page' do | ||
last_response_must_be_valid | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters