fix: enforce first-frame timeout and nav labels

This commit is contained in:
2026-09-02 08:22:40 +03:00
parent 5edddb8781
commit 1734003172
10 changed files with 217 additions and 40 deletions

View File

@@ -57,6 +57,19 @@ describe('semantic portfolio document', () => {
expect(document.body.textContent).toContain('For a current CV or role-specific information, contact me directly.');
});
it('renders separate full and compact navigation labels without overriding their accessible names', async () => {
const document = await renderedDocument();
const experience = document.querySelector('nav a[href="#experience"]')!;
const additional = document.querySelector('nav a[href="#additional-work"]')!;
expect(experience.hasAttribute('aria-label')).toBe(false);
expect(experience.querySelector('.site-navigation__full-label')?.textContent).toBe('Experience');
expect(experience.querySelector('.site-navigation__compact-label')?.textContent).toBe('Career');
expect(additional.hasAttribute('aria-label')).toBe(false);
expect(additional.querySelector('.site-navigation__full-label')?.textContent).toBe('Additional work');
expect(additional.querySelector('.site-navigation__compact-label')?.textContent).toBe('More work');
});
it('binds navigation and section labels to their canonical IDs when content navigation is reordered', async () => {
const content = fixture('portfolio-content.valid.json') as {
navigation: Array<{ id: SectionId; label: string }>;
@@ -78,7 +91,10 @@ describe('semantic portfolio document', () => {
expect([...document.querySelectorAll('main > section > h2')].map((heading) => heading.textContent)).toEqual([
'START', 'PROFILE', 'EXPERIENCE', 'INFRASTRUCTURE', 'SELECTED BUILDS', 'ADDITIONAL WORK', 'TOOLKIT', 'CONTACT',
]);
expect([...document.querySelectorAll('nav a')].map((link) => [link.getAttribute('href'), link.textContent])).toEqual([
expect([...document.querySelectorAll('nav a')].map((link) => [
link.getAttribute('href'),
link.querySelector('.site-navigation__full-label')?.textContent,
])).toEqual([
['#start', 'Start'], ['#profile', 'Profile'], ['#experience', 'Experience'], ['#infrastructure', 'Infrastructure'],
['#selected-builds', 'Selected builds'], ['#additional-work', 'Additional work'], ['#toolkit', 'Toolkit'], ['#contact', 'Contact'],
]);