content: label the Experience chapter Experience in the navigation
This commit is contained in:
@@ -18,7 +18,7 @@ const props = defineProps<{
|
|||||||
const navigationLabels: Readonly<Record<SectionId, string>> = {
|
const navigationLabels: Readonly<Record<SectionId, string>> = {
|
||||||
start: "Start",
|
start: "Start",
|
||||||
profile: "Profile",
|
profile: "Profile",
|
||||||
experience: "Career",
|
experience: "Experience",
|
||||||
infrastructure: "Infra",
|
infrastructure: "Infra",
|
||||||
"selected-builds": "Builds",
|
"selected-builds": "Builds",
|
||||||
"additional-work": "More work",
|
"additional-work": "More work",
|
||||||
|
|||||||
@@ -220,33 +220,27 @@ test("responsive navigation exposes the exact visible label as each link's acces
|
|||||||
await page.goto(distUrl, { waitUntil: "domcontentloaded" });
|
await page.goto(distUrl, { waitUntil: "domcontentloaded" });
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("link", { name: "Career", exact: true }),
|
page.getByRole("link", { name: "Experience", exact: true }),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("link", { name: "More work", exact: true }),
|
page.getByRole("link", { name: "More work", exact: true }),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
|
||||||
page.getByRole("link", { name: "Experience", exact: true }),
|
|
||||||
).toHaveCount(0);
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("link", { name: "Additional work", exact: true }),
|
page.getByRole("link", { name: "Additional work", exact: true }),
|
||||||
).toHaveCount(0);
|
).toHaveCount(0);
|
||||||
|
|
||||||
await page.setViewportSize({ width: 320, height: 800 });
|
await page.setViewportSize({ width: 320, height: 800 });
|
||||||
await revealNavigationLinks(page);
|
await revealNavigationLinks(page);
|
||||||
const career = page.getByRole("link", { name: "Career", exact: true });
|
const experience = page.getByRole("link", { name: "Experience", exact: true });
|
||||||
await expect(career).toHaveText("Career");
|
await expect(experience).toHaveText("Experience");
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("link", { name: "More work", exact: true }),
|
page.getByRole("link", { name: "More work", exact: true }),
|
||||||
).toHaveText("More work");
|
).toHaveText("More work");
|
||||||
await expect(
|
|
||||||
page.getByRole("link", { name: "Experience", exact: true }),
|
|
||||||
).toHaveCount(0);
|
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole("link", { name: "Additional work", exact: true }),
|
page.getByRole("link", { name: "Additional work", exact: true }),
|
||||||
).toHaveCount(0);
|
).toHaveCount(0);
|
||||||
|
|
||||||
await career.focus();
|
await experience.focus();
|
||||||
await page.keyboard.press("Enter");
|
await page.keyboard.press("Enter");
|
||||||
await expect(page.locator("#experience-heading")).toBeFocused();
|
await expect(page.locator("#experience-heading")).toBeFocused();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const navigationLabels: Readonly<Record<(typeof sectionIds)[number], string>> =
|
|||||||
{
|
{
|
||||||
start: "Start",
|
start: "Start",
|
||||||
profile: "Profile",
|
profile: "Profile",
|
||||||
experience: "Career",
|
experience: "Experience",
|
||||||
infrastructure: "Infra",
|
infrastructure: "Infra",
|
||||||
"selected-builds": "Builds",
|
"selected-builds": "Builds",
|
||||||
"additional-work": "More work",
|
"additional-work": "More work",
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ describe('semantic portfolio document', () => {
|
|||||||
const additional = document.querySelector('nav a[href="#additional-work"]')!;
|
const additional = document.querySelector('nav a[href="#additional-work"]')!;
|
||||||
|
|
||||||
expect(experience.hasAttribute('aria-label')).toBe(false);
|
expect(experience.hasAttribute('aria-label')).toBe(false);
|
||||||
expect(experience.textContent).toBe('Career');
|
expect(experience.textContent).toBe('Experience');
|
||||||
expect(experience.childElementCount).toBe(0);
|
expect(experience.childElementCount).toBe(0);
|
||||||
expect(additional.hasAttribute('aria-label')).toBe(false);
|
expect(additional.hasAttribute('aria-label')).toBe(false);
|
||||||
expect(additional.textContent).toBe('More work');
|
expect(additional.textContent).toBe('More work');
|
||||||
@@ -136,7 +136,7 @@ describe('semantic portfolio document', () => {
|
|||||||
'Profile', 'Experience', 'Infrastructure', 'Selected builds', 'Additional work', 'Toolkit', 'Contact',
|
'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.textContent])).toEqual([
|
||||||
['#start', 'Start'], ['#profile', 'Profile'], ['#experience', 'Career'], ['#infrastructure', 'Infra'],
|
['#start', 'Start'], ['#profile', 'Profile'], ['#experience', 'Experience'], ['#infrastructure', 'Infra'],
|
||||||
['#selected-builds', 'Builds'], ['#additional-work', 'More work'], ['#toolkit', 'Toolkit'], ['#contact', 'Contact'],
|
['#selected-builds', 'Builds'], ['#additional-work', 'More work'], ['#toolkit', 'Toolkit'], ['#contact', 'Contact'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user