Skip to content

Commit 214003c

Browse files
authored
Fixes JhaSourav07#1031 test(SectionLabel): create SectionLabel.test.tsx (JhaSourav07#1203)
## Description Fixes JhaSourav07#1031 ## Pillar - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview Not applicable — test file only, no visual output. ## Checklist: - [x] I have read the CONTRIBUTING.md file. - [x] I have run `npm run format` and `npm run lint` locally. - [x] My commits follow the Conventional Commits format. - [x] I have only one commit in this PR. - [x] I have starred the repo. - [x] I have joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.
2 parents 05741d1 + 9070a87 commit 214003c

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)