Skip to content

Commit

Permalink
PLATUI-2900: Added missing navigationLabel param to header (#358)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoPintoPaul committed Mar 25, 2024
1 parent ea7332f commit 65e29ea
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [6.11.0] - 2024-03-25

### Changed

- Added `navigationLabel` param to `header` component in line with the `govuk-frontend` header

## [6.10.0] - 2024-03-25

### Changed
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "hmrc-frontend",
"version": "6.10.0",
"version": "6.11.0",
"description": "Design patterns for HMRC frontends",
"scripts": {
"start": "gulp dev",
Expand Down
13 changes: 9 additions & 4 deletions src/components/header/header.yaml
Expand Up @@ -48,6 +48,10 @@ params:
type: string
required: false
description: Classes for the navigation section of the header.
- name: navigationLabel
type: string
required: false
description: Text for the `aria-label` attribute of the navigation. Defaults to the same value as `menuButtonText`.
- name: menuButtonLabel
type: string
required: false
Expand Down Expand Up @@ -459,8 +463,8 @@ examples:
attributes:
data-test-attribute-3: value-3

- name: with custom menu button text and label
description: With the menuButtonText and menuButtonLabel parameters set
- name: with custom navigation text and labels
description: With the menuButtonText, menuButtonLabel and navigationLabel parameters set
data:
navigation:
- href: '#1'
Expand All @@ -472,5 +476,6 @@ examples:
text: Navigation item 3
- href: '#4'
text: Navigation item 4
menuButtonText: 'Some custom button text'
menuButtonLabel: 'Some custom button aria label'
menuButtonText: 'Custom button text'
menuButtonLabel: 'Custom button label'
navigationLabel: 'Custom navigation label'
15 changes: 11 additions & 4 deletions src/components/header/template.test.js
Expand Up @@ -190,6 +190,13 @@ describe('header', () => {
expect(outputs[0]).toEqual(outputs[2]);
});

it('renders navigation with a custom aria label', () => {
const $ = render('header', examples['with custom navigation text and labels']);

const $nav = $('.govuk-header__navigation');
expect($nav.attr('aria-label').trim()).toEqual('Custom navigation label');
});

describe('menu button', () => {
it('should have English text as default', () => {
const $ = render('header', examples['with navigation']);
Expand All @@ -205,12 +212,12 @@ describe('header', () => {
expect($button.text().trim()).toEqual('Dewislen');
});

it('should have custom text and aria-label when specified', () => {
const $ = render('header', examples['with custom menu button text and label']);
it('should have custom text and labels when specified', () => {
const $ = render('header', examples['with custom navigation text and labels']);

const $button = $('.govuk-header__menu-button');
expect($button.text().trim()).toEqual('Some custom button text');
expect($button.attr('aria-label').trim()).toEqual('Some custom button aria label');
expect($button.text().trim()).toEqual('Custom button text');
expect($button.attr('aria-label').trim()).toEqual('Custom button label');
});
});
});
Expand Down

0 comments on commit 65e29ea

Please sign in to comment.