@@ -124,6 +124,15 @@ public function testWithAttributes(array $attributes, array $withAttributes, arr
124
124
$ this ->assertSame ($ expected , $ icon ->getAttributes ());
125
125
}
126
126
127
+ /**
128
+ * @dataProvider provideRenderAttributeColorModifiers
129
+ */
130
+ public function testColorModifierWithFillAttributeSet (array $ attributes ,string $ innerSvg , string $ expected )
131
+ {
132
+ $ icon = new Icon ($ innerSvg , $ attributes );
133
+ $ this ->assertStringStartsWith ($ expected , $ icon ->toHtml ());
134
+ }
135
+
127
136
public static function provideIdToName (): iterable
128
137
{
129
138
yield from [
@@ -290,4 +299,23 @@ public function testSerialize()
290
299
291
300
$ this ->assertEquals ($ icon , unserialize (serialize ($ icon )));
292
301
}
302
+
303
+ public static function provideRenderAttributeColorModifiers (): iterable
304
+ {
305
+ yield 'it_renders_with_attribute_fill_set ' => [
306
+ ['fill ' => 'red ' ],
307
+ '<path fill="currentColor" d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/> ' ,
308
+ '<svg fill="red"><path fill="red" d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z"/></svg ' ,
309
+ ];
310
+ yield 'it_renders_with_attribute_stroke_set ' => [
311
+ ['stroke ' => 'red ' ],
312
+ '<path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 4v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2m6-16v2m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v10m6-16v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2"/> ' ,
313
+ '<svg stroke="red"><path fill="currentColor" stroke="red" stroke-linecap="round" stroke-width="2" d="M6 4v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2m6-16v2m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v10m6-16v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2"/></svg> ' ,
314
+ ];
315
+ yield 'it_renders_with_attribute_stroke_and_fill_set ' => [
316
+ ['fill ' => 'red ' , 'stroke ' => 'blue ' ],
317
+ '<path fill="currentColor" stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M6 4v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2m6-16v2m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v10m6-16v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2"/> ' ,
318
+ '<svg fill="red" stroke="blue"><path fill="red" stroke="blue" stroke-linecap="round" stroke-width="2" d="M6 4v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2m6-16v2m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v10m6-16v10m0 0a2 2 0 1 0 0 4m0-4a2 2 0 1 1 0 4m0 0v2"/></svg> ' ,
319
+ ];
320
+ }
293
321
}
0 commit comments