@@ -98,7 +98,7 @@ public function test_content_image_without_lazy_loading_does_not_have_auto_sizes
9898 * Test generated markup for an image with 'auto' keyword already present in sizes does not receive it again.
9999 *
100100 * @covers ::auto_sizes_update_image_attributes
101- * @covers ::auto_sizes_attribute_includes_auto
101+ * @covers ::auto_sizes_attribute_includes_valid_auto
102102 * @dataProvider data_image_with_existing_auto_sizes
103103 */
104104 public function test_image_with_existing_auto_sizes_is_not_processed_again ( string $ initial_sizes , bool $ expected_processed ): void {
@@ -123,7 +123,7 @@ public function test_image_with_existing_auto_sizes_is_not_processed_again( stri
123123 * Test content filtered markup with 'auto' keyword already present in sizes does not receive it again.
124124 *
125125 * @covers ::auto_sizes_update_content_img_tag
126- * @covers ::auto_sizes_attribute_includes_auto
126+ * @covers ::auto_sizes_attribute_includes_valid_auto
127127 * @dataProvider data_image_with_existing_auto_sizes
128128 */
129129 public function test_content_image_with_existing_auto_sizes_is_not_processed_again ( string $ initial_sizes , bool $ expected_processed ): void {
@@ -168,33 +168,41 @@ public function data_image_with_existing_auto_sizes(): array {
168168 'auto, (max-width: 1024px) 100vw, 1024px ' ,
169169 false ,
170170 ),
171+ 'sole keyword ' => array (
172+ 'auto ' ,
173+ false ,
174+ ),
175+ 'with space before ' => array (
176+ ' auto, (max-width: 1024px) 100vw, 1024px ' ,
177+ false ,
178+ ),
179+ 'with uppercase ' => array (
180+ 'AUTO, (max-width: 1024px) 100vw, 1024px ' ,
181+ false ,
182+ ),
183+
184+ /*
185+ * The following scenarios technically include the 'auto' keyword,
186+ * but it is in the wrong place, as per the HTML spec it must be
187+ * the first entry in the list.
188+ * Therefore in these invalid cases the 'auto' keyword should still
189+ * be added to the beginning of the list.
190+ */
171191 'within, without space ' => array (
172192 '(max-width: 1024px) 100vw, auto,1024px ' ,
173- false ,
193+ true ,
174194 ),
175195 'within, with space ' => array (
176196 '(max-width: 1024px) 100vw, auto, 1024px ' ,
177- false ,
197+ true ,
178198 ),
179199 'at the end, without space ' => array (
180200 '(max-width: 1024px) 100vw,auto ' ,
181- false ,
201+ true ,
182202 ),
183203 'at the end, with space ' => array (
184204 '(max-width: 1024px) 100vw, auto ' ,
185- false ,
186- ),
187- 'sole keyword ' => array (
188- 'auto ' ,
189- false ,
190- ),
191- 'with space at beginning ' => array (
192- ' auto, (max-width: 1024px) 100vw, 1024px ' ,
193- false ,
194- ),
195- 'with uppercase ' => array (
196- 'AUTO, (max-width: 1024px) 100vw, 1024px ' ,
197- false ,
205+ true ,
198206 ),
199207 );
200208 }
0 commit comments