@ons/design-system 68.0.0 → 70.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/components/access-code/_macro.njk +1 -1
- package/components/access-code/_macro.spec.js +2 -10
- package/components/access-code/access-code.dom.js +1 -1
- package/components/access-code/access-code.spec.js +2 -2
- package/components/access-code/example-access-code-error.njk +9 -14
- package/components/access-code/example-access-code.njk +3 -5
- package/components/accordion/accordion.js +4 -4
- package/components/address-input/_macro.spec.js +3 -15
- package/components/address-input/autosuggest.address.dom.js +1 -1
- package/components/address-input/autosuggest.address.js +3 -2
- package/components/address-input/autosuggest.address.setter.js +3 -3
- package/components/address-input/autosuggest.address.spec.js +66 -69
- package/components/address-output/_macro.spec.js +6 -30
- package/components/autosuggest/_autosuggest.scss +1 -1
- package/components/autosuggest/autosuggest.dom.js +1 -1
- package/components/autosuggest/autosuggest.helpers.js +1 -1
- package/components/back-to-top/_back-to-top.scss +34 -0
- package/components/back-to-top/_macro.njk +17 -0
- package/components/back-to-top/_macro.spec.js +60 -0
- package/components/back-to-top/back-to-top.dom.js +12 -0
- package/components/back-to-top/back-to-top.js +58 -0
- package/components/back-to-top/back-to-top.spec.js +117 -0
- package/components/back-to-top/example-back-to-top.njk +37 -0
- package/components/back-to-top/example-full-page-back-to-top.njk +192 -0
- package/components/browser-banner/_macro.spec.js +4 -12
- package/components/button/_macro.njk +6 -6
- package/components/button/_macro.spec.js +1 -5
- package/components/button/button.js +7 -8
- package/components/button/button.spec.js +17 -39
- package/components/call-to-action/_macro.spec.js +2 -6
- package/components/card/_macro.njk +25 -25
- package/components/card/_macro.spec.js +10 -34
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/char-check-limit/_macro.spec.js +3 -7
- package/components/char-check-limit/character-check.spec.js +24 -20
- package/components/checkboxes/_checkbox-macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +0 -3
- package/components/checkboxes/_macro.spec.js +1 -5
- package/components/checkboxes/checkbox-with-autoselect.js +3 -3
- package/components/checkboxes/checkbox-with-fieldset.js +2 -2
- package/components/checkboxes/checkboxes-with-reveal.js +4 -2
- package/components/checkboxes/checkboxes.dom.js +2 -2
- package/components/checkboxes/checkboxes.spec.js +13 -13
- package/components/content-pagination/_macro.spec.js +2 -2
- package/components/cookies-banner/cookies-banner.dom.js +1 -1
- package/components/cookies-banner/cookies-banner.js +1 -1
- package/components/cookies-banner/cookies-banner.spec.js +7 -7
- package/components/date-input/_macro.njk +71 -69
- package/components/date-input/_macro.spec.js +20 -5
- package/components/date-input/example-date-input-double-field.njk +27 -0
- package/components/date-input/example-date-input-single-field.njk +18 -0
- package/components/details/details.spec.js +12 -12
- package/components/details/example-details-with-warning.njk +5 -7
- package/components/document-list/_macro.spec.js +9 -27
- package/components/document-list/document-list.scss +1 -1
- package/components/document-list/example-document-list-downloads.njk +3 -3
- package/components/document-list/example-document-list-search-result-featured.njk +1 -1
- package/components/document-list/example-document-list-search-results.njk +3 -3
- package/components/download-resources/download-resources.js +54 -54
- package/components/download-resources/download-resources.spec.js +3 -1
- package/components/duration/_macro.njk +52 -48
- package/components/duration/_macro.spec.js +112 -4
- package/components/duration/example-duration-error-for-single-field.njk +1 -1
- package/components/duration/example-duration-single-field.njk +24 -0
- package/components/error/_macro.njk +1 -1
- package/components/error/_macro.spec.js +2 -6
- package/components/feedback/_macro.njk +1 -1
- package/components/feedback/_macro.spec.js +4 -20
- package/components/field/_macro.spec.js +1 -3
- package/components/fieldset/_fieldset.scss +1 -2
- package/components/fieldset/_macro.spec.js +3 -9
- package/components/footer/_footer.scss +8 -0
- package/components/footer/_macro.njk +8 -7
- package/components/footer/_macro.spec.js +14 -2
- package/components/header/_macro.njk +1 -1
- package/components/header/_macro.spec.js +1 -1
- package/components/helpers/grid.njk +15 -15
- package/components/icon/_macro.njk +15 -11
- package/components/icon/_macro.spec.js +8 -16
- package/components/image/_macro.spec.js +1 -5
- package/components/input/_macro.njk +22 -23
- package/components/input/_macro.spec.js +1 -1
- package/components/input/character-check.dom.js +1 -1
- package/components/input/input.spec.js +1 -4
- package/components/label/_label.scss +1 -0
- package/components/label/_macro.njk +2 -2
- package/components/label/_macro.spec.js +4 -13
- package/components/list/_macro.spec.js +4 -12
- package/components/message/_macro.njk +17 -17
- package/components/message/_macro.spec.js +9 -33
- package/components/message-list/_macro.spec.js +7 -39
- package/components/metadata/_macro.njk +10 -10
- package/components/modal/_macro.spec.js +3 -9
- package/components/modal/modal.dom.js +1 -1
- package/components/modal/modal.spec.js +5 -5
- package/components/multiple-input-fields/_macro.njk +49 -0
- package/components/mutually-exclusive/_macro.spec.js +2 -10
- package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +26 -26
- package/components/mutually-exclusive/mutually-exclusive.date.spec.js +9 -9
- package/components/mutually-exclusive/mutually-exclusive.dom.js +1 -1
- package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +8 -8
- package/components/mutually-exclusive/mutually-exclusive.email.spec.js +7 -7
- package/components/mutually-exclusive/mutually-exclusive.js +13 -13
- package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +29 -29
- package/components/mutually-exclusive/mutually-exclusive.number.spec.js +7 -7
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +8 -8
- package/components/navigation/navigation.spec.js +0 -2
- package/components/pagination/_macro.spec.js +11 -53
- package/components/panel/_macro.njk +17 -17
- package/components/panel/_macro.spec.js +25 -25
- package/components/panel/_panel.scss +10 -9
- package/components/panel/example-panel-bare.njk +3 -4
- package/components/panel/example-panel-with-announcement.njk +6 -10
- package/components/panel/example-panel-with-error-summary.njk +2 -2
- package/components/panel/example-panel-with-information.njk +0 -1
- package/components/panel/example-panel-with-success-message.njk +1 -1
- package/components/panel/example-panel-with-warning.njk +2 -3
- package/components/password/password.dom.js +1 -1
- package/components/phase-banner/_macro.spec.js +3 -9
- package/components/question/_macro.njk +1 -1
- package/components/question/_macro.spec.js +5 -19
- package/components/question/_question.scss +1 -4
- package/components/question/example-question-interviewer-note.njk +1 -1
- package/components/quote/_macro.spec.js +2 -10
- package/components/radios/clear-radios.js +3 -3
- package/components/radios/radio-with-fieldset.js +4 -4
- package/components/radios/radios.dom.js +1 -1
- package/components/radios/radios.spec.js +26 -26
- package/components/related-content/_macro.spec.js +2 -4
- package/components/related-content/_section-macro.spec.js +2 -8
- package/components/relationships/example-relationships-error.njk +16 -18
- package/components/relationships/relationships.dom.js +1 -1
- package/components/relationships/relationships.js +2 -2
- package/components/reply/_macro.spec.js +3 -3
- package/components/reply/reply.dom.js +1 -1
- package/components/reply/reply.spec.js +3 -3
- package/components/section-navigation/_macro.njk +12 -12
- package/components/section-navigation/_macro.spec.js +13 -21
- package/components/select/_macro.spec.js +6 -6
- package/components/share-page/_macro.spec.js +6 -14
- package/components/skip-to-content/_macro.spec.js +3 -11
- package/components/skip-to-content/skip-to-content.dom.js +1 -1
- package/components/skip-to-content/skip-to-content.js +1 -1
- package/components/skip-to-content/skip-to-content.spec.js +2 -2
- package/components/status/_macro.njk +2 -2
- package/components/status/_macro.spec.js +5 -9
- package/components/status/example-status-dead.njk +1 -1
- package/components/status/example-status-error.njk +1 -1
- package/components/status/example-status-pending.njk +1 -1
- package/components/status/example-status-small.njk +1 -1
- package/components/status/example-status-success.njk +1 -1
- package/components/summary/_macro.njk +7 -8
- package/components/summary/_macro.spec.js +27 -9
- package/components/table/_macro.spec.js +6 -10
- package/components/table/scrollable-table.dom.js +1 -1
- package/components/table/scrollable-table.js +1 -1
- package/components/table/sortable-table.js +4 -4
- package/components/table/table.spec.js +21 -17
- package/components/table-of-contents/_macro.njk +31 -31
- package/components/table-of-contents/_macro.spec.js +3 -11
- package/components/table-of-contents/toc.dom.js +1 -1
- package/components/table-of-contents/toc.spec.js +36 -32
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/tabs/tabs.dom.js +1 -1
- package/components/tabs/tabs.js +8 -8
- package/components/text-indent/_macro.spec.js +2 -6
- package/components/textarea/textarea.dom.js +1 -1
- package/components/textarea/textarea.spec.js +8 -8
- package/components/timeout-modal/_macro.spec.js +1 -3
- package/components/timeout-modal/timeout-modal.dom.js +1 -1
- package/components/timeout-modal/timeout-modal.spec.js +10 -10
- package/components/timeout-panel/_macro.njk +16 -17
- package/components/timeout-panel/_macro.spec.js +1 -1
- package/components/timeout-panel/timeout-panel.dom.js +1 -1
- package/components/timeout-panel/timeout-panel.spec.js +8 -8
- package/components/video/_macro.spec.js +1 -5
- package/components/video/video.dom.js +1 -1
- package/components/video/video.spec.js +16 -12
- package/css/main.css +1 -1
- package/favicons/safari-pinned-tab.svg +23 -23
- package/js/analytics.js +15 -14
- package/js/cookies-settings.dom.js +1 -1
- package/js/cookies-settings.spec.js +19 -19
- package/js/domready.js +1 -1
- package/js/fetch.js +1 -1
- package/js/inpagelink.js +3 -3
- package/js/main.js +1 -0
- package/js/print-button.js +1 -1
- package/js/timeout.js +1 -1
- package/package.json +2 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_typography.scss +8 -2
- package/scss/main.scss +1 -0
- package/scss/overrides/hcm.scss +8 -1
- package/scss/vars/_colors.scss +2 -1
- package/components/date-field-input/_macro.njk +0 -86
|
@@ -11,6 +11,15 @@ const EXAMPLE_DURATION_INPUT_BASE = {
|
|
|
11
11
|
description: 'Enter “0” into the years field if you have lived at this address for less than a year',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
const EXAMPLE_DURATION_INPUT_BASE_WITH_ERROR = {
|
|
15
|
+
id: 'duration',
|
|
16
|
+
legendOrLabel: 'How long have you lived at this address?',
|
|
17
|
+
description: 'Enter “0” into the years field if you have lived at this address for less than a year',
|
|
18
|
+
error: {
|
|
19
|
+
text: 'Enter how long you have lived at this address',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
14
23
|
const EXAMPLE_FIELD_1 = {
|
|
15
24
|
field1: {
|
|
16
25
|
id: 'address-duration-years',
|
|
@@ -35,6 +44,45 @@ const EXAMPLE_FIELD_2 = {
|
|
|
35
44
|
},
|
|
36
45
|
};
|
|
37
46
|
|
|
47
|
+
const EXAMPLE_FIELD_1_WITH_ERROR = {
|
|
48
|
+
field1: {
|
|
49
|
+
id: 'address-duration-years',
|
|
50
|
+
name: 'address-duration-years',
|
|
51
|
+
value: '0',
|
|
52
|
+
error: true,
|
|
53
|
+
suffix: {
|
|
54
|
+
text: 'Years',
|
|
55
|
+
id: 'address-duration-years-suffix',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const EXAMPLE_FIELD_2_WITH_ERROR = {
|
|
61
|
+
field2: {
|
|
62
|
+
id: 'address-duration-months',
|
|
63
|
+
name: 'address-duration-months',
|
|
64
|
+
value: '0',
|
|
65
|
+
error: true,
|
|
66
|
+
suffix: {
|
|
67
|
+
text: 'Months',
|
|
68
|
+
id: 'address-duration-months-suffix',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const EXAMPLE_FIELD_1_WITH_ERROR_FALSE = {
|
|
74
|
+
field1: {
|
|
75
|
+
id: 'address-duration-years',
|
|
76
|
+
name: 'address-duration-years',
|
|
77
|
+
value: '0',
|
|
78
|
+
error: false,
|
|
79
|
+
suffix: {
|
|
80
|
+
text: 'Years',
|
|
81
|
+
id: 'address-duration-years-suffix',
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
38
86
|
const EXAMPLE_DURATION_SINGLE_FIELD = {
|
|
39
87
|
...EXAMPLE_DURATION_INPUT_BASE,
|
|
40
88
|
...EXAMPLE_FIELD_1,
|
|
@@ -46,6 +94,23 @@ const EXAMPLE_DURATION_MULTIPLE_FIELDS = {
|
|
|
46
94
|
...EXAMPLE_FIELD_2,
|
|
47
95
|
};
|
|
48
96
|
|
|
97
|
+
const EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_SINGLE_ERROR = {
|
|
98
|
+
...EXAMPLE_DURATION_INPUT_BASE_WITH_ERROR,
|
|
99
|
+
...EXAMPLE_FIELD_1,
|
|
100
|
+
...EXAMPLE_FIELD_2_WITH_ERROR,
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR = {
|
|
104
|
+
...EXAMPLE_DURATION_INPUT_BASE_WITH_ERROR,
|
|
105
|
+
...EXAMPLE_FIELD_1_WITH_ERROR,
|
|
106
|
+
...EXAMPLE_FIELD_2_WITH_ERROR,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR_FALSE = {
|
|
110
|
+
...EXAMPLE_DURATION_INPUT_BASE,
|
|
111
|
+
...EXAMPLE_FIELD_1_WITH_ERROR_FALSE,
|
|
112
|
+
};
|
|
113
|
+
|
|
49
114
|
describe('macro: duration', () => {
|
|
50
115
|
describe('mode: multiple fields', () => {
|
|
51
116
|
it('passes jest-axe checks', async () => {
|
|
@@ -109,6 +174,12 @@ describe('macro: duration', () => {
|
|
|
109
174
|
expect($(div).hasClass('ons-field-group')).toBe(true);
|
|
110
175
|
});
|
|
111
176
|
|
|
177
|
+
it('has the correct number of inputs', () => {
|
|
178
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS));
|
|
179
|
+
const $inputs = $('.ons-input');
|
|
180
|
+
expect($inputs.length).toBe(2);
|
|
181
|
+
});
|
|
182
|
+
|
|
112
183
|
it('has the expected `fieldset` output', () => {
|
|
113
184
|
const faker = templateFaker();
|
|
114
185
|
const fieldsetSpy = faker.spy('fieldset');
|
|
@@ -141,10 +212,11 @@ describe('macro: duration', () => {
|
|
|
141
212
|
mutuallyExclusive: {
|
|
142
213
|
legendClasses: 'custom-legend-class',
|
|
143
214
|
dontWrap: true,
|
|
215
|
+
classes: undefined,
|
|
144
216
|
legendIsQuestionTitle: true,
|
|
145
217
|
error: false,
|
|
146
218
|
mutuallyExclusive: {
|
|
147
|
-
|
|
219
|
+
exclusiveOptions: {},
|
|
148
220
|
or: 'Or',
|
|
149
221
|
deselectMessage: 'Deselect message',
|
|
150
222
|
deselectGroupAdjective: 'Deselect group adjective',
|
|
@@ -166,10 +238,10 @@ describe('macro: duration', () => {
|
|
|
166
238
|
...EXAMPLE_DURATION_MULTIPLE_FIELDS,
|
|
167
239
|
legendClasses: 'custom-legend-class',
|
|
168
240
|
dontWrap: true,
|
|
241
|
+
classes: undefined,
|
|
169
242
|
legendIsQuestionTitle: true,
|
|
170
243
|
error: false,
|
|
171
244
|
mutuallyExclusive: {
|
|
172
|
-
checkbox: {},
|
|
173
245
|
or: 'Or',
|
|
174
246
|
deselectMessage: 'Deselect message',
|
|
175
247
|
deselectGroupAdjective: 'Deselect group adjective',
|
|
@@ -183,9 +255,9 @@ describe('macro: duration', () => {
|
|
|
183
255
|
description: 'Enter “0” into the years field if you have lived at this address for less than a year',
|
|
184
256
|
legendClasses: 'custom-legend-class',
|
|
185
257
|
dontWrap: true,
|
|
258
|
+
classes: undefined,
|
|
186
259
|
legendIsQuestionTitle: true,
|
|
187
260
|
error: false,
|
|
188
|
-
checkbox: {},
|
|
189
261
|
or: 'Or',
|
|
190
262
|
deselectMessage: 'Deselect message',
|
|
191
263
|
deselectGroupAdjective: 'Deselect group adjective',
|
|
@@ -215,7 +287,6 @@ describe('macro: duration', () => {
|
|
|
215
287
|
classes: '',
|
|
216
288
|
value: '0',
|
|
217
289
|
attributes: undefined,
|
|
218
|
-
classes: '',
|
|
219
290
|
error: undefined,
|
|
220
291
|
fieldId: 'duration',
|
|
221
292
|
label: {
|
|
@@ -226,10 +297,17 @@ describe('macro: duration', () => {
|
|
|
226
297
|
suffix: {
|
|
227
298
|
id: 'address-duration-years-suffix',
|
|
228
299
|
text: 'Years',
|
|
300
|
+
title: undefined,
|
|
229
301
|
},
|
|
230
302
|
});
|
|
231
303
|
});
|
|
232
304
|
|
|
305
|
+
it('has the correct number of inputs', () => {
|
|
306
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_SINGLE_FIELD));
|
|
307
|
+
const $inputs = $('.ons-input');
|
|
308
|
+
expect($inputs.length).toBe(1);
|
|
309
|
+
});
|
|
310
|
+
|
|
233
311
|
it('has the expected `error` output', () => {
|
|
234
312
|
const faker = templateFaker();
|
|
235
313
|
const errorSpy = faker.spy('error');
|
|
@@ -244,4 +322,34 @@ describe('macro: duration', () => {
|
|
|
244
322
|
});
|
|
245
323
|
});
|
|
246
324
|
});
|
|
325
|
+
|
|
326
|
+
describe('mode: multiple fields with errors', () => {
|
|
327
|
+
it('passes jest-axe checks', async () => {
|
|
328
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
|
|
329
|
+
|
|
330
|
+
const results = await axe($.html());
|
|
331
|
+
expect(results).toHaveNoViolations();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('has the provided error class on one input', async () => {
|
|
335
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
|
|
336
|
+
const $errorContent = $('.ons-input--error');
|
|
337
|
+
|
|
338
|
+
expect($errorContent.length).toBe(1);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it('has the provided error class on multiple inputs', async () => {
|
|
342
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR));
|
|
343
|
+
const $errorContent = $('.ons-input--error');
|
|
344
|
+
|
|
345
|
+
expect($errorContent.length).toBe(2);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('does not provide error class when error parameter set to false', async () => {
|
|
349
|
+
const $ = cheerio.load(renderComponent('duration', EXAMPLE_DURATION_MULTIPLE_FIELDS_WITH_ERROR_FALSE));
|
|
350
|
+
const $errorContent = $('.ons-input--error');
|
|
351
|
+
|
|
352
|
+
expect($errorContent.length).toBe(0);
|
|
353
|
+
});
|
|
354
|
+
});
|
|
247
355
|
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"legendOrLabel": 'How long do you spend travelling to and from work each day?',
|
|
7
7
|
"legendClasses": 'ons-u-vh',
|
|
8
8
|
"error": {
|
|
9
|
-
"text": "Enter a number that is less than 60",
|
|
9
|
+
"text": "Enter a number of minutes that is less than 60",
|
|
10
10
|
"id": "duration-error"
|
|
11
11
|
},
|
|
12
12
|
"field1": {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{% from "components/question/_macro.njk" import onsQuestion %}
|
|
2
|
+
{% from "components/duration/_macro.njk" import onsDuration %}
|
|
3
|
+
|
|
4
|
+
{% call onsQuestion({
|
|
5
|
+
"title": "How many years have you lived at this address?",
|
|
6
|
+
"description": "<p>Enter “0” into the years field if you have lived at this address for less than a year</p>",
|
|
7
|
+
"legendIsQuestionTitle": true
|
|
8
|
+
}) %}
|
|
9
|
+
{{ onsDuration({
|
|
10
|
+
"id": "address-duration-example-single",
|
|
11
|
+
"dontWrap": true,
|
|
12
|
+
"field1": {
|
|
13
|
+
"id": "address-duration-years-example",
|
|
14
|
+
"name": "address-duration-years",
|
|
15
|
+
"suffix": {
|
|
16
|
+
"text": "Years",
|
|
17
|
+
"id": "address-duration-years-suffix-example"
|
|
18
|
+
},
|
|
19
|
+
"attributes": {
|
|
20
|
+
"autocomplete": "off"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}) }}
|
|
24
|
+
{% endcall %}
|
|
@@ -36,11 +36,7 @@ describe('macro: error', () => {
|
|
|
36
36
|
),
|
|
37
37
|
);
|
|
38
38
|
|
|
39
|
-
expect(
|
|
40
|
-
$('.ons-panel__error')
|
|
41
|
-
.text()
|
|
42
|
-
.trim(),
|
|
43
|
-
).toBe('Example error text.');
|
|
39
|
+
expect($('.ons-panel__error').text().trim()).toBe('Example error text.');
|
|
44
40
|
});
|
|
45
41
|
|
|
46
42
|
it('applies the provided `attributes` to the error content paragraph', () => {
|
|
@@ -76,7 +72,7 @@ describe('macro: error', () => {
|
|
|
76
72
|
FAKE_NESTED_CONTENT,
|
|
77
73
|
);
|
|
78
74
|
|
|
79
|
-
expect(panelSpy.occurrences[0].
|
|
75
|
+
expect(panelSpy.occurrences[0].variant).toBe('error');
|
|
80
76
|
expect(panelSpy.occurrences[0].id).toBe('example-error');
|
|
81
77
|
});
|
|
82
78
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{% macro onsFeedback(params) %}
|
|
2
|
-
{% set headingLevel = params.headingLevel | default(
|
|
2
|
+
{% set headingLevel = params.headingLevel | default(2) %}
|
|
3
3
|
<div {% if params.id %} id="{{ params.id }}"{% endif %} class="ons-feedback{% if params.classes %} {{ params.classes }}{% endif %}">
|
|
4
4
|
<h{{ headingLevel }} class="ons-feedback__heading{{ ' ' + params.headingClasses if params.headingClasses }}">
|
|
5
5
|
{{ params.heading }}
|
|
@@ -70,21 +70,13 @@ describe('macro: feedback', () => {
|
|
|
70
70
|
}),
|
|
71
71
|
);
|
|
72
72
|
|
|
73
|
-
expect(
|
|
74
|
-
$(`${expectedTitleTag}.ons-feedback__heading`)
|
|
75
|
-
.text()
|
|
76
|
-
.trim(),
|
|
77
|
-
).toBe('Feedback heading');
|
|
73
|
+
expect($(`${expectedTitleTag}.ons-feedback__heading`).text().trim()).toBe('Feedback heading');
|
|
78
74
|
});
|
|
79
75
|
|
|
80
76
|
it('has a default `headingLevel` of 2', () => {
|
|
81
77
|
const $ = cheerio.load(renderComponent('feedback', EXAMPLE_FEEDBACK_MINIMAL));
|
|
82
78
|
|
|
83
|
-
expect(
|
|
84
|
-
$(`h2.ons-feedback__heading`)
|
|
85
|
-
.text()
|
|
86
|
-
.trim(),
|
|
87
|
-
).toBe('Feedback heading');
|
|
79
|
+
expect($(`h2.ons-feedback__heading`).text().trim()).toBe('Feedback heading');
|
|
88
80
|
});
|
|
89
81
|
|
|
90
82
|
it('has additional heading style classes', () => {
|
|
@@ -97,11 +89,7 @@ describe('macro: feedback', () => {
|
|
|
97
89
|
it('has a paragraph with the provided `content`', () => {
|
|
98
90
|
const $ = cheerio.load(renderComponent('feedback', EXAMPLE_FEEDBACK_MINIMAL));
|
|
99
91
|
|
|
100
|
-
expect(
|
|
101
|
-
$('p')
|
|
102
|
-
.text()
|
|
103
|
-
.trim(),
|
|
104
|
-
).toBe('Feedback content...');
|
|
92
|
+
expect($('p').text().trim()).toBe('Feedback content...');
|
|
105
93
|
});
|
|
106
94
|
|
|
107
95
|
it('has a link with the provided `url`', () => {
|
|
@@ -113,10 +101,6 @@ describe('macro: feedback', () => {
|
|
|
113
101
|
it('has a link with the provided `linkText`', () => {
|
|
114
102
|
const $ = cheerio.load(renderComponent('feedback', EXAMPLE_FEEDBACK_MINIMAL));
|
|
115
103
|
|
|
116
|
-
expect(
|
|
117
|
-
$('.ons-feedback__link')
|
|
118
|
-
.text()
|
|
119
|
-
.trim(),
|
|
120
|
-
).toBe('Feedback link text');
|
|
104
|
+
expect($('.ons-feedback__link').text().trim()).toBe('Feedback link text');
|
|
121
105
|
});
|
|
122
106
|
});
|
|
@@ -75,9 +75,7 @@ describe('macro: field', () => {
|
|
|
75
75
|
it('calls with content', () => {
|
|
76
76
|
const $ = cheerio.load(renderComponent('field', EXAMPLE_FIELD_BASIC, 'Example content...'));
|
|
77
77
|
|
|
78
|
-
const content = $('.ons-field')
|
|
79
|
-
.html()
|
|
80
|
-
.trim();
|
|
78
|
+
const content = $('.ons-field').html().trim();
|
|
81
79
|
expect(content).toEqual(expect.stringContaining('Example content...'));
|
|
82
80
|
});
|
|
83
81
|
|
|
@@ -42,9 +42,7 @@ describe('macro: fieldset', () => {
|
|
|
42
42
|
it('has the `description` text', () => {
|
|
43
43
|
const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC));
|
|
44
44
|
|
|
45
|
-
const title = $('.ons-fieldset__description')
|
|
46
|
-
.html()
|
|
47
|
-
.trim();
|
|
45
|
+
const title = $('.ons-fieldset__description').html().trim();
|
|
48
46
|
expect(title).toBe('A fieldset description');
|
|
49
47
|
});
|
|
50
48
|
|
|
@@ -122,9 +120,7 @@ describe('macro: fieldset', () => {
|
|
|
122
120
|
it('calls with content', () => {
|
|
123
121
|
const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC, 'Example content...'));
|
|
124
122
|
|
|
125
|
-
const content = $('.ons-fieldset')
|
|
126
|
-
.html()
|
|
127
|
-
.trim();
|
|
123
|
+
const content = $('.ons-fieldset').html().trim();
|
|
128
124
|
expect(content).toEqual(expect.stringContaining('Example content...'));
|
|
129
125
|
});
|
|
130
126
|
|
|
@@ -179,9 +175,7 @@ describe('macro: fieldset', () => {
|
|
|
179
175
|
}),
|
|
180
176
|
);
|
|
181
177
|
|
|
182
|
-
const title = $('.ons-fieldset__legend-title')
|
|
183
|
-
.html()
|
|
184
|
-
.trim();
|
|
178
|
+
const title = $('.ons-fieldset__legend-title').html().trim();
|
|
185
179
|
expect(title).toBe('Fieldset legend');
|
|
186
180
|
});
|
|
187
181
|
|
|
@@ -36,10 +36,9 @@
|
|
|
36
36
|
<div class="ons-footer__warning">
|
|
37
37
|
<div class="ons-container">
|
|
38
38
|
{% call onsPanel({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
%}
|
|
39
|
+
"variant": "warn",
|
|
40
|
+
"classes": "ons-panel--warn--footer"
|
|
41
|
+
}) %}
|
|
43
42
|
{{ params.footerWarning | safe }}
|
|
44
43
|
{% endcall %}
|
|
45
44
|
</div>
|
|
@@ -158,9 +157,11 @@
|
|
|
158
157
|
</div>
|
|
159
158
|
{% endif %}
|
|
160
159
|
{% if not params.poweredBy %}
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
160
|
+
<a class="ons-footer__poweredBy-link" {% if lang == "cy" %}href="https://cy.ons.gov.uk/"{% else %}href="https://www.ons.gov.uk/"{% endif %}>
|
|
161
|
+
<div class="ons-footer__poweredby-logo ons-u-mb-m">
|
|
162
|
+
{{ onsLogo | safe }}
|
|
163
|
+
</div>
|
|
164
|
+
</a>
|
|
164
165
|
{% endif %}
|
|
165
166
|
</div>
|
|
166
167
|
{% if params.crest %}
|
|
@@ -225,7 +225,7 @@ describe('macro: footer', () => {
|
|
|
225
225
|
|
|
226
226
|
expect(panelSpy.occurrences).toContainEqual(
|
|
227
227
|
expect.objectContaining({
|
|
228
|
-
|
|
228
|
+
variant: 'warn',
|
|
229
229
|
classes: 'ons-panel--warn--footer',
|
|
230
230
|
}),
|
|
231
231
|
);
|
|
@@ -278,7 +278,7 @@ describe('macro: footer', () => {
|
|
|
278
278
|
it('renders expected column titles', () => {
|
|
279
279
|
const $ = cheerio.load(renderComponent('footer', params));
|
|
280
280
|
|
|
281
|
-
const titleHeadings = mapAll($('.ons-footer__heading'), node => node.text().trim());
|
|
281
|
+
const titleHeadings = mapAll($('.ons-footer__heading'), (node) => node.text().trim());
|
|
282
282
|
expect(titleHeadings).toEqual(['First column', 'Second column']);
|
|
283
283
|
});
|
|
284
284
|
|
|
@@ -411,6 +411,18 @@ describe('macro: footer', () => {
|
|
|
411
411
|
});
|
|
412
412
|
});
|
|
413
413
|
});
|
|
414
|
+
describe('correct link for language', () => {
|
|
415
|
+
it('has the Welsh lang link when the default Welsh lang ons icon is present', () => {
|
|
416
|
+
const $ = cheerio.load(renderComponent('footer', { lang: 'cy' }));
|
|
417
|
+
|
|
418
|
+
expect($('.ons-footer__poweredBy-link').attr('href')).toBe('https://cy.ons.gov.uk/');
|
|
419
|
+
});
|
|
420
|
+
it('has the English lang link when the default English lang ons icon is present', () => {
|
|
421
|
+
const $ = cheerio.load(renderComponent('footer', { lang: 'en' }));
|
|
422
|
+
|
|
423
|
+
expect($('.ons-footer__poweredBy-link').attr('href')).toBe('https://www.ons.gov.uk/');
|
|
424
|
+
});
|
|
425
|
+
});
|
|
414
426
|
describe('provided poweredBy logo', () => {
|
|
415
427
|
describe.each([
|
|
416
428
|
[
|
|
@@ -275,7 +275,7 @@ describe('macro: header', () => {
|
|
|
275
275
|
|
|
276
276
|
faker.renderComponent('header', EXAMPLE_HEADER_BASIC);
|
|
277
277
|
|
|
278
|
-
expect(iconsSpy.occurrences[0].altText).toBe('Office for National Statistics
|
|
278
|
+
expect(iconsSpy.occurrences[0].altText).toBe('Office for National Statistics homepage');
|
|
279
279
|
});
|
|
280
280
|
|
|
281
281
|
it('has the default masthead mobile logo icon alt text', () => {
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{% macro patternLibExampleGrid(params) %}
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
{% if params.container -%}
|
|
3
|
+
<div class="ons-container">
|
|
4
|
+
{% endif -%}
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
{% if params.container -%}
|
|
6
|
+
<div class="ons-grid">
|
|
7
|
+
{% for item in (params.itemsList if params.itemsList is iterable else params.itemsList.items()) -%}
|
|
8
|
+
{% for i in range(0, item.repeat | default(1) ) -%}
|
|
9
|
+
<div class="ons-grid__col ons-col-{{ item.col }}@m {{ item.classes }}">
|
|
10
|
+
<div class="ons-pl-grid-col">{{ item.col }} col</div>
|
|
11
|
+
</div>
|
|
12
|
+
{%- endfor %}
|
|
13
|
+
{%- endfor %}
|
|
17
14
|
</div>
|
|
18
|
-
|
|
15
|
+
|
|
16
|
+
{% if params.container -%}
|
|
17
|
+
</div>
|
|
18
|
+
{% endif -%}
|
|
19
19
|
{% endmacro %}
|
|
@@ -17,6 +17,10 @@
|
|
|
17
17
|
<svg class="{% if params.iconSize %}ons-icon ons-icon--{{ params.iconSize }}{% else %}ons-icon{% endif %}{{ iconClasses }}" viewBox="0 0 17 13" xmlns="http://www.w3.org/2000/svg" focusable="false" fill="currentColor">
|
|
18
18
|
<path d="M6.4.2.3 6.4c-.2.2-.2.4 0 .6l6.2 5.8c.2.2.4.1.6 0l.8-.9c.2-.2.1-.4 0-.6l-4-3.7h12.5c.2 0 .4-.2.4-.4V6c0-.2-.2-.4-.4-.4H3.8l4-4c.2-.1.2-.4.1-.5L7 .2c-.1-.1-.4-.1-.6 0z"/>
|
|
19
19
|
</svg>
|
|
20
|
+
{%- elif params.iconType == "arrow-up" -%}
|
|
21
|
+
<svg class="{% if params.iconSize %}ons-icon ons-icon--{{ params.iconSize }}{% else %}ons-icon{% endif %}{{ iconClasses }}" viewBox="0 0 13 20" xmlns="http://www.w3.org/2000/svg" focusable="false" fill="currentColor">
|
|
22
|
+
<path fill="currentColor" d="M6.5 0L0 6.5 1.4 8l4-4v12.7h2V4l4.3 4L13 6.4z"></path>
|
|
23
|
+
</svg>
|
|
20
24
|
{%- elif params.iconType == "check" -%}
|
|
21
25
|
<svg class="{% if params.iconSize %}ons-icon ons-icon--{{ params.iconSize }}{% else %}ons-icon{% endif %}{{ iconClasses }}" viewBox="0 0 13 10" xmlns="http://www.w3.org/2000/svg" focusable="false" fill="currentColor">
|
|
22
26
|
<path d="M14.35,3.9l-.71-.71a.5.5,0,0,0-.71,0h0L5.79,10.34,3.07,7.61a.51.51,0,0,0-.71,0l-.71.71a.51.51,0,0,0,0,.71l3.78,3.78a.5.5,0,0,0,.71,0h0L14.35,4.6A.5.5,0,0,0,14.35,3.9Z" transform="translate(-1.51 -3.04)"/>
|
|
@@ -73,9 +77,9 @@
|
|
|
73
77
|
</svg>
|
|
74
78
|
{%- elif params.iconType == "twitter" -%}
|
|
75
79
|
<svg class="{% if params.iconSize %}ons-icon ons-icon--{{ params.iconSize }}{% else %}ons-icon{% endif %}{{ iconClasses }}" id="icon-twitter" viewBox="0 0 90.01 90.01" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true">
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
<polygon points="24.89,23.01 57.79,66.99 65.24,66.99 32.34,23.01"/>
|
|
81
|
+
<path d="M 45 0 L 45 0 C 20.147 0 0 20.147 0 45 v 0 c 0 24.853 20.147 45 45 45 h 0 c 24.853 0 45 -20.147 45 -45 v 0 C 90 20.147 69.853 0 45 0 z M 56.032 70.504 L 41.054 50.477 L 22.516 70.504 h -4.765 L 38.925 47.63 L 17.884 19.496 h 16.217 L 47.895 37.94 l 17.072 -18.444 h 4.765 L 50.024 40.788 l 22.225 29.716 H 56.032 z"/>
|
|
82
|
+
</svg>
|
|
79
83
|
{%- elif params.iconType == "instagram" -%}
|
|
80
84
|
<svg class="{% if params.iconSize %}ons-icon ons-icon--{{ params.iconSize }}{% else %}ons-icon{% endif %}{{ iconClasses }}" id="icon-instagram" viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true">
|
|
81
85
|
<path d="M21.34,9.46c0.66,0,1.2,0.54,1.2,1.2c0,0.66-0.54,1.2-1.2,1.2c-0.66,0-1.2-0.54-1.2-1.2C20.14,10,20.68,9.46,21.34,9.46z M16,12.67c-1.84,0-3.33,1.49-3.33,3.33c0,1.84,1.49,3.33,3.33,3.33c1.84,0,3.33-1.49,3.33-3.33C19.33,14.16,17.84,12.67,16,12.67z M16,10.86c2.84,0,5.14,2.3,5.14,5.14c0,2.84-2.3,5.14-5.14,5.14c-2.84,0-5.14-2.3-5.14-5.14C10.86,13.16,13.16,10.86,16,10.86z M16.56,7.8h-1.11c-2.17,0-2.51,0.01-3.49,0.06c-0.97,0.04-1.5,0.21-1.86,0.34C9.64,8.39,9.3,8.6,8.95,8.95C8.6,9.3,8.39,9.64,8.2,10.1c-0.14,0.35-0.3,0.88-0.34,1.86c-0.04,0.98-0.06,1.32-0.06,3.49v1.11c0,2.17,0.01,2.51,0.06,3.49c0.04,0.97,0.21,1.5,0.34,1.86c0.18,0.47,0.4,0.8,0.75,1.15c0.35,0.35,0.68,0.57,1.15,0.75c0.35,0.14,0.88,0.3,1.86,0.34c0.94,0.04,1.29,0.06,3.23,0.06h1.61c1.94,0,2.3-0.02,3.23-0.06c0.97-0.04,1.5-0.21,1.86-0.34c0.47-0.18,0.8-0.4,1.15-0.75c0.35-0.35,0.57-0.68,0.75-1.15c0.14-0.35,0.3-0.88,0.34-1.86c0.04-0.94,0.06-1.29,0.06-3.23v-1.61c0-1.94-0.02-2.3-0.06-3.23c-0.04-0.97-0.21-1.5-0.34-1.86c-0.18-0.47-0.4-0.8-0.75-1.15C22.7,8.6,22.36,8.39,21.9,8.2c-0.35-0.14-0.88-0.3-1.86-0.34C19.06,7.82,18.72,7.8,16.56,7.8z M17.03,6c1.8,0,2.18,0.02,3.1,0.06c1.06,0.05,1.79,0.22,2.43,0.46c0.66,0.26,1.22,0.6,1.77,1.15c0.56,0.56,0.9,1.11,1.15,1.77c0.25,0.64,0.42,1.36,0.46,2.43c0.05,0.99,0.06,1.35,0.06,3.58v1.09c0,2.22-0.01,2.59-0.06,3.58c-0.05,1.06-0.22,1.79-0.46,2.43c-0.26,0.66-0.6,1.22-1.15,1.77c-0.56,0.56-1.11,0.9-1.77,1.15c-0.64,0.25-1.36,0.42-2.43,0.46C19.13,25.99,18.77,26,16.55,26h-1.09c-2.22,0-2.59-0.01-3.58-0.06c-1.06-0.05-1.79-0.22-2.43-0.46c-0.66-0.26-1.22-0.6-1.77-1.15c-0.56-0.56-0.9-1.11-1.15-1.77c-0.25-0.64-0.42-1.36-0.46-2.43C6.02,19.21,6,18.83,6,17.03v-2.06c0-1.8,0.02-2.18,0.06-3.1c0.05-1.06,0.22-1.79,0.46-2.43c0.26-0.66,0.6-1.22,1.15-1.77c0.56-0.56,1.11-0.9,1.77-1.15c0.64-0.25,1.36-0.42,2.43-0.46C12.79,6.02,13.17,6,14.97,6H17.03z M16,0C7.16,0,0,7.16,0,16s7.16,16,16,16s16-7.16,16-16c0-4.24-1.69-8.31-4.69-11.31S20.24,0,16,0z"/>
|
|
@@ -126,8 +130,8 @@
|
|
|
126
130
|
</rect>
|
|
127
131
|
</svg>
|
|
128
132
|
{%- elif params.iconType == "ons-logo-en" -%}
|
|
129
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="197" height="19" viewBox="33 2 552 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-en-alt') }}">
|
|
130
|
-
<title id="{{ params.altTextId | default ('ons-logo-en-alt') }}">{{ params.altText | default ('Office for National Statistics
|
|
133
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="197" height="19" viewBox="33 2 552 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-en-alt') }}" role="img">
|
|
134
|
+
<title id="{{ params.altTextId | default ('ons-logo-en-alt') }}">{{ params.altText | default ('Office for National Statistics homepage') }}</title>
|
|
131
135
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
132
136
|
<path d="M0,34.6c.8-1.69,1.39-3,2.32-4.6A38.28,38.28,0,0,1,0,23.4V34.6M5,3S0,3,0,9.25v1A62.12,62.12,0,0,0,4.2,27a43.77,43.77,0,0,1,9.42-10.79C21.69,9.21,31.16,5.13,45.9,3Z"/>
|
|
133
137
|
</g>
|
|
@@ -165,8 +169,8 @@
|
|
|
165
169
|
</g>
|
|
166
170
|
</svg>
|
|
167
171
|
{%- elif params.iconType == "ons-logo-cy" -%}
|
|
168
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="207" height="19" viewBox="15 2 620 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-cy-alt') }}">
|
|
169
|
-
<title id="{{ params.altTextId | default ('ons-logo-cy-alt') }}">{{ params.altText | default ('
|
|
172
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="207" height="19" viewBox="15 2 620 60" aria-labelledby="{{ params.altTextId | default ('ons-logo-cy-alt') }}" role="img">
|
|
173
|
+
<title id="{{ params.altTextId | default ('ons-logo-cy-alt') }}">{{ params.altText | default ('Hafan Swyddfa Ystadegau Gwladol') }}</title>
|
|
170
174
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
171
175
|
<path d="M0,34.6c.8-1.69,1.39-3,2.32-4.6A38.28,38.28,0,0,1,0,23.4V34.6M5,3S0,3,0,9.25v1A62.12,62.12,0,0,0,4.2,27a43.77,43.77,0,0,1,9.42-10.79C21.69,9.21,31.16,5.13,45.9,3Z"/>
|
|
172
176
|
</g>
|
|
@@ -200,8 +204,8 @@
|
|
|
200
204
|
</g>
|
|
201
205
|
</svg>
|
|
202
206
|
{%- elif params.iconType == "ons-logo-stacked-en" -%}
|
|
203
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="120" height="27" viewBox="0 5 595 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">
|
|
204
|
-
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('Office for National Statistics
|
|
207
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="120" height="27" viewBox="0 5 595 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}" role="img">
|
|
208
|
+
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('Office for National Statistics homepage') }}</title>
|
|
205
209
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
206
210
|
<path d="M0,70.5c1.8-3.7,3.6-7.2,5.6-10.7A127.94,127.94,0,0,1,0,42.6V70.5M10.9,0S0,0,0,13.5v7.2A128.06,128.06,0,0,0,7.9,56.2a114.75,114.75,0,0,1,22.3-26C47.8,15.1,71.5,4.7,103.7.1Z"/>
|
|
207
211
|
</g>
|
|
@@ -213,8 +217,8 @@
|
|
|
213
217
|
</g>
|
|
214
218
|
</svg>
|
|
215
219
|
{%- elif params.iconType == "ons-logo-stacked-cy" -%}
|
|
216
|
-
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="130" height="27" viewBox="0 5 645 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-cy-alt') }}">
|
|
217
|
-
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('
|
|
220
|
+
<svg class="ons-icon--logo{{ iconClasses }}" xmlns="http://www.w3.org/2000/svg" width="130" height="27" viewBox="0 5 645 116" aria-labelledby="{{ params.altTextId | default ('ons-logo-stacked-cy-alt') }}" role="img">
|
|
221
|
+
<title id="{{ params.altTextId | default ('ons-logo-stacked-en-alt') }}">{{ params.altText | default ('Hafan Swyddfa Ystadegau Gwladol') }}</title>
|
|
218
222
|
<g class="ons-icon--logo__group ons-icon--logo__group--secondary" fill="#a8bd3a">
|
|
219
223
|
<path d="M0,70.5c1.8-3.7,3.6-7.2,5.6-10.7A127.94,127.94,0,0,1,0,42.6V70.5M10.9,0S0,0,0,13.5v7.2A128.06,128.06,0,0,0,7.9,56.2a114.75,114.75,0,0,1,22.3-26C47.8,15.1,71.5,4.7,103.7.1Z"/>
|
|
220
224
|
</g>
|
|
@@ -33,7 +33,7 @@ describe('macro: icon', () => {
|
|
|
33
33
|
'crest',
|
|
34
34
|
'ogl',
|
|
35
35
|
'circle-lined',
|
|
36
|
-
])('icon type: %s', iconType => {
|
|
36
|
+
])('icon type: %s', (iconType) => {
|
|
37
37
|
it('passes jest-axe checks', async () => {
|
|
38
38
|
const $ = cheerio.load(renderComponent('icon', { iconType }));
|
|
39
39
|
|
|
@@ -77,7 +77,7 @@ describe('macro: icon', () => {
|
|
|
77
77
|
'twitter',
|
|
78
78
|
'instagram',
|
|
79
79
|
'linkedin',
|
|
80
|
-
])('icon type: %s', iconType => {
|
|
80
|
+
])('icon type: %s', (iconType) => {
|
|
81
81
|
it('has style variation class for provided icon size', () => {
|
|
82
82
|
const $ = cheerio.load(
|
|
83
83
|
renderComponent('icon', {
|
|
@@ -91,21 +91,17 @@ describe('macro: icon', () => {
|
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
describe.each([
|
|
94
|
-
['ons-logo-en', 'Office for National Statistics
|
|
95
|
-
['ons-logo-cy', '
|
|
96
|
-
['ons-logo-stacked-en', 'Office for National Statistics
|
|
97
|
-
['ons-logo-stacked-cy', '
|
|
94
|
+
['ons-logo-en', 'Office for National Statistics homepage'],
|
|
95
|
+
['ons-logo-cy', 'Hafan Swyddfa Ystadegau Gwladol'],
|
|
96
|
+
['ons-logo-stacked-en', 'Office for National Statistics homepage'],
|
|
97
|
+
['ons-logo-stacked-cy', 'Hafan Swyddfa Ystadegau Gwladol'],
|
|
98
98
|
['crest', 'Royal coat of arms of the United Kingdom'],
|
|
99
99
|
['ogl', 'Open Government License logo'],
|
|
100
100
|
])('icon type: %s', (iconType, expectedAltText) => {
|
|
101
101
|
it(`has default alt text '${expectedAltText}'`, () => {
|
|
102
102
|
const $ = cheerio.load(renderComponent('icon', { iconType }));
|
|
103
103
|
|
|
104
|
-
expect(
|
|
105
|
-
$('title')
|
|
106
|
-
.text()
|
|
107
|
-
.trim(),
|
|
108
|
-
).toBe(expectedAltText);
|
|
104
|
+
expect($('title').text().trim()).toBe(expectedAltText);
|
|
109
105
|
});
|
|
110
106
|
|
|
111
107
|
it('has provided alt text', () => {
|
|
@@ -116,11 +112,7 @@ describe('macro: icon', () => {
|
|
|
116
112
|
}),
|
|
117
113
|
);
|
|
118
114
|
|
|
119
|
-
expect(
|
|
120
|
-
$('title')
|
|
121
|
-
.text()
|
|
122
|
-
.trim(),
|
|
123
|
-
).toBe('Example alt text');
|
|
115
|
+
expect($('title').text().trim()).toBe('Example alt text');
|
|
124
116
|
});
|
|
125
117
|
});
|
|
126
118
|
});
|
|
@@ -42,11 +42,7 @@ describe('macro: image', () => {
|
|
|
42
42
|
}),
|
|
43
43
|
);
|
|
44
44
|
|
|
45
|
-
expect(
|
|
46
|
-
$('.ons-image__caption')
|
|
47
|
-
.text()
|
|
48
|
-
.trim(),
|
|
49
|
-
).toBe('Example image caption');
|
|
45
|
+
expect($('.ons-image__caption').text().trim()).toBe('Example image caption');
|
|
50
46
|
});
|
|
51
47
|
|
|
52
48
|
describe('mode: url', () => {
|