Skip to content

Commit

Permalink
Document placeholder and noscript images
Browse files Browse the repository at this point in the history
When JS is disabled, whatever is inside the noscript tag will be
shown, in this case a person's image. Also, if a person doesn't
have an image, a placeholder image will be shown. There where
no tests to document that, so this commit adds them.
  • Loading branch information
octopusinvitro committed Nov 15, 2016
1 parent 6f757b7 commit ec235c9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions t/web/term_table/ni.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,21 @@
end

it 'should start with a placeholder image, but have proxy set' do
img = annalo.css('img.person-card__image')
img = annalo.css('img.person-card__image')[0]
img.attr('src').must_equal '/images/person-placeholder-108px.png'
img.attr('data-src').must_include 'politician-image-proxy'
end

it 'should have an image if JavaScript is disabled' do
img = annalo.css('img.person-card__image')[1]
img.attr('src').must_include 'politician-image-proxy'
img.attr('data-src').must_be_nil
end

it 'has only a placeholder image if the person has no image' do
img = mcquillan.css('img.person-card__image')
img.size.must_equal 1
img.attr('src').text.must_equal '/images/person-placeholder-108px.png'
img.attr('data-src').text.must_include 'politician-image-proxy'
end
end
end

0 comments on commit ec235c9

Please sign in to comment.