From 7a3366c2da1763a5db234ead27778addc97c992e Mon Sep 17 00:00:00 2001 From: Brabli <67018167+Brabli@users.noreply.github.com> Date: Mon, 29 Aug 2022 20:12:55 +0100 Subject: [PATCH] Add group hover --- src/Twig/Functions/IconExtension.php | 2 +- tests/Twig/Functions/IconExtensionTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Twig/Functions/IconExtension.php b/src/Twig/Functions/IconExtension.php index f8fe0b1..4bfbd5e 100644 --- a/src/Twig/Functions/IconExtension.php +++ b/src/Twig/Functions/IconExtension.php @@ -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); diff --git a/tests/Twig/Functions/IconExtensionTest.php b/tests/Twig/Functions/IconExtensionTest.php index 5b71469..2ec12ee 100644 --- a/tests/Twig/Functions/IconExtensionTest.php +++ b/tests/Twig/Functions/IconExtensionTest.php @@ -248,9 +248,12 @@ class IconExtensionTest extends TestCase public function testSvgClassContainsHoverPalleteClasses(): void { + $contents = $this->icon->renderIcon(['icon' => self::ICON, 'hover' => 'white']); $this->assertMatchesRegularExpression('//', $contents); $this->assertMatchesRegularExpression('//', $contents); + $this->assertMatchesRegularExpression('//', $contents); + $this->assertMatchesRegularExpression('//', $contents); } public function testSvgClassContainsHoverAndColourPalleteClasses(): void @@ -260,6 +263,8 @@ class IconExtensionTest extends TestCase $this->assertMatchesRegularExpression('//', $contents); $this->assertMatchesRegularExpression('//', $contents); $this->assertMatchesRegularExpression('//', $contents); + $this->assertMatchesRegularExpression('//', $contents); + $this->assertMatchesRegularExpression('//', $contents); }