Skip to content

Commit a09137d

Browse files
committed
test(Icons-theme-contrast): verify Dark and Light Prefers-Color-Scheme Visual Cohesion (Variation 3)
1 parent 0783fae commit a09137d

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { render } from '@testing-library/react';
2+
import { describe, expect, it } from 'vitest';
3+
4+
import { BoxIcon, CheckIcon, CloseIcon, CopyIcon, ZapIcon } from './Icons';
5+
6+
describe('Icons theme contrast behavior', () => {
7+
it('renders CheckIcon with fixed semantic color for success state', () => {
8+
const { container } = render(<CheckIcon />);
9+
const svg = container.querySelector('svg');
10+
// Verifies the icon maintains visual cohesion by using a fixed color
11+
// that works well in both light and dark modes
12+
expect(svg?.getAttribute('stroke')).toBe('#10b981');
13+
});
14+
15+
it('renders CopyIcon with inherited color for theme adaptability', () => {
16+
const { container } = render(<CopyIcon />);
17+
const svg = container.querySelector('svg');
18+
// Verifies the icon uses currentColor to adapt to parent theme context
19+
expect(svg?.getAttribute('stroke')).toBe('currentColor');
20+
});
21+
22+
it('renders ZapIcon with inherited color for theme adaptability', () => {
23+
const { container } = render(<ZapIcon />);
24+
const svg = container.querySelector('svg');
25+
expect(svg?.getAttribute('stroke')).toBe('currentColor');
26+
});
27+
28+
it('renders BoxIcon with inherited color for theme adaptability', () => {
29+
const { container } = render(<BoxIcon />);
30+
const svg = container.querySelector('svg');
31+
expect(svg?.getAttribute('stroke')).toBe('currentColor');
32+
});
33+
34+
it('renders CloseIcon with inherited color for theme adaptability', () => {
35+
const { container } = render(<CloseIcon />);
36+
const svg = container.querySelector('svg');
37+
expect(svg?.getAttribute('stroke')).toBe('currentColor');
38+
});
39+
});

0 commit comments

Comments
 (0)