Add group hover

This commit is contained in:
Brabli
2022-08-29 20:12:55 +01:00
parent 78a321137e
commit 7a3366c2da
2 changed files with 6 additions and 1 deletions

View File

@@ -86,7 +86,7 @@ final class IconExtension extends AbstractExtension
if (null !== $options['hover']) {
$hoverPallete = $this->getPallete($options['hover']);
$colourClasses .= " hover:{$hoverPallete['stroke']} hover:{$hoverPallete['fill']}";
$colourClasses .= " hover:{$hoverPallete['stroke']} hover:{$hoverPallete['fill']} group-hover:{$hoverPallete['stroke']} group-hover:{$hoverPallete['fill']}";
}
$xml = new \SimpleXMLElement($cleanSvgMarkup);

View File

@@ -248,9 +248,12 @@ class IconExtensionTest extends TestCase
public function testSvgClassContainsHoverPalleteClasses(): void
{
$contents = $this->icon->renderIcon(['icon' => self::ICON, 'hover' => 'white']);
$this->assertMatchesRegularExpression('/<svg.+class=".*hover:fill-white.*".*>/', $contents);
$this->assertMatchesRegularExpression('/<svg.+class=".*hover:stroke-white.*".*>/', $contents);
$this->assertMatchesRegularExpression('/<svg.+class=".*group-hover:fill-white.*".*>/', $contents);
$this->assertMatchesRegularExpression('/<svg.+class=".*group-hover:stroke-white.*".*>/', $contents);
}
public function testSvgClassContainsHoverAndColourPalleteClasses(): void
@@ -260,6 +263,8 @@ class IconExtensionTest extends TestCase
$this->assertMatchesRegularExpression('/<svg.+class=".*stroke-primary.*".*>/', $contents);
$this->assertMatchesRegularExpression('/<svg.+class=".*hover:fill-white.*".*>/', $contents);
$this->assertMatchesRegularExpression('/<svg.+class=".*hover:stroke-white.*".*>/', $contents);
$this->assertMatchesRegularExpression('/<svg.+class=".*group-hover:fill-white.*".*>/', $contents);
$this->assertMatchesRegularExpression('/<svg.+class=".*group-hover:stroke-white.*".*>/', $contents);
}