Skip to content

Commit 3e1fe0f

Browse files
authored
CCM-8859: Update accessibility text for logo link (#420)
1 parent 42143e9 commit 3e1fe0f

File tree

4 files changed

+93
-3
lines changed

4 files changed

+93
-3
lines changed

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

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,21 @@ jest.mocked(useAuthenticator).mockReturnValue(
1212
);
1313

1414
describe('Header component', () => {
15-
it('renders component correctly', () => {
15+
it('should contain the logo', () => {
1616
render(<NHSNotifyHeader />);
1717

18-
expect(screen.getByTestId('page-header')).toBeInTheDocument();
1918
expect(screen.getByTestId('page-header-logo')).toBeInTheDocument();
19+
});
20+
21+
it('should contain an authentication link', () => {
22+
render(<NHSNotifyHeader />);
23+
2024
expect(screen.getByTestId('auth-link')).toBeInTheDocument();
2125
});
26+
27+
it('should render correctly', () => {
28+
const container = render(<NHSNotifyHeader />);
29+
30+
expect(container.asFragment()).toMatchSnapshot();
31+
});
2232
});
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Header component should render correctly 1`] = `
4+
<DocumentFragment>
5+
<header
6+
class="nhsuk-header"
7+
data-testid="page-header"
8+
role="banner"
9+
>
10+
<div
11+
class="nhsuk-header__container header__container"
12+
>
13+
<div
14+
class="nhsuk-header__logo"
15+
>
16+
<a
17+
aria-label="NHS Notify templates"
18+
class="nhsuk-header__link nhsuk-header__link--service"
19+
href="/create-and-submit-templates"
20+
>
21+
<svg
22+
class="nhsuk-logo"
23+
data-testid="page-header-logo"
24+
height="40"
25+
role="img"
26+
viewBox="0 0 40 16"
27+
width="100"
28+
xmlns="http://www.w3.org/2000/svg"
29+
>
30+
<title>
31+
NHS logo
32+
</title>
33+
<path
34+
class="nhsuk-logo__background"
35+
d="M0 0h40v16H0z"
36+
fill="#005eb8"
37+
/>
38+
<path
39+
class="nhsuk-logo__text"
40+
d="M3.9 1.5h4.4l2.6 9h.1l1.8-9h3.3l-2.8 13H9l-2.7-9h-.1l-1.8 9H1.1M17.3 1.5h3.6l-1 4.9h4L25 1.5h3.5l-2.7 13h-3.5l1.1-5.6h-4.1l-1.2 5.6h-3.4M37.7 4.4c-.7-.3-1.6-.6-2.9-.6-1.4 0-2.5.2-2.5 1.3 0 1.8 5.1 1.2 5.1 5.1 0 3.6-3.3 4.5-6.4 4.5-1.3 0-2.9-.3-4-.7l.8-2.7c.7.4 2.1.7 3.2.7s2.8-.2 2.8-1.5c0-2.1-5.1-1.3-5.1-5 0-3.4 2.9-4.4 5.8-4.4 1.6 0 3.1.2 4 .6"
41+
fill="#fff"
42+
/>
43+
</svg>
44+
<span
45+
class="nhsuk-header__service-name"
46+
>
47+
Notify
48+
</span>
49+
</a>
50+
</div>
51+
<div
52+
class="nhsuk-header__content"
53+
id="content-header"
54+
>
55+
<div
56+
class="auth-link"
57+
data-testid="auth-link"
58+
>
59+
<a
60+
class="auth-link__link"
61+
data-testid="auth-link__link"
62+
href="/auth?redirect=%2Ftemplates%2Fcreate-and-submit-templates"
63+
id="sign-in-link"
64+
>
65+
Sign in
66+
</a>
67+
</div>
68+
</div>
69+
</div>
70+
</header>
71+
</DocumentFragment>
72+
`;

frontend/src/components/molecules/Header/Header.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,20 @@ export function NHSNotifyHeader({ dataTestId }: HeaderType) {
2222
<Link
2323
className='nhsuk-header__link nhsuk-header__link--service'
2424
href='/create-and-submit-templates'
25-
aria-label='NHS Notify'
25+
aria-label={content.components.header.links.logoLink.ariaLabel}
2626
>
2727
<svg
2828
className='nhsuk-logo'
29+
role='img'
2930
xmlns='http://www.w3.org/2000/svg'
3031
viewBox='0 0 40 16'
3132
height='40'
3233
width='100'
3334
data-testid='page-header-logo'
3435
>
36+
<title>
37+
{content.components.header.links.logoLink.logoTitle}
38+
</title>
3539
<path
3640
className='nhsuk-logo__background'
3741
fill='#005eb8'

frontend/src/content/content.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const header = {
1717
text: 'Sign out',
1818
href: '/auth/signout',
1919
},
20+
logoLink: {
21+
ariaLabel: 'NHS Notify templates',
22+
logoTitle: 'NHS logo',
23+
},
2024
},
2125
};
2226

0 commit comments

Comments
 (0)