Skip to content

Commit d1dfa73

Browse files
committed
CCM-8620: updated footer links
1 parent 05faaa7 commit d1dfa73

File tree

12 files changed

+172
-127
lines changed

12 files changed

+172
-127
lines changed

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

Lines changed: 70 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,85 @@
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<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', (_, spec) => {
55+
const linkSpec = spec as FooterLinkSpec;
56+
57+
render(<NHSNotifyFooter />);
58+
59+
const link = screen.getByTestId(linkSpec.testId);
60+
expect(link).toBeInTheDocument();
61+
expect(link.getAttribute('href')).toBe(linkSpec.href);
62+
expect(link.textContent).toBe(linkSpec.text);
63+
});
64+
865
it('renders component correctly', () => {
966
render(<NHSNotifyFooter />);
1067

1168
expect(screen.getByTestId('page-footer')).toBeInTheDocument();
1269
expect(screen.getByTestId('support-links')).toBeInTheDocument();
1370

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-
);
71+
const footerListItems = screen
72+
.getByTestId('footer-links')
73+
.querySelectorAll('li');
74+
const footerLinksOrdered = [...footerListItems]
75+
.map((footerListItem) => footerListItem.querySelectorAll('a').item(0))
76+
.filter((link) => !!link)
77+
.map((footerLink) => footerLink.dataset.testid);
3378

34-
expect(screen.getByTestId('terms-and-conditions-link')).toBeInTheDocument();
35-
expect(screen.getByTestId('terms-and-conditions-link')).toHaveAttribute(
36-
'href',
37-
'#'
79+
expect(footerLinksOrdered).toEqual(
80+
expectedFooterLinks.map(
81+
(linkSpec) => (linkSpec[1] as FooterLinkSpec).testId
82+
)
3883
);
3984
expect(
4085
screen.getByTestId('nhs-england-copyright-text')

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

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
/*
33
* TODO: REMOVE ESLINT DISABLE WHEN WE HAVE FOOTER LINK
44
*/
5-
import Link from 'next/link';
65
import content from '@content/content';
76

87
const footerContent = content.components.footer;
@@ -16,53 +15,61 @@ export function NHSNotifyFooter() {
1615
{footerContent.supportLinks}
1716
</h2>
1817
<div className='nhsuk-footer'>
19-
<ul className='nhsuk-footer__list'>
18+
<ul className='nhsuk-footer__list' data-testid='footer-links'>
2019
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
2120
<a
2221
className='nhsuk-footer__list-item-link'
23-
href={footerContent.links.accessibilityStatement.url}
24-
data-testid='accessibility-statement-link'
22+
href={footerContent.links.acceptableUsePolicy.url}
23+
data-testid='acceptable-use-policy-statement-link'
2524
target='_blank'
2625
rel='noopener noreferrer'
2726
>
28-
{footerContent.links.accessibilityStatement.text}
27+
{footerContent.links.acceptableUsePolicy.text}
2928
</a>
3029
</li>
3130
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
32-
<Link
31+
<a
3332
className='nhsuk-footer__list-item-link'
34-
href='#'
35-
data-testid='contact-us-link'
33+
href={footerContent.links.accessibilityStatement.url}
34+
data-testid='accessibility-statement-link'
35+
target='_blank'
36+
rel='noopener noreferrer'
3637
>
37-
{footerContent.links.contactUs}
38-
</Link>
38+
{footerContent.links.accessibilityStatement.text}
39+
</a>
3940
</li>
4041
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
41-
<Link
42+
<a
4243
className='nhsuk-footer__list-item-link'
43-
href='#'
44-
data-testid='cookies-link'
44+
href={footerContent.links.cookies.url}
45+
data-testid='cookies-statement-link'
46+
target='_blank'
47+
rel='noopener noreferrer'
4548
>
46-
{footerContent.links.cookies}
47-
</Link>
49+
{footerContent.links.cookies.text}
50+
</a>
4851
</li>
4952
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
50-
<Link
53+
<a
5154
className='nhsuk-footer__list-item-link'
52-
href='#'
53-
data-testid='privacy-policy-link'
55+
href={footerContent.links.privacy.url}
56+
data-testid='privacy-statement-link'
57+
target='_blank'
58+
rel='noopener noreferrer'
5459
>
55-
{footerContent.links.privacyPolicy}
56-
</Link>
60+
{footerContent.links.privacy.text}
61+
</a>
5762
</li>
5863
<li className='nhsuk-footer__list-item nhsuk-footer-default__list-item'>
59-
<Link
64+
<a
6065
className='nhsuk-footer__list-item-link'
61-
href='#'
62-
data-testid='terms-and-conditions-link'
66+
href={footerContent.links.termsAndConditions.url}
67+
data-testid='terms-and-conditions-statement-link'
68+
target='_blank'
69+
rel='noopener noreferrer'
6370
>
64-
{footerContent.links.termsAndCondition}
65-
</Link>
71+
{footerContent.links.termsAndConditions.text}
72+
</a>
6673
</li>
6774
</ul>
6875
<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

infrastructure/terraform/components/acct/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
| <a name="output_dns_zone"></a> [dns\_zone](#output\_dns\_zone) | n/a |
3535
| <a name="output_github_pat_ssm_param_name"></a> [github\_pat\_ssm\_param\_name](#output\_github\_pat\_ssm\_param\_name) | n/a |
3636
| <a name="output_s3_buckets"></a> [s3\_buckets](#output\_s3\_buckets) | n/a |
37+
3738
<!-- vale on -->
3839
<!-- markdownlint-enable -->
3940
<!-- END_TF_DOCS -->

infrastructure/terraform/components/app/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
|------|-------------|
5959
| <a name="output_amplify"></a> [amplify](#output\_amplify) | n/a |
6060
| <a name="output_deployment"></a> [deployment](#output\_deployment) | Deployment details used for post-deployment scripts |
61+
6162
<!-- vale on -->
6263
<!-- markdownlint-enable -->
6364
<!-- END_TF_DOCS -->

infrastructure/terraform/components/branch/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
## Outputs
3030

3131
No outputs.
32+
3233
<!-- vale on -->
3334
<!-- markdownlint-enable -->
3435
<!-- END_TF_DOCS -->

infrastructure/terraform/components/sandbox/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ No requirements.
3030
| <a name="output_cognito_user_pool_client_id"></a> [cognito\_user\_pool\_client\_id](#output\_cognito\_user\_pool\_client\_id) | n/a |
3131
| <a name="output_cognito_user_pool_id"></a> [cognito\_user\_pool\_id](#output\_cognito\_user\_pool\_id) | n/a |
3232
| <a name="output_templates_table_name"></a> [templates\_table\_name](#output\_templates\_table\_name) | n/a |
33+
3334
<!-- vale on -->
3435
<!-- markdownlint-enable -->
3536
<!-- END_TF_DOCS -->

infrastructure/terraform/modules/backend-api/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ No requirements.
1010
| Name | Description | Type | Default | Required |
1111
|------|-------------|------|---------|:--------:|
1212
| <a name="input_aws_account_id"></a> [aws\_account\_id](#input\_aws\_account\_id) | The AWS Account ID (numeric) | `string` | n/a | yes |
13-
| <a name="input_cognito_config"></a> [cognito\_config](#input\_cognito\_config) | Cognito config | <pre>object({<br/> USER_POOL_ID : string,<br/> USER_POOL_CLIENT_ID : string<br/> })</pre> | n/a | yes |
13+
| <a name="input_cognito_config"></a> [cognito\_config](#input\_cognito\_config) | Cognito config | <pre>object({<br> USER_POOL_ID : string,<br> USER_POOL_CLIENT_ID : string<br> })</pre> | n/a | yes |
1414
| <a name="input_component"></a> [component](#input\_component) | The variable encapsulating the name of this component | `string` | `"api"` | no |
1515
| <a name="input_csi"></a> [csi](#input\_csi) | CSI from the parent component | `string` | n/a | yes |
1616
| <a name="input_enable_backup"></a> [enable\_backup](#input\_enable\_backup) | Enable Backups for the DynamoDB table? | `bool` | `true` | no |
@@ -37,6 +37,7 @@ No requirements.
3737
|------|-------------|
3838
| <a name="output_api_base_url"></a> [api\_base\_url](#output\_api\_base\_url) | n/a |
3939
| <a name="output_templates_table_name"></a> [templates\_table\_name](#output\_templates\_table\_name) | n/a |
40+
4041
<!-- vale on -->
4142
<!-- markdownlint-enable -->
4243
<!-- END_TF_DOCS -->

infrastructure/terraform/modules/lambda-function/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ No modules.
2626
| Name | Description |
2727
|------|-------------|
2828
| <a name="output_function_arn"></a> [function\_arn](#output\_function\_arn) | n/a |
29+
2930
<!-- vale on -->
3031
<!-- markdownlint-enable -->
3132
<!-- END_TF_DOCS -->

infrastructure/terraform/modules/typescript-build-zip/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ No modules.
2020
| Name | Description |
2121
|------|-------------|
2222
| <a name="output_zips"></a> [zips](#output\_zips) | n/a |
23+
2324
<!-- vale on -->
2425
<!-- markdownlint-enable -->
2526
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)