diff --git a/.github/workflows/check-labels.yml b/.github/workflows/check-labels.yml index e92c31fe7e..790058fcec 100644 --- a/.github/workflows/check-labels.yml +++ b/.github/workflows/check-labels.yml @@ -17,6 +17,6 @@ jobs: steps: - uses: docker://onsdigital/github-pr-label-checker:latest with: - one_of: Accessibility,Bug,Documentation,Dependencies,Enhancement,Example,Component,Pattern,CI/CD,Tech improvements + one_of: Accessibility,Bug,Documentation,Dependencies,Enhancement,Example,Component,Pattern,CI/CD,Tech improvements,Breaking changes none_of: Awaiting resource,Do not merge,Duplicate,Needs validating,Not doing repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/__snapshots__/layout/_template.spec.js.snap b/__snapshots__/layout/_template.spec.js.snap index 234f8d23a9..438cc982d8 100644 --- a/__snapshots__/layout/_template.spec.js.snap +++ b/__snapshots__/layout/_template.spec.js.snap @@ -165,7 +165,7 @@ exports[`base page template matches the favicons block override snapshot 1`] = `
{{ params.paragraphText }}
- {% endif %} -{{ params.text }}
+{{ params.body.text }}
- {%- if params.itemsList -%} + {%- if params.body.itemsList -%} {% from "components/list/_macro.njk" import onsList %} {{ onsList({ "variants": 'dashed', - "itemsList": params.itemsList + "itemsList": params.body.itemsList }) }} {% endif %} diff --git a/src/components/card/_macro.spec.js b/src/components/card/_macro.spec.js index ba6bf0261d..4cfd1b1ce1 100644 --- a/src/components/card/_macro.spec.js +++ b/src/components/card/_macro.spec.js @@ -6,15 +6,17 @@ import axe from '../../tests/helpers/axe'; import { renderComponent, templateFaker } from '../../tests/helpers/rendering'; const EXAMPLE_CARD_WITHOUT_IMAGE = { - title: 'Example card title', - text: 'Example card text.', - textId: 'example-text-id', + title: { + text: 'Example card title', + }, + body: { + text: 'Example card text.', + id: 'example-text-id', + }, }; const EXAMPLE_CARD_WITH_IMAGE = { - title: 'Example card title', - text: 'Example card text.', - textId: 'example-text-id', + ...EXAMPLE_CARD_WITHOUT_IMAGE, image: { smallSrc: 'example-small.png', largeSrc: 'example-large.png', @@ -23,18 +25,14 @@ const EXAMPLE_CARD_WITH_IMAGE = { }; const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE = { - title: 'Example card title', - text: 'Example card text.', - textId: 'example-text-id', + ...EXAMPLE_CARD_WITHOUT_IMAGE, image: true, }; const EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH = { - title: 'Example card title', - text: 'Example card text.', - textId: 'example-text-id', + ...EXAMPLE_CARD_WITHOUT_IMAGE, image: { - placeholderURL: '/placeholder-image-url', + placeholderUrl: '/placeholder-image-url', }, }; @@ -59,8 +57,14 @@ describe('macro: card', () => { ])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => { const $ = cheerio.load( renderComponent('card', { - ...EXAMPLE_CARD_WITHOUT_IMAGE, - headingLevel, + title: { + text: 'Example card title', + headingLevel: headingLevel, + }, + body: { + text: 'Example card text.', + id: 'example-text-id', + }, }), ); @@ -78,8 +82,14 @@ describe('macro: card', () => { const listsSpy = faker.spy('list'); faker.renderComponent('card', { - ...EXAMPLE_CARD_WITHOUT_IMAGE, - itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }], + title: { + text: 'Example card title', + }, + body: { + text: 'Example card text.', + id: 'example-text-id', + itemsList: [{ text: 'Test item 1' }, { text: 'Test item 2' }], + }, }); expect(listsSpy.occurrences[0]).toEqual({ @@ -91,8 +101,14 @@ describe('macro: card', () => { it('outputs a hyperlink with the provided `url`', () => { const $ = cheerio.load( renderComponent('card', { - ...EXAMPLE_CARD_WITHOUT_IMAGE, - url: 'https://example.com', + title: { + text: 'Example card title', + url: 'https://example.com', + }, + body: { + text: 'Example card text.', + id: 'example-text-id', + }, }), ); @@ -120,8 +136,19 @@ describe('macro: card', () => { ])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => { const $ = cheerio.load( renderComponent('card', { - ...EXAMPLE_CARD_WITH_IMAGE, - headingLevel, + title: { + text: 'Example card title', + headingLevel: headingLevel, + }, + body: { + text: 'Example card text.', + id: 'example-text-id', + }, + image: { + smallSrc: 'example-small.png', + largeSrc: 'example-large.png', + alt: 'Example alt text', + }, }), ); @@ -141,8 +168,14 @@ describe('macro: card', () => { it('outputs a hyperlink with the provided `url`', () => { const $ = cheerio.load( renderComponent('card', { - ...EXAMPLE_CARD_WITH_IMAGE, - url: 'https://example.com', + title: { + text: 'Example card title', + url: 'https://example.com', + }, + body: { + text: 'Example card text.', + id: 'example-text-id', + }, }), ); @@ -206,7 +239,7 @@ describe('macro: card', () => { }); }); - describe('with a default placeholder image with `placeholderURL`', () => { + describe('with a default placeholder image with `placeholderUrl`', () => { it('outputs an `img` element', () => { const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_PLACEHOLDER_IMAGE_WITH_PATH)); diff --git a/src/components/card/example-card-set-with-images.njk b/src/components/card/example-card-set-with-images.njk index ce2b7844c0..ab1d634ace 100644 --- a/src/components/card/example-card-set-with-images.njk +++ b/src/components/card/example-card-set-with-images.njk @@ -4,12 +4,16 @@Ffeiliau bach a gaiff eu storio ar eich dyfais pan fyddwch yn mynd ar wefan yw cwcis. Rydym ni’n defnyddio rhai cwcis hanfodol i wneud i’r wefan hon weithio.
Hoffem osod' %} {% set afterLinkStatementText = 'cwcis ychwanegol er mwyn cofio eich gosodiadau a deall sut rydych chi’n defnyddio’r wefan. Mae hyn yn ein helpu ni i wella ein gwasanaethau.
' %} {% else %} @@ -29,19 +29,19 @@ {% set rejectedText = 'You have rejected all additional cookies.' %} {% set confirmationButtonText = 'Hide' %} {% set contextSuffix = 'cookie message' %} - {% set beforeLinkPreferencesURL = 'You can' %} - {% set afterLinkPreferencesURL = 'change your cookie preferences at any time.' %} + {% set beforeLinkPreferencesUrl = 'You can' %} + {% set afterLinkPreferencesUrl = 'change your cookie preferences at any time.' %} {% set beforeLinkStatementText = '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' %} {% set afterLinkStatementText = 'additional cookies to remember your settings and understand how you use the site. This helps us to improve our services.
' %} {% endif %} {% if not isDesignSystemExample %} - {% set settingsLinkURL = params.settingsLinkTextURL | default(defaultCookiesLink) %} + {% set settingsLinkUrl = params.settingsLinkUrl | default(defaultCookiesLink) %} {% else %} - {% set settingsLinkURL = '#0' %} + {% set settingsLinkUrl = '#0' %} {% endif %} - {% set statementText = beforeLinkStatementText + ' ' + afterLinkStatementText %} - {% set preferencesText = beforeLinkPreferencesURL + ' ' + afterLinkPreferencesURL %} + {% set statementText = beforeLinkStatementText + ' ' + afterLinkStatementText %} + {% set preferencesText = beforeLinkPreferencesUrl + ' ' + afterLinkPreferencesUrl %}
{{ params.acceptedText | default(acceptedText) | safe }} {{ params.rejectedText | default(rejectedText) | safe }}
- {% set titleTag = params.titleTag | default("h2") %}
- {% set openingTag = "<" + titleTag %}
- {% set closingTag = "" + titleTag + ">" %}
+ {% set titleTag = params.headingLevel | default(2) %}
+ {% set openingTag = "