diff --git a/client/src/utils/__tests__/svg.test.ts b/client/src/utils/__tests__/svg.test.ts index ee902f8713..a86b1acc3a 100644 --- a/client/src/utils/__tests__/svg.test.ts +++ b/client/src/utils/__tests__/svg.test.ts @@ -241,6 +241,18 @@ describe('isMonochromeSvg', () => { expect(isMonochromeSvg(svg)).toBe(true); }); + it('ignores a CSS currentColor paint that only targets a hidden element', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); + + it('still counts a CSS currentColor paint on a visible shape', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(false); + }); + it('preserves a chromatic fill applied to the root via CSS', () => { const svg = ''; @@ -254,6 +266,26 @@ describe('isMonochromeSvg', () => { }); }); + describe('paint set on non-rendering containers', () => { + it('tints a glyph whose root fill is overridden by every rendered shape', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); + + it('tints a glyph whose group fill no rendered shape inherits', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(true); + }); + + it('still counts a container fill inherited by an unpainted shape', () => { + const svg = + ''; + expect(isMonochromeSvg(svg)).toBe(false); + }); + }); + describe('default fills alongside