@@ -66,7 +66,7 @@ public function testRenderIconWithAttributes(): void
6666
6767 $ svg = $ iconRenderer ->renderIcon ('foo ' , $ attributes );
6868
69- $ this ->assertSame ('<svg aria-hidden="true" viewBox="0 0 24 24" class="icon" id="FooBar"><path d="M0 0L12 12"/></svg> ' , $ svg );
69+ $ this ->assertSame ('<svg viewBox="0 0 24 24" class="icon" id="FooBar" aria-hidden="true "><path d="M0 0L12 12"/></svg> ' , $ svg );
7070 }
7171
7272 public function testRenderIconWithDefaultAttributes (): void
@@ -163,12 +163,14 @@ public static function provideAttributesWithDefaultAttributesCases()
163163 /**
164164 * @dataProvider provideAriaHiddenCases
165165 *
166- * @param array<string, string> $attributes
166+ * @param string|array{string, array<string, string|bool>} $icon
167+ * @param array<string, string|bool> $attributes
167168 */
168- public function testRenderIconWithAutoAriaHidden (array $ attributes , string $ expectedSvg ): void
169+ public function testRenderIconWithAutoAriaHidden (string | array $ icon , array $ attributes , string $ expectedSvg ): void
169170 {
171+ $ icon = (array ) $ icon ;
170172 $ registry = $ this ->createRegistry ([
171- 'foo ' => ' <path d="M0 0L12 12"/> ' ,
173+ 'foo ' => $ icon ,
172174 ]);
173175 $ iconRenderer = new IconRenderer ($ registry );
174176
@@ -177,31 +179,52 @@ public function testRenderIconWithAutoAriaHidden(array $attributes, string $expe
177179 }
178180
179181 /**
180- * @return iterable<array{array<string, string>, string}>
182+ * @return iterable<array{string| array{string, array <string, string|bool>}, array<string, string|bool >, string}>
181183 */
182184 public static function provideAriaHiddenCases (): iterable
183185 {
184186 yield 'no attributes ' => [
187+ '<path d="M0 0L12 12"/> ' ,
185188 [],
186189 '<svg aria-hidden="true"><path d="M0 0L12 12"/></svg> ' ,
187190 ];
191+ yield 'no attributes and icon attribute ' => [
192+ ['<path d="M0 0L12 12"/> ' , ['aria-hidden ' => 'false ' ]],
193+ [],
194+ '<svg aria-hidden="false"><path d="M0 0L12 12"/></svg> ' ,
195+ ];
196+ yield 'no attributes and icon label ' => [
197+ ['<path d="M0 0L12 12"/> ' , ['aria-label ' => 'foo ' ]],
198+ [],
199+ '<svg aria-label="foo"><path d="M0 0L12 12"/></svg> ' ,
200+ ];
188201 yield 'aria-hidden attribute ' => [
202+ '<path d="M0 0L12 12"/> ' ,
203+ ['aria-hidden ' => 'true ' ],
204+ '<svg aria-hidden="true"><path d="M0 0L12 12"/></svg> ' ,
205+ ];
206+ yield 'aria-hidden attribute and icon attribute ' => [
207+ ['<path d="M0 0L12 12"/> ' , ['aria-hidden ' => 'false ' ]],
189208 ['aria-hidden ' => 'true ' ],
190209 '<svg aria-hidden="true"><path d="M0 0L12 12"/></svg> ' ,
191210 ];
192211 yield 'aria-hidden false + aria-label ' => [
212+ '<path d="M0 0L12 12"/> ' ,
193213 ['aria-hidden ' => 'false ' , 'aria-label ' => 'foo ' ],
194214 '<svg aria-hidden="false" aria-label="foo"><path d="M0 0L12 12"/></svg> ' ,
195215 ];
196216 yield 'title attribute ' => [
217+ '<path d="M0 0L12 12"/> ' ,
197218 ['title ' => 'foo ' ],
198219 '<svg title="foo"><path d="M0 0L12 12"/></svg> ' ,
199220 ];
200221 yield 'aria-labelledby attribute ' => [
222+ '<path d="M0 0L12 12"/> ' ,
201223 ['aria-labelledby ' => 'foo ' ],
202224 '<svg aria-labelledby="foo"><path d="M0 0L12 12"/></svg> ' ,
203225 ];
204226 yield 'aria-label attribute ' => [
227+ '<path d="M0 0L12 12"/> ' ,
205228 ['aria-label ' => 'foo ' ],
206229 '<svg aria-label="foo"><path d="M0 0L12 12"/></svg> ' ,
207230 ];
0 commit comments