From 7062ce7d78ea066c87cc52fecd6710e0082bf80c Mon Sep 17 00:00:00 2001 From: Samuel Elh <7893147+elhardoum@users.noreply.github.com> Date: Sun, 8 Oct 2017 04:26:00 +0100 Subject: [PATCH] Add layout attribute to amp-img (#9) * Add attribute to amp-img * assert build-pass (#9) --- spec/Converter/ImageConverterSpec.php | 2 ++ src/Converter/ImageConverter.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/Converter/ImageConverterSpec.php b/spec/Converter/ImageConverterSpec.php index c068a26..676cfae 100644 --- a/spec/Converter/ImageConverterSpec.php +++ b/spec/Converter/ImageConverterSpec.php @@ -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); @@ -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') diff --git a/src/Converter/ImageConverter.php b/src/Converter/ImageConverter.php index 3d9fa9f..8cdc665 100644 --- a/src/Converter/ImageConverter.php +++ b/src/Converter/ImageConverter.php @@ -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)