Skip to content

Commit

Permalink
core(aspectratio): ignore placeholder images (#6305)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDem authored and patrickhulce committed Oct 22, 2018
1 parent 508d60d commit 3e40948
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lighthouse-core/audits/image-aspect-ratio.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class ImageAspectRatio extends Audit {
// - filter all svgs as they have no natural dimensions to audit
return image.networkRecord &&
image.networkRecord.mimeType !== 'image/svg+xml' &&
image.naturalHeight > 5 &&
image.naturalWidth > 5 &&
image.width &&
image.height &&
!image.usesObjectFit;
Expand Down
7 changes: 3 additions & 4 deletions lighthouse-core/test/audits/image-aspect-ratio-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ describe('Images: aspect-ratio audit', () => {
},
});

testImage('has invalid natural sizing information', {
testImage('is placeholder image', {
rawValue: true,
warning: 'Invalid image sizing information https://google.com/logo.png',
clientSize: [100, 100],
naturalSize: [0, 0],
clientSize: [300, 220],
naturalSize: [1, 1],
props: {
isCss: false,
usesObjectFit: false,
Expand Down

0 comments on commit 3e40948

Please sign in to comment.