Skip to content

Commit

Permalink
Add layout attribute to amp-img (#9)
Browse files Browse the repository at this point in the history
* Add  attribute to amp-img

* assert build-pass (#9)
  • Loading branch information
elhardoum authored and paulredmond committed Oct 8, 2017
1 parent 91fb7f0 commit 7062ce7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions spec/Converter/ImageConverterSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function it_converts_an_image_to_amp_img(
$ampImg->setAttribute('srcset', '')->shouldNotBeCalled();
$ampImg->setAttribute('alt', '')->shouldNotBeCalled();
$ampImg->setAttribute('attribution', '')->shouldNotBeCalled();
$ampImg->setAttribute('layout', '')->shouldNotBeCalled();

$element->getAttribute('src')->shouldBeCalled()->willReturn('foo.jpg');
$element->getAttribute('width')->shouldBeCalled()->willReturn(300);
Expand All @@ -36,6 +37,7 @@ public function it_converts_an_image_to_amp_img(
$element->getAttribute('srcset')->shouldBeCalled()->willReturn('');
$element->getAttribute('alt')->shouldBeCalled()->willReturn('');
$element->getAttribute('attribution')->shouldBeCalled()->willReturn('');
$element->getAttribute('layout')->shouldBeCalled()->willReturn('');

$element
->createWritableElement('amp-img')
Expand Down
2 changes: 1 addition & 1 deletion src/Converter/ImageConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class ImageConverter implements ConverterInterface
{
private $validAttributes = [
'src', 'width', 'height', 'srcset', 'alt', 'attribution', 'class'
'src', 'width', 'height', 'srcset', 'alt', 'attribution', 'class', 'layout'
];

public function handleTagImg(EventInterface $event, ElementInterface $element)
Expand Down

0 comments on commit 7062ce7

Please sign in to comment.