Files
site-builder/craft/src/components/basic/SocialLinks.toHtml.test.ts
T

17 lines
661 B
TypeScript
Raw Normal View History

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"/);
});
});