Skip to content

Commit a92b899

Browse files
committed
Update test case to test for multiple sources
1 parent 7d2e654 commit a92b899

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugins/image-prioritizer/tests/test-cases/picture-element-as-lcp-tablet-and-desktop-metrics-missing.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static function () use ( $breakpoint_max_widths ) {
2323
'viewport_width' => $viewport_width,
2424
'elements' => array(
2525
array(
26-
'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::PICTURE]/*[2][self::IMG]',
26+
'xpath' => '/*[1][self::HTML]/*[2][self::BODY]/*[1][self::PICTURE]/*[3][self::IMG]',
2727
'isLCP' => true,
2828
),
2929
),
@@ -42,6 +42,7 @@ static function () use ( $breakpoint_max_widths ) {
4242
<body>
4343
<picture>
4444
<source type="image/avif" srcset="https://example.com/foo-300x225.avif 300w, https://example.com/foo-1024x768.avif 1024w, https://example.com/foo-768x576.avif 768w, https://example.com/foo-1536x1152.avif 1536w, https://example.com/foo-2048x1536.avif 2048w" sizes="(max-width: 600px) 480px, 800px">
45+
<source type="image/webp" srcset="https://example.com/foo-300x225.webp 300w, https://example.com/foo-1024x768.webp 1024w, https://example.com/foo-768x576.webp 768w, https://example.com/foo-1536x1152.webp 1536w, https://example.com/foo-2048x1536.webp 2048w" sizes="(max-width: 600px) 480px, 800px">
4546
<img fetchpriority="high" decoding="async" width="1200" height="800" src="https://example.com/foo.jpg" alt="Foo" srcset="https://example.com/foo-300x225.jpg 300w, https://example.com/foo-1024x768.jpg 1024w, https://example.com/foo-768x576.jpg 768w, https://example.com/foo-1536x1152.jpg 1536w, https://example.com/foo-2048x1536.jpg 2048w" sizes="(max-width: 600px) 480px, 800px">
4647
</picture>
4748
</body>
@@ -57,7 +58,8 @@ static function () use ( $breakpoint_max_widths ) {
5758
<body>
5859
<picture>
5960
<source type="image/avif" srcset="https://example.com/foo-300x225.avif 300w, https://example.com/foo-1024x768.avif 1024w, https://example.com/foo-768x576.avif 768w, https://example.com/foo-1536x1152.avif 1536w, https://example.com/foo-2048x1536.avif 2048w" sizes="(max-width: 600px) 480px, 800px">
60-
<img data-od-removed-fetchpriority="high" data-od-xpath="/*[1][self::HTML]/*[2][self::BODY]/*[1][self::PICTURE]/*[2][self::IMG]" decoding="async" width="1200" height="800" src="https://example.com/foo.jpg" alt="Foo" srcset="https://example.com/foo-300x225.jpg 300w, https://example.com/foo-1024x768.jpg 1024w, https://example.com/foo-768x576.jpg 768w, https://example.com/foo-1536x1152.jpg 1536w, https://example.com/foo-2048x1536.jpg 2048w" sizes="(max-width: 600px) 480px, 800px">
61+
<source type="image/webp" srcset="https://example.com/foo-300x225.webp 300w, https://example.com/foo-1024x768.webp 1024w, https://example.com/foo-768x576.webp 768w, https://example.com/foo-1536x1152.webp 1536w, https://example.com/foo-2048x1536.webp 2048w" sizes="(max-width: 600px) 480px, 800px">
62+
<img data-od-removed-fetchpriority="high" data-od-xpath="/*[1][self::HTML]/*[2][self::BODY]/*[1][self::PICTURE]/*[3][self::IMG]" decoding="async" width="1200" height="800" src="https://example.com/foo.jpg" alt="Foo" srcset="https://example.com/foo-300x225.jpg 300w, https://example.com/foo-1024x768.jpg 1024w, https://example.com/foo-768x576.jpg 768w, https://example.com/foo-1536x1152.jpg 1536w, https://example.com/foo-2048x1536.jpg 2048w" sizes="(max-width: 600px) 480px, 800px">
6163
</picture>
6264
<script type="module">/* import detect ... */</script>
6365
</body>

0 commit comments

Comments
 (0)