Skip to content

Commit

Permalink
Add test for sizes attribute being removed from converted img
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Apr 2, 2019
1 parent 93ce9e8 commit a82a87f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test-amp-img-sanitizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ public function get_data() {
'<amp-img src="http://placehold.it/100x100" layout="fixed" width="100" height="100"><noscript><img src="http://placehold.it/100x100" width="100" height="100"></noscript></amp-img>',
null,
),

'img_with_sizes_attribute_removed' => array(
'<img width="825" height="510" src="http://placehold.it/825x510" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" sizes="(max-width: 34.9rem) calc(100vw - 2rem), (max-width: 53rem) calc(8 * (100vw / 12)), (min-width: 53rem) calc(6 * (100vw / 12)), 100vw">',
'<amp-img width="825" height="510" src="http://placehold.it/825x510" class="attachment-post-thumbnail size-post-thumbnail wp-post-image amp-wp-enforced-sizes" alt="" layout="intrinsic"><noscript><img width="825" height="510" src="http://placehold.it/825x510" class="attachment-post-thumbnail size-post-thumbnail wp-post-image" alt="" sizes="(max-width: 34.9rem) calc(100vw - 2rem), (max-width: 53rem) calc(8 * (100vw / 12)), (min-width: 53rem) calc(6 * (100vw / 12)), 100vw"></noscript></amp-img>',
),

'amp_img_with_sizes_attribute_retained' => array(
'<amp-img width="825" height="510" src="http://placehold.it/825x510" alt="" layout="intrinsic"></amp-img>',
null,
),
);
}

Expand Down

0 comments on commit a82a87f

Please sign in to comment.