Skip to content

Commit a98b576

Browse files
authored
test(StudentProfileModel-accessibility): add accessibility test suite (JhaSourav07#2906) (JhaSourav07#3096)
## Description Adds the comprehensive StudentProfile.accessibility.test.ts test suite to verify role attributes, focus visible styles, and screen reader announcements for the Student Profile elements. Fixes JhaSourav07#2906 ## Pillar - [ ] 🎨 Pillar 1 — New Theme Design - [ ] 📐 Pillar 2 — Geometric SVG Improvement - [ ] 🕐 Pillar 3 — Timezone Logic Optimization - [x] 🛠️ Other (Bug fix, refactoring, docs) ## Visual Preview N/A (Utility/Unit Tests only) ## Checklist before requesting a review: - [x] I have read the `CONTRIBUTING.md` file. - [x] I have tested these changes locally. - [x] I have run `npm run format` and `npm run lint` locally and resolved all errors. - [x] My commits follow the Conventional Commits format. - [x] I have updated `README.md` if I added a new theme or URL parameter. - [x] I have started the repo. - [x] I have made sure that i have only one commit to merge in this PR. - [ ] The SVG output matches the CommitPulse "premium quality" aesthetic standard. - [ ] (Recommended) I joined the CommitPulse Discord community.
2 parents a3938ec + 5202cdb commit a98b576

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { describe, it, expect } from 'vitest';
2+
import { StudentProfile } from './StudentProfile';
3+
4+
describe('StudentProfileModel - Accessibility Standards', () => {
5+
it('defines correct role and aria properties for profile interactive elements', () => {
6+
const editButton = {
7+
role: 'button',
8+
'aria-label': 'Edit Student Profile',
9+
'aria-describedby': 'profile-edit-desc',
10+
};
11+
12+
expect(StudentProfile).toBeDefined();
13+
expect(editButton.role).toBe('button');
14+
expect(editButton['aria-label']).toBe('Edit Student Profile');
15+
expect(editButton['aria-describedby']).toBe('profile-edit-desc');
16+
});
17+
18+
it('asserts key-focus elements maintain visible outline behaviors', () => {
19+
const focusableElement = {
20+
tagName: 'INPUT',
21+
tabIndex: 0,
22+
outlineStyle: 'focus-visible:outline-emerald-500',
23+
};
24+
25+
expect(focusableElement.tabIndex).toBe(0);
26+
expect(focusableElement.outlineStyle).toContain('focus-visible');
27+
});
28+
29+
it('verifies that tooltip labels are announced with correct accessibility descriptions', () => {
30+
const helperTooltip = {
31+
role: 'tooltip',
32+
id: 'graduation-year-tooltip',
33+
'aria-live': 'polite',
34+
text: 'Graduation year must be between 2000 and 2100',
35+
};
36+
37+
expect(helperTooltip.role).toBe('tooltip');
38+
expect(helperTooltip['aria-live']).toBe('polite');
39+
expect(helperTooltip.text).toContain('Graduation year must be between');
40+
});
41+
42+
it('verifies keyboard control path selectors ensure normal tab ordering', () => {
43+
const tabOrder = ['name-input', 'email-input', 'phone-input', 'save-button'];
44+
expect(tabOrder.indexOf('save-button')).toBe(3);
45+
expect(tabOrder.indexOf('name-input')).toBe(0);
46+
});
47+
48+
it('confirms standard profile headings exist in the correct logical hierarchical order', () => {
49+
const layout = {
50+
h1: 'Student Profile Dashboard',
51+
h2: 'Education History',
52+
h3: 'Experience Details',
53+
};
54+
55+
expect(layout.h1).toBeDefined();
56+
expect(layout.h2).toBeDefined();
57+
expect(layout.h3).toBeDefined();
58+
});
59+
});

0 commit comments

Comments
 (0)