Skip to content

Commit

Permalink
Update OptimizeHeroImages::generateImg() test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
thelovekesh committed Oct 24, 2023
1 parent f08ade9 commit 16b9f66
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/Optimizer/Transformer/OptimizeHeroImagesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,18 @@ public function dataTransform()
),
],

'automatically ssr img element with high fetchpriority attribute from noscript fallback img' => [
'automatically ssr img element with high fetchpriority attribute from noscript fallback img even when not a hero image' => [
$input(
'<amp-img width="500" height="400" src="/img1.png"><noscript><img src="/img1.png" width="500" height="400" fetchpriority="high"></noscript></amp-img>'
. '<amp-img width="500" height="400" src="/img2.png"><noscript><img src="/img2.png" width="500" height="400"></noscript></amp-img>'
. '<amp-img width="500" height="400" src="/img3.png"><noscript><img src="/img3.png" width="500" height="400" fetchpriority="high"></noscript></amp-img>'
'<amp-img width="500" height="400" src="/img1.png"></amp-img>'
. '<p>Hello World 1</p>'
. '<p>Hello World 2</p>'
. '<amp-img width="500" height="400" src="/img2.png"><noscript><img src="/img2.png" width="500" height="400" fetchpriority="high"></noscript></amp-img>'
),
$output(
'<amp-img data-hero width="500" height="400" src="/img1.png" i-amphtml-ssr><img class="i-amphtml-fill-content i-amphtml-replaced-content" decoding="async" fetchpriority="high" src="/img1.png"></amp-img>'
. '<amp-img width="500" height="400" src="/img2.png"><noscript><img src="/img2.png" width="500" height="400"></noscript></amp-img>'
. '<amp-img data-hero width="500" height="400" src="/img3.png" i-amphtml-ssr><img class="i-amphtml-fill-content i-amphtml-replaced-content" decoding="async" fetchpriority="high" src="/img3.png"></amp-img>'
'<amp-img width="500" height="400" src="/img1.png"></amp-img>'
. '<p>Hello World 1</p>'
. '<p>Hello World 2</p>'
. '<amp-img data-hero width="500" height="400" src="/img2.png" i-amphtml-ssr><img class="i-amphtml-fill-content i-amphtml-replaced-content" decoding="async" fetchpriority="high" src="/img2.png"></amp-img>'
),
],
];
Expand Down

0 comments on commit 16b9f66

Please sign in to comment.