Skip to content

Commit 2925540

Browse files
authored
CCM-8620: updated footer links (#328)
1 parent a584e7f commit 2925540

File tree

10 files changed

+617
-200
lines changed

10 files changed

+617
-200
lines changed

.github/workflows/scheduled-repository-template-sync.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
3333
- name: Create Pull Request
3434
if: ${{ !env.ACT }}
35-
uses: peter-evans/[email protected].1
35+
uses: peter-evans/[email protected].7
3636
with:
3737
token: ${{ secrets.GITHUB_TOKEN }}
3838
commit-message: Drift from template

frontend/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@
2020
"dependencies": {
2121
"@aws-amplify/adapter-nextjs": "^1.4.3",
2222
"@aws-amplify/ui-react": "^6.9.1",
23-
"@aws-sdk/client-ses": "^3.637.0",
2423
"clsx": "^2.1.1",
2524
"aws-amplify": "^6.12.3",
2625
"date-fns": "^4.1.0",
2726
"jsonwebtoken": "^9.0.2",
2827
"jwt-decode": "^4.0.0",
2928
"markdown-it": "^13.0.1",
3029
"mimetext": "^3.0.24",
31-
"next": "^15.1.7",
30+
"next": "^15.2.1",
3231
"next-client-cookies": "^2.0.1",
3332
"nhs-notify-backend-client": "*",
3433
"nhs-notify-web-template-management-utils": "*",

frontend/src/__tests__/components/molecules/Footer.test.tsx

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,81 @@
11
import { render, screen } from '@testing-library/react';
22
import { NHSNotifyFooter } from '@molecules/Footer/Footer';
3-
import content from '@content/content';
43

5-
const footerContent = content.components.footer;
4+
type FooterLinkSpec = {
5+
testId: string;
6+
text: string;
7+
href: string;
8+
};
9+
10+
const expectedFooterLinks: Array<[string, FooterLinkSpec]> = [
11+
[
12+
'acceptable use policy',
13+
{
14+
testId: 'acceptable-use-policy-statement-link',
15+
text: 'Acceptable use policy',
16+
href: 'https://digital.nhs.uk/services/nhs-notify/acceptable-use-policy',
17+
},
18+
],
19+
[
20+
'accessibility statement',
21+
{
22+
testId: 'accessibility-statement-link',
23+
text: 'Accessibility statement',
24+
href: '/accessibility',
25+
},
26+
],
27+
[
28+
'cookies statement',
29+
{
30+
testId: 'cookies-statement-link',
31+
text: 'Cookies',
32+
href: '/cookies',
33+
},
34+
],
35+
[
36+
'privacy statement',
37+
{
38+
testId: 'privacy-statement-link',
39+
text: 'Privacy',
40+
href: 'https://digital.nhs.uk/services/nhs-notify/transparency-notice',
41+
},
42+
],
43+
[
44+
'terms and conditions statement',
45+
{
46+
testId: 'terms-and-conditions-statement-link',
47+
text: 'Terms and conditions',
48+
href: 'https://digital.nhs.uk/services/nhs-notify/terms-and-conditions',
49+
},
50+
],
51+
];
652

753
describe('Footer component', () => {
54+
test.each(expectedFooterLinks)('Check %s footer link', (_, linkSpec) => {
55+
render(<NHSNotifyFooter />);
56+
57+
const link = screen.getByTestId(linkSpec.testId);
58+
expect(link).toBeInTheDocument();
59+
expect(link.getAttribute('href')).toBe(linkSpec.href);
60+
expect(link.textContent).toBe(linkSpec.text);
61+
});
62+
863
it('renders component correctly', () => {
964
render(<NHSNotifyFooter />);
1065

1166
expect(screen.getByTestId('page-footer')).toBeInTheDocument();
1267
expect(screen.getByTestId('support-links')).toBeInTheDocument();
1368

14-
expect(
15-
screen.getByTestId('accessibility-statement-link')
16-
).toBeInTheDocument();
17-
expect(screen.getByTestId('accessibility-statement-link')).toHaveAttribute(
18-
'href',
19-
`${footerContent.links.accessibilityStatement.url}`
20-
);
21-
22-
expect(screen.getByTestId('contact-us-link')).toBeInTheDocument();
23-
expect(screen.getByTestId('contact-us-link')).toHaveAttribute('href', '#');
24-
25-
expect(screen.getByTestId('cookies-link')).toBeInTheDocument();
26-
expect(screen.getByTestId('cookies-link')).toHaveAttribute('href', '#');
27-
28-
expect(screen.getByTestId('privacy-policy-link')).toBeInTheDocument();
29-
expect(screen.getByTestId('privacy-policy-link')).toHaveAttribute(
30-
'href',
31-
'#'
32-
);
69+
const footerListItems = screen
70+
.getByTestId('footer-links')
71+
.querySelectorAll('li');
72+
const footerLinksOrdered = [...footerListItems]
73+
.map((footerListItem) => footerListItem.querySelectorAll('a').item(0))
74+
.filter((link) => !!link)
75+
.map((footerLink) => footerLink.dataset.testid);
3376

34-
expect(screen.getByTestId('terms-and-conditions-link')).toBeInTheDocument();
35-
expect(screen.getByTestId('terms-and-conditions-link')).toHaveAttribute(
36-
'href',
37-
'#'
77+
expect(footerLinksOrdered).toEqual(
78+
expectedFooterLinks.map((linkSpec) => linkSpec[1].testId)
3879
);
3980
expect(
4081
screen.getByTestId('nhs-england-copyright-text')

frontend/src/components/molecules/Footer/Footer.tsx

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
/* eslint-disable jsx-a11y/anchor-is-valid,sonarjs/todo-tag */
2-
/*
3-
* TODO: REMOVE ESLINT DISABLE WHEN WE HAVE FOOTER LINK
4-
*/
5-
import Link from 'next/link';
61
import content from '@content/content';
72

83
const footerContent = content.components.footer;
@@ -16,53 +11,61 @@ export function NHSNotifyFooter() {
1611
{footerContent.supportLinks}
1712
</h2>
1813
<div className='nhsuk-footer'>
19-
<ul className='nhsuk-footer__list'>
14+
<ul className='nhsuk-footer__list' data-testid='footer-links'>
2015
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
2116
<a
2217
className='nhsuk-footer__list-item-link'
23-
href={footerContent.links.accessibilityStatement.url}
24-
data-testid='accessibility-statement-link'
18+
href={footerContent.links.acceptableUsePolicy.url}
19+
data-testid='acceptable-use-policy-statement-link'
2520
target='_blank'
2621
rel='noopener noreferrer'
2722
>
28-
{footerContent.links.accessibilityStatement.text}
23+
{footerContent.links.acceptableUsePolicy.text}
2924
</a>
3025
</li>
3126
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
32-
<Link
27+
<a
3328
className='nhsuk-footer__list-item-link'
34-
href='#'
35-
data-testid='contact-us-link'
29+
href={footerContent.links.accessibilityStatement.url}
30+
data-testid='accessibility-statement-link'
31+
target='_blank'
32+
rel='noopener noreferrer'
3633
>
37-
{footerContent.links.contactUs}
38-
</Link>
34+
{footerContent.links.accessibilityStatement.text}
35+
</a>
3936
</li>
4037
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
41-
<Link
38+
<a
4239
className='nhsuk-footer__list-item-link'
43-
href='#'
44-
data-testid='cookies-link'
40+
href={footerContent.links.cookies.url}
41+
data-testid='cookies-statement-link'
42+
target='_blank'
43+
rel='noopener noreferrer'
4544
>
46-
{footerContent.links.cookies}
47-
</Link>
45+
{footerContent.links.cookies.text}
46+
</a>
4847
</li>
4948
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
50-
<Link
49+
<a
5150
className='nhsuk-footer__list-item-link'
52-
href='#'
53-
data-testid='privacy-policy-link'
51+
href={footerContent.links.privacy.url}
52+
data-testid='privacy-statement-link'
53+
target='_blank'
54+
rel='noopener noreferrer'
5455
>
55-
{footerContent.links.privacyPolicy}
56-
</Link>
56+
{footerContent.links.privacy.text}
57+
</a>
5758
</li>
5859
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
59-
<Link
60+
<a
6061
className='nhsuk-footer__list-item-link'
61-
href='#'
62-
data-testid='terms-and-conditions-link'
62+
href={footerContent.links.termsAndConditions.url}
63+
data-testid='terms-and-conditions-statement-link'
64+
target='_blank'
65+
rel='noopener noreferrer'
6366
>
64-
{footerContent.links.termsAndCondition}
65-
</Link>
67+
{footerContent.links.termsAndConditions.text}
68+
</a>
6669
</li>
6770
</ul>
6871
<p

frontend/src/content/content.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,26 @@ const footer = {
2121
nhsEngland: 'NHS England',
2222
supportLinks: 'Support links',
2323
links: {
24+
acceptableUsePolicy: {
25+
text: 'Acceptable use policy',
26+
url: 'https://digital.nhs.uk/services/nhs-notify/acceptable-use-policy',
27+
},
2428
accessibilityStatement: {
2529
text: 'Accessibility statement',
2630
url: '/accessibility',
2731
},
28-
contactUs: 'Contact us',
29-
cookies: 'Cookies',
30-
privacyPolicy: 'Privacy policy',
31-
termsAndCondition: 'Terms and conditions',
32+
cookies: {
33+
text: 'Cookies',
34+
url: '/cookies',
35+
},
36+
privacy: {
37+
text: 'Privacy',
38+
url: 'https://digital.nhs.uk/services/nhs-notify/transparency-notice',
39+
},
40+
termsAndConditions: {
41+
text: 'Terms and conditions',
42+
url: 'https://digital.nhs.uk/services/nhs-notify/terms-and-conditions',
43+
},
3244
},
3345
};
3446

lambdas/backend-api/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"dependencies": {
1212
"@aws-sdk/client-cognito-identity-provider": "^3.699.0",
1313
"@aws-sdk/client-dynamodb": "^3.696.0",
14-
"@aws-sdk/client-ses": "^3.699.0",
1514
"@aws-sdk/lib-dynamodb": "^3.698.0",
1615
"handlebars": "^4.7.8",
1716
"html-entities": "^2.5.2",

0 commit comments

Comments
 (0)