diff --git a/src/Twig/Functions/IconExtension.php b/src/Twig/Functions/IconExtension.php
index a7ca8a5..2ed7922 100644
--- a/src/Twig/Functions/IconExtension.php
+++ b/src/Twig/Functions/IconExtension.php
@@ -179,12 +179,12 @@ final class IconExtension extends AbstractExtension
private function removeBlackStrokeAttributes(string $content): string
{
- return preg_replace('/stroke="\s*(#0{6}|#000|rgb\(\s*0,\s*0,\s*0\s*\)|black)\s*"/', '', $content);
+ return preg_replace('/stroke(=|:)"?\s*(#0{6}|#000|rgb\(\s*0,\s*0,\s*0\s*\)|black)\s*"?/', '', $content);
}
private function removeBlackFillAttributes(string $content): string
{
- return preg_replace('/fill="\s*(#0{6}|#000|rgb\(\s*0,\s*0,\s*0\s*\)|black)\s*"/', '', $content);
+ return preg_replace('/fill(=|:)"?\s*(#0{6}|#000|rgb\(\s*0,\s*0,\s*0\s*\)|black)\s*"?/', '', $content);
}
}
diff --git a/tests/Twig/Functions/IconExtensionTest.php b/tests/Twig/Functions/IconExtensionTest.php
index 7dcf618..92dea2d 100644
--- a/tests/Twig/Functions/IconExtensionTest.php
+++ b/tests/Twig/Functions/IconExtensionTest.php
@@ -200,6 +200,15 @@ class IconExtensionTest extends TestCase
$this->assertDoesNotMatchRegularExpression('/stroke="\s*rgb\(0,\s*0,\s*0\)\s*"/', $content);
}
+ public function testBlackStrokeStylesAreRemoved(): void
+ {
+ $content = $this->icon->renderIcon(['icon' => self::ICON]);
+ $this->assertDoesNotMatchRegularExpression('/stroke:\s*#000\s*/', $content);
+ $this->assertDoesNotMatchRegularExpression('/stroke:\s*#000000\s*/', $content);
+ $this->assertDoesNotMatchRegularExpression('/stroke:\s*black\s*/', $content);
+ $this->assertDoesNotMatchRegularExpression('/stroke:\s*rgb\(0,\s*0,\s*0\)\s*/', $content);
+ }
+
public function testBlackFillAttributeValuesAreRemoved(): void
{
$content = $this->icon->renderIcon(['icon' => self::ICON]);
@@ -209,6 +218,15 @@ class IconExtensionTest extends TestCase
$this->assertDoesNotMatchRegularExpression('/fill="\s*rgb\(0,\s*0,\s*0\)\s*"/', $content);
}
+ public function testBlackFillStylesAreRemoved(): void
+ {
+ $content = $this->icon->renderIcon(['icon' => self::ICON]);
+ $this->assertDoesNotMatchRegularExpression('/fill:\s*#000\s*/', $content);
+ $this->assertDoesNotMatchRegularExpression('/fill:\s*#000000\s*/', $content);
+ $this->assertDoesNotMatchRegularExpression('/fill:\s*black\s*/', $content);
+ $this->assertDoesNotMatchRegularExpression('/fill:\s*rgb\(0,\s*0,\s*0\)\s*/', $content);
+ }
+
public function testThrowsIfPalleteIsNotFound(): void
{
$this->expectException(PalleteNotFound::class);
diff --git a/tests/icons/test.svg b/tests/icons/test.svg
index 9a2211c..c3858b2 100644
--- a/tests/icons/test.svg
+++ b/tests/icons/test.svg
@@ -6,4 +6,5 @@
+