Skip to content

Commit f0d6485

Browse files
VIA-599 AS/SB Add link to vaccines for all ages page from new hub
1 parent a1ae8fb commit f0d6485

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

e2e/general/navigation.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ test.describe("Navigation", () => {
1616
await clickLinkAndExpectPageTitle(page, "Back", AppPageDetails["vaccines-hub"].title);
1717
});
1818

19+
test("Vaccines and back links from multi vaccine hub page", async ({ page }) => {
20+
await page.goto(AppPageDetails["multi-vaccines-hub"].url);
21+
await clickLinkAndExpectPageTitle(
22+
page,
23+
"View vaccines for all ages",
24+
AppPageDetails["vaccines-for-all-ages"].title,
25+
);
26+
await clickLinkAndExpectPageTitle(page, "Back", AppPageDetails["multi-vaccines-hub"].title);
27+
});
28+
1929
test("Vaccines and back links from vaccines-for-all-ages page", async ({ page }) => {
2030
await page.goto(AppPageDetails["vaccines-for-all-ages"].url);
2131
await clickLinkAndExpectPageTitle(page, "RSV", AppPageDetails["rsv-older-adults"].title);

src/app/check-and-book-vaccinations/page.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ import VaccinationsHub from "@src/app/check-and-book-vaccinations/page";
22
import { SERVICE_HEADING } from "@src/app/constants";
33
import { render, screen } from "@testing-library/react";
44

5+
jest.mock("@src/app/_components/nhs-app/BackToNHSAppLink");
6+
57
describe("Vaccination Hub Page", () => {
68
beforeEach(async () => {
7-
render(VaccinationsHub());
9+
render(<VaccinationsHub />);
810
});
911

1012
it("renders heading", async () => {
1113
expectHeadingToBeRendered();
1214
});
15+
16+
it("renders vaccines for all ages button", async () => {
17+
const button = screen.getByRole("link", { name: "View vaccines for all ages" });
18+
expect(button).toBeVisible();
19+
expect(button).toHaveAttribute("href", "/vaccines-for-all-ages");
20+
});
1321
});
1422

1523
const expectHeadingToBeRendered = () => {

src/app/check-and-book-vaccinations/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
import BackToNHSAppLink from "@src/app/_components/nhs-app/BackToNHSAppLink";
2+
import MainContent from "@src/app/_components/nhs-frontend/MainContent";
13
import { NHS_TITLE_SUFFIX, SERVICE_HEADING } from "@src/app/constants";
4+
import Link from "next/link";
25
import React from "react";
36

47
const VaccinationsHub = () => {
58
return (
69
<>
710
<title>{`${SERVICE_HEADING} - ${NHS_TITLE_SUFFIX}`}</title>
8-
<h1 className={"app-dynamic-page-title__heading"}>{SERVICE_HEADING}</h1>
11+
<BackToNHSAppLink />
12+
<MainContent>
13+
<h1 className={"app-dynamic-page-title__heading"}>{SERVICE_HEADING}</h1>
14+
<Link href={"/vaccines-for-all-ages"} className={"nhsuk-button nhsuk-button--secondary"}>
15+
View vaccines for all ages
16+
</Link>
17+
</MainContent>
918
</>
1019
);
1120
};

0 commit comments

Comments
 (0)