Skip to content

Commit

Permalink
Propagage importance (#36244)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferbaxter committed Oct 5, 2021
1 parent e2a9689 commit a690bd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/builtins/amp-img/amp-img.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const ATTRIBUTES_TO_PROPAGATE = [
'crossorigin',
'referrerpolicy',
'title',
'importance',
'sizes',
'srcset',
'src',
Expand Down
12 changes: 12 additions & 0 deletions test/unit/builtins/test-amp-img.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ describes.sandboxed('amp-img', {}, (env) => {
});
});

it('should propagate importance', () => {
return getImg({
src: '/examples/img/sample.jpg',
importance: 'high',
width: 320,
height: 240,
}).then((ampImg) => {
const img = ampImg.querySelector('img');
expect(img.getAttribute('importance')).to.equal('high');
});
});

it('should propagate data attributes', () => {
return getImg({
src: '/examples/img/sample.jpg',
Expand Down

0 comments on commit a690bd4

Please sign in to comment.