17 lines
661 B
TypeScript
17 lines
661 B
TypeScript
import { describe, test, expect } from 'vitest';
|
|||
|
|
import { SocialLinks } from './SocialLinks';
|
||
|
|
|
||
|
|
const toHtml = (SocialLinks as any).toHtml;
|
||
|
|
|
||
|
|
describe('SocialLinks.toHtml accessibility (F2.5)', () => {
|
||
|
|
test('icon-only links get an aria-label naming the platform', () => {
|
||
|
|
const { html } = toHtml({ links: [{ platform: 'facebook', url: 'https://fb.example/x' }] }, '');
|
||
|
|
expect(html).toMatch(/<a[^>]*aria-label="Facebook"/);
|
||
|
|
});
|
||
|
|
|
||
|
|
test('the icon glyph itself is aria-hidden', () => {
|
||
|
|
const { html } = toHtml({ links: [{ platform: 'twitter', url: '#' }] }, '');
|
||
|
|
expect(html).toMatch(/<i class="fa fa-twitter"[^>]*aria-hidden="true"/);
|
||
|
|
});
|
||
|
|
});
|