Skip to content

Commit 9070a87

Browse files
committed
test(SectionLabel): create SectionLabel.test.tsx
1 parent 7e3d6a5 commit 9070a87

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { render, screen } from '@testing-library/react';
3+
import { SectionLabel } from './SectionLabel';
4+
5+
describe('SectionLabel', () => {
6+
it('renders the children text content', () => {
7+
render(<SectionLabel>Theme Preset</SectionLabel>);
8+
expect(screen.getByText('Theme Preset')).toBeDefined();
9+
});
10+
11+
it('renders a <p> element', () => {
12+
render(<SectionLabel>Test Label</SectionLabel>);
13+
const el = screen.getByText('Test Label');
14+
expect(el.tagName).toBe('P');
15+
});
16+
17+
it('<p> has the text-white/45 class', () => {
18+
render(<SectionLabel>Test Label</SectionLabel>);
19+
const el = screen.getByText('Test Label');
20+
expect(el.className).toContain('text-white/45');
21+
});
22+
23+
it('<p> has the uppercase class', () => {
24+
render(<SectionLabel>Test Label</SectionLabel>);
25+
const el = screen.getByText('Test Label');
26+
expect(el.className).toContain('uppercase');
27+
});
28+
29+
it('renders with special characters without crashing', () => {
30+
render(<SectionLabel>{'!@#$%^&*()'}</SectionLabel>);
31+
expect(screen.getByText('!@#$%^&*()')).toBeDefined();
32+
});
33+
});

0 commit comments

Comments
 (0)