Skip to content

Commit

Permalink
Merge pull request #2688 from ONSdigital/bugfix/2136/cookies-banner-p…
Browse files Browse the repository at this point in the history
…aram-name-misleading

Bugfix - 2136 - Cookies Banner Param Rename
  • Loading branch information
willcAND authored Jun 26, 2023
2 parents 9887e2a + 5c3888f commit 4a2fcf9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
36 changes: 18 additions & 18 deletions src/components/cookies-banner/_macro-options.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
| Name | Type | Required | Description |
| -------------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| lang | string | false | All parameters have defaults for both English and Welsh. If `'lang': 'cy'` is provided the banner will render with Welsh language defaults. If `'lang': 'en'` or no `lang` parameter is provided then English language defaults will be used to render the banner. |
| ariaLabel | string | false | Aria label for the cookie banner region (default is 'cookies banner') |
| statementTitle | string | false | The title text for content for the cookie banner that prefixes the `serviceName` (default is 'Cookies on') |
| serviceName | string | false | The name of the service/website that follows the `statementTitle` (default is 'ons.gov.uk') |
| statementText | string | false | The text content for the cookie banner. HTML is allowed to create paragraphs. Default is: ”Cookies are small files stored on your device when you visit a website. We use some essential cookies to make this website work. We would like to set additional cookies to remember your settings and understand how you use the site. This helps us to improve our services.” |
| acceptedText | string | false | The text content when cookies have been accepted. Will prefix the `preferencesText` (default is 'You’ve accepted all additional cookies.') |
| rejectedText | string | false | The text content when cookies have been rejected. Will prefix the `preferencesText` (default is 'You’ve rejected all additional cookies.') |
| preferencesText | string | false | The text content for the confirmation cookie message. HTML is allowable to embed links. Will follow the `acceptedText` or `rejectedText` (default is 'You can change your cookie preferences at any time.') |
| acceptButtonText | string | false | Text for the accept button (default is 'Accept additional cookies') |
| rejectButtonText | string | false | Text for the reject button (default is 'Reject additional preferences') |
| confirmationButtonText | string | false | Text for the confirmation banner button (default is 'Hide') |
| confirmationButtonTextAria | string | false | Additional descriptive text for the confirmation banner button to assist screen readers (default is 'the cookie message') |
| settingsLinkText | string | false | Text for link to cookie settings page (default is 'View cookies') |
| settingsLinkTextURL | string | false | URL for the cookies settings page (default is '/cookies') |
| wide | boolean | false | Set to “true” to increase the maximum width of the layout container to 1280px |
| fullWidth | boolean | false | Set to “true” to increase the maximum width of the layout container to the full width of the viewport |
| Name | Type | Required | Description |
| ---------------------- | ------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| lang | string | false | All parameters have defaults for both English and Welsh. If `'lang': 'cy'` is provided the banner will render with Welsh language defaults. If `'lang': 'en'` or no `lang` parameter is provided then English language defaults will be used to render the banner. |
| ariaLabel | string | false | Aria label for the cookie banner region (default is 'cookies banner') |
| statementTitle | string | false | The title text for content for the cookie banner that prefixes the `serviceName` (default is 'Cookies on') |
| serviceName | string | false | The name of the service/website that follows the `statementTitle` (default is 'ons.gov.uk') |
| statementText | string | false | The text content for the cookie banner. HTML is allowed to create paragraphs. Default is: ”Cookies are small files stored on your device when you visit a website. We use some essential cookies to make this website work. We would like to set additional cookies to remember your settings and understand how you use the site. This helps us to improve our services.” |
| acceptedText | string | false | The text content when cookies have been accepted. Will prefix the `preferencesText` (default is 'You’ve accepted all additional cookies.') |
| rejectedText | string | false | The text content when cookies have been rejected. Will prefix the `preferencesText` (default is 'You’ve rejected all additional cookies.') |
| preferencesText | string | false | The text content for the confirmation cookie message. HTML is allowable to embed links. Will follow the `acceptedText` or `rejectedText` (default is 'You can change your cookie preferences at any time.') |
| acceptButtonText | string | false | Text for the accept button (default is 'Accept additional cookies') |
| rejectButtonText | string | false | Text for the reject button (default is 'Reject additional preferences') |
| confirmationButtonText | string | false | Text for the confirmation banner button (default is 'Hide') |
| contextSuffix | string | false | Additional descriptive text for the confirmation banner button to assist screen readers (default is 'the cookie message') |
| settingsLinkText | string | false | Text for link to cookie settings page (default is 'View cookies') |
| settingsLinkTextURL | string | false | URL for the cookies settings page (default is '/cookies') |
| wide | boolean | false | Set to “true” to increase the maximum width of the layout container to 1280px |
| fullWidth | boolean | false | Set to “true” to increase the maximum width of the layout container to the full width of the viewport |
4 changes: 2 additions & 2 deletions src/components/cookies-banner/_macro.njk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
{% set rejectedText = 'You have rejected all additional cookies.' %}
{% set preferencesText = 'You can <a href="' + settingsLinkURL + '">change your cookie preferences</a> at any time.' %}
{% set confirmationButtonText = 'Hide' %}
{% set confirmationButtonTextAria = 'this message' %}
{% set contextSuffix = 'this message' %}
{% endif %}

<div class="ons-cookies-banner" role="region" aria-label="{{ params.ariaLabel | default(ariaLabel)}}">
Expand Down Expand Up @@ -78,7 +78,7 @@
onsButton({
"type": 'button',
"text": params.confirmationButtonText | default(confirmationButtonText),
"buttonContext": params.confirmationButtonTextAria | default(confirmationButtonTextAria),
"buttonContext": params.contextSuffix | default(contextSuffix),
"classes": 'ons-btn--secondary ons-btn--small ons-js-hide-button'
})
}}
Expand Down
4 changes: 2 additions & 2 deletions src/components/cookies-banner/_macro.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const EXAMPLE_COOKIES_BANNER_PARAMS = {
rejectButtonText: 'Reject additional cookies override',
preferencesText: 'Text override',
confirmationButtonText: 'Hide override',
confirmationButtonTextAria: 'the cookie message override',
contextSuffix: 'the cookie message override',
};

describe('macro: cookies-banner', () => {
Expand Down Expand Up @@ -112,7 +112,7 @@ describe('macro: cookies-banner', () => {
expect(buttonSpy.occurrences[2].text).toBe('Hide override');
});

it('has the correct `confirmationButtonTextAria` for `buttonContext`', () => {
it('has the correct `contextSuffix` for `buttonContext`', () => {
const faker = templateFaker();
const buttonSpy = faker.spy('button');

Expand Down

0 comments on commit 4a2fcf9

Please sign in to comment.