diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_0_desktop.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_0_desktop.png new file mode 100644 index 0000000000..a06a16cf9f --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_0_desktop.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b4e537c199381dbfb2e84fcd1b35362a86078e488345da76b9a866c1348250b +size 436423 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_1_tablet.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_1_tablet.png new file mode 100644 index 0000000000..3b3837611d --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_1_tablet.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82188b2f7f7fcbc06ca8d274937c95c578b04a4ddf7071aeb575a3e4dd571a13 +size 417139 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_2_mobile.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_2_mobile.png new file mode 100644 index 0000000000..7b7fd06457 --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-regular-screens_0_document_2_mobile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33af11d0ab2ba81871775f21aed3d9d5692d5a9ed526b54f4cc401b2acbede09 +size 139714 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_0_desktop.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_0_desktop.png new file mode 100644 index 0000000000..a06a16cf9f --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_0_desktop.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b4e537c199381dbfb2e84fcd1b35362a86078e488345da76b9a866c1348250b +size 436423 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_1_tablet.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_1_tablet.png new file mode 100644 index 0000000000..3b3837611d --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_1_tablet.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82188b2f7f7fcbc06ca8d274937c95c578b04a4ddf7071aeb575a3e4dd571a13 +size 417139 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_2_mobile.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_2_mobile.png new file mode 100644 index 0000000000..7b7fd06457 --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-image-for-retina-screens_0_document_2_mobile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33af11d0ab2ba81871775f21aed3d9d5692d5a9ed526b54f4cc401b2acbede09 +size 139714 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_0_desktop.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_0_desktop.png new file mode 100644 index 0000000000..a06a16cf9f --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_0_desktop.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b4e537c199381dbfb2e84fcd1b35362a86078e488345da76b9a866c1348250b +size 436423 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_1_tablet.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_1_tablet.png new file mode 100644 index 0000000000..3b3837611d --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_1_tablet.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82188b2f7f7fcbc06ca8d274937c95c578b04a4ddf7071aeb575a3e4dd571a13 +size 417139 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_2_mobile.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_2_mobile.png new file mode 100644 index 0000000000..7b7fd06457 --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-regular-screens_0_document_2_mobile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33af11d0ab2ba81871775f21aed3d9d5692d5a9ed526b54f4cc401b2acbede09 +size 139714 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_0_desktop.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_0_desktop.png new file mode 100644 index 0000000000..a06a16cf9f --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_0_desktop.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9b4e537c199381dbfb2e84fcd1b35362a86078e488345da76b9a866c1348250b +size 436423 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_1_tablet.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_1_tablet.png new file mode 100644 index 0000000000..3b3837611d --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_1_tablet.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82188b2f7f7fcbc06ca8d274937c95c578b04a4ddf7071aeb575a3e4dd571a13 +size 417139 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_2_mobile.png b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_2_mobile.png new file mode 100644 index 0000000000..7b7fd06457 --- /dev/null +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_image_example-images-for-retina-screens_0_document_2_mobile.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33af11d0ab2ba81871775f21aed3d9d5692d5a9ed526b54f4cc401b2acbede09 +size 139714 diff --git a/config/components.json b/config/components.json index 6ed1abf2c2..702a0d45b1 100644 --- a/config/components.json +++ b/config/components.json @@ -12,7 +12,7 @@ "icon": { "macroName": "onsIcon" }, - "images": { + "image": { "macroName": "onsImage" }, "list": { diff --git a/src/components/images/_images.scss b/src/components/image/_image.scss similarity index 100% rename from src/components/images/_images.scss rename to src/components/image/_image.scss diff --git a/src/components/images/_macro-options.md b/src/components/image/_macro-options.md similarity index 100% rename from src/components/images/_macro-options.md rename to src/components/image/_macro-options.md diff --git a/src/components/images/_macro.njk b/src/components/image/_macro.njk similarity index 100% rename from src/components/images/_macro.njk rename to src/components/image/_macro.njk diff --git a/src/components/images/_macro.spec.js b/src/components/image/_macro.spec.js similarity index 76% rename from src/components/images/_macro.spec.js rename to src/components/image/_macro.spec.js index 091c40c9f3..6bf0cc63b4 100644 --- a/src/components/images/_macro.spec.js +++ b/src/components/image/_macro.spec.js @@ -16,16 +16,16 @@ const EXAMPLE_IMAGE_IMAGE_MINIMAL = { }, }; -describe('macro: images', () => { +describe('macro: image', () => { it('outputs a `figure` element', () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL)); expect($('.ons-figure')[0].tagName).toBe('figure'); }); it('outputs a `figurecaption` element when `caption` is provided', () => { const $ = cheerio.load( - renderComponent('images', { + renderComponent('image', { ...EXAMPLE_IMAGE_URL_MINIMAL, caption: 'Example image caption', }), @@ -36,7 +36,7 @@ describe('macro: images', () => { it('outputs a `figurecaption` element with provided `caption` text', () => { const $ = cheerio.load( - renderComponent('images', { + renderComponent('image', { ...EXAMPLE_IMAGE_URL_MINIMAL, caption: 'Example image caption', }), @@ -51,27 +51,27 @@ describe('macro: images', () => { describe('mode: url', () => { it('passes jest-axe checks', async () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL)); const results = await axe($.html()); expect(results).toHaveNoViolations(); }); it('outputs an `img` element', () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL)); expect($('.ons-figure__image')[0].tagName).toBe('img'); }); it('outputs an `img` element with the expected `src`', () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_URL_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_URL_MINIMAL)); expect($('.ons-figure__image').attr('src')).toBe('example.png'); }); it('outputs an `img` element with the expected alt text', () => { const $ = cheerio.load( - renderComponent('images', { + renderComponent('image', { ...EXAMPLE_IMAGE_URL_MINIMAL, alt: 'Example alt text', }), @@ -83,33 +83,33 @@ describe('macro: images', () => { describe('mode: image', () => { it('passes jest-axe checks', async () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL)); const results = await axe($.html()); expect(results).toHaveNoViolations(); }); it('outputs an `img` element', () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL)); expect($('.ons-figure__image')[0].tagName).toBe('img'); }); it('outputs an `img` element with the expected `srcset`', () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL)); expect($('.ons-figure__image').attr('srcset')).toBe('example-small.png 1x, example-large.png 2x'); }); it('outputs an `img` element with the expected `src`', () => { - const $ = cheerio.load(renderComponent('images', EXAMPLE_IMAGE_IMAGE_MINIMAL)); + const $ = cheerio.load(renderComponent('image', EXAMPLE_IMAGE_IMAGE_MINIMAL)); expect($('.ons-figure__image').attr('src')).toBe('example-small.png'); }); it('outputs an `img` element with the expected alt text', () => { const $ = cheerio.load( - renderComponent('images', { + renderComponent('image', { ...EXAMPLE_IMAGE_IMAGE_MINIMAL, alt: 'Example alt text', }), diff --git a/src/components/images/example-images-for-regular-screens.njk b/src/components/image/example-image-for-regular-screens.njk similarity index 79% rename from src/components/images/example-images-for-regular-screens.njk rename to src/components/image/example-image-for-regular-screens.njk index a8831c3fd1..3fc8484b45 100644 --- a/src/components/images/example-images-for-regular-screens.njk +++ b/src/components/image/example-image-for-regular-screens.njk @@ -1,4 +1,4 @@ -{% from "components/images/_macro.njk" import onsImage %} +{% from "components/image/_macro.njk" import onsImage %} {{ onsImage({ "url": '/img/small/woman-in-purple-dress-shirt.jpg', diff --git a/src/components/images/example-images-for-retina-screens.njk b/src/components/image/example-image-for-retina-screens.njk similarity index 82% rename from src/components/images/example-images-for-retina-screens.njk rename to src/components/image/example-image-for-retina-screens.njk index eab29f8ae5..ef4d6e3943 100644 --- a/src/components/images/example-images-for-retina-screens.njk +++ b/src/components/image/example-image-for-retina-screens.njk @@ -1,4 +1,4 @@ -{% from "components/images/_macro.njk" import onsImage %} +{% from "components/image/_macro.njk" import onsImage %} {{ onsImage({ "image": { diff --git a/src/components/message/_macro-options.md b/src/components/message/_macro-options.md index 6c8ad88d87..80bde186e7 100644 --- a/src/components/message/_macro-options.md +++ b/src/components/message/_macro-options.md @@ -2,7 +2,6 @@ | -------------- | ------ | -------- | ---------------------------------------------------------------------- | | type | string | true | Set to “sent” or “received” to style message type | | id | string | false | The HTML `id` of the message header metadata element | -| name | string | false | The HTML `name` attribute for the message header metadata element | | fromLabel | string | true | Label for the “From” prefix in the message header metadata element | | fromValue | string | true | Value of the “From” sender name in the message header metadata element | | fromId | string | false | The HTML `id` of the `fromValue` element | @@ -15,4 +14,3 @@ | unreadLink | string | false | The URL for the “Mark unread” link element’s `href` attribute | | unreadLinkId | string | false | The HTML `id` of the “Mark unread” link element | | messageID | string | false | The HTML `id` of the message body | -| messageName | string | false | The HTML `name` attribute of the message body | diff --git a/src/components/message/_macro.njk b/src/components/message/_macro.njk index a1de2762d3..b70e26e02d 100644 --- a/src/components/message/_macro.njk +++ b/src/components/message/_macro.njk @@ -1,7 +1,7 @@ {%- macro onsMessage(params) -%}