From bc0fbed488720b72a6dbb24798fb0fbb438d14d8 Mon Sep 17 00:00:00 2001 From: Marco Beretta <81851188+berry-13@users.noreply.github.com> Date: Tue, 23 Jun 2026 10:57:43 +0200 Subject: [PATCH] fix: resolve CSS currentColor and default-black use instances --- client/src/utils/__tests__/svg.test.ts | 18 +++++ client/src/utils/svg.ts | 103 ++++++++++++++++++++++--- 2 files changed, 110 insertions(+), 11 deletions(-) diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts index fc4186624d..e1efaa6664 100644 --- a/client/src/utils/__tests__/svg.test.ts +++ b/client/src/utils/__tests__/svg.test.ts @@ -149,6 +149,12 @@ describe('isMonochromeSvg', () => { ''; expect(isMonochromeSvg(svg)).toBe(true); }); + + it('preserves an explicit badge alongside a default-black use instance', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(false); + }); }); describe('currentColor resolved against a fixed color', () => { @@ -169,6 +175,18 @@ describe('isMonochromeSvg', () => { ''; expect(isMonochromeSvg(svg)).toBe(true); }); + + it('preserves a CSS currentColor fill fixed by an ancestor color', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(false); + }); + + it('tints a CSS currentColor fill with no fixed color in scope', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); }); describe('default fills alongside