Remove fill and stroke attributes where their value was black

This commit is contained in:
Brabli
2022-08-14 19:41:31 +01:00
parent 9a95804f3c
commit c75369e0fa
3 changed files with 34 additions and 0 deletions

View File

@@ -194,4 +194,22 @@ class IconExtensionTest extends TestCase
$this->expectException(\Exception::class);
new IconExtension(['/'], [['stroke' => '']]);
}
public function testBlackStrokeAttributeValuesAreRemoved(): 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]);
$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);
}
}