Add 'classes' option to add extra classes
This commit is contained in:
@@ -300,6 +300,26 @@ class IconExtensionTest extends TestCase
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*group-hover:stroke-white.*".*>/', $contents);
|
||||
}
|
||||
|
||||
public function testExtraClassesThrowsIfNotAnArray(): void
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
$this->icon->renderIcon(['icon' => self::ICON, 'classes' => 'string_value']);
|
||||
}
|
||||
|
||||
public function testExtraClassesGetAdded(): void
|
||||
{
|
||||
$contents = $this->icon->renderIcon(['icon' => self::ICON, 'classes' => ['abc', 'def']]);
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*abc.*".*>/', $contents);
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*def.*".*>/', $contents);
|
||||
}
|
||||
|
||||
public function testAddingExtraClassesDoesntStripAwayColourClasses(): void
|
||||
{
|
||||
$contents = $this->icon->renderIcon(['icon' => self::ICON, 'classes' => ['abc']]);
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*abc.*".*>/', $contents);
|
||||
$this->assertMatchesRegularExpression('/<svg.+class=".*fill-primary.*".*>/', $contents);
|
||||
}
|
||||
|
||||
public function testThrowsIfInvalidOptionPassed(): void
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
Reference in New Issue
Block a user