@ons/design-system 70.0.16 → 72.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 +10 -1
- package/components/access-code/_macro.njk +4 -4
- package/components/access-code/_macro.spec.js +10 -10
- package/components/access-code/example-access-code-error.njk +2 -2
- package/components/access-code/example-access-code.njk +2 -2
- package/components/accordion/_macro.njk +1 -1
- package/components/accordion/_macro.spec.js +162 -91
- package/components/accordion/_test_examples.js +13 -0
- package/components/address-input/_macro.njk +7 -7
- package/components/address-input/_macro.spec.js +16 -15
- package/components/address-input/autosuggest.address.error.js +1 -1
- package/components/address-input/autosuggest.address.js +25 -25
- package/components/address-input/autosuggest.address.spec.js +6 -5
- package/components/address-input/example-address-input-editable.njk +5 -4
- package/components/address-input/example-address-input.njk +4 -5
- package/components/autosuggest/_autosuggest.scss +8 -8
- package/components/autosuggest/_macro.njk +5 -5
- package/components/autosuggest/autosuggest.spec.js +1 -1
- package/components/back-to-top/_back-to-top.scss +2 -2
- package/components/back-to-top/_macro.spec.js +1 -1
- package/components/back-to-top/example-full-page-back-to-top.njk +6 -6
- package/components/breadcrumbs/_breadcrumbs.scss +1 -1
- package/components/breadcrumbs/_macro.spec.js +121 -115
- package/components/breadcrumbs/_test_examples.js +36 -0
- package/components/browser-banner/_macro.spec.js +1 -1
- package/components/button/_button.scss +24 -16
- package/components/button/_macro.njk +5 -5
- package/components/button/_macro.spec.js +2 -2
- package/components/button/example-button-custom.njk +1 -1
- package/components/card/_card.scss +0 -6
- package/components/card/_macro.njk +9 -9
- package/components/card/_macro.spec.js +57 -24
- package/components/card/example-card-set-with-images.njk +30 -18
- package/components/card/example-card-set-with-lists.njk +57 -45
- package/components/card/example-card-set.njk +27 -15
- package/components/card/example-card.njk +9 -5
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +4 -4
- package/components/checkboxes/_checkboxes.scss +1 -1
- package/components/checkboxes/example-checkboxes-with-hidden-label.njk +4 -4
- package/components/cookies-banner/_cookies-banner.scss +5 -5
- package/components/cookies-banner/_macro.njk +15 -13
- package/components/cookies-banner/_macro.spec.js +1 -1
- package/components/details/_details.scss +5 -6
- package/components/details/_macro.njk +4 -4
- package/components/details/_macro.spec.js +1 -1
- package/components/document-list/_document-list.scss +0 -2
- package/components/document-list/_macro.njk +18 -18
- package/components/document-list/_macro.spec.js +16 -14
- package/components/document-list/example-document-list-article-featured.njk +5 -3
- package/components/document-list/example-document-list-articles.njk +15 -9
- package/components/document-list/example-document-list-downloads.njk +15 -9
- package/components/document-list/example-document-list-search-result-featured.njk +5 -3
- package/components/document-list/example-document-list-search-results.njk +20 -12
- package/components/download-resources/_download-resources.scss +1 -2
- package/components/download-resources/download-resources.spec.js +12 -6
- package/components/external-link/_macro.njk +1 -1
- package/components/external-link/_macro.spec.js +1 -1
- package/components/external-link/example-external-link.njk +1 -1
- package/components/feedback/_macro.njk +1 -1
- package/components/feedback/_macro.spec.js +3 -3
- package/components/feedback/example-feedback-call-to-action.njk +1 -1
- package/components/field/_field-group.scss +0 -2
- package/components/field/_field.scss +1 -2
- package/components/fieldset/_fieldset.scss +2 -2
- package/components/fieldset/_macro.njk +1 -1
- package/components/fieldset/_macro.spec.js +1 -1
- package/components/footer/_footer.scss +12 -7
- package/components/footer/_macro.njk +54 -34
- package/components/footer/_macro.spec.js +90 -28
- package/components/footer/example-footer-cymraeg.njk +1 -1
- package/components/footer/example-footer-transactional.njk +1 -1
- package/components/footer/example-footer-warning.njk +1 -1
- package/components/footer/example-footer-with-alternative-organisation.njk +99 -94
- package/components/footer/example-footer-with-coat-of-arms.njk +1 -1
- package/components/footer/example-footer-with-copyright.njk +1 -1
- package/components/footer/example-footer-with-multiple-logos-and-split-display.njk +173 -0
- package/components/footer/example-footer-with-multiple-logos.njk +172 -0
- package/components/footer/example-footer.njk +1 -1
- package/components/header/_header.scss +7 -14
- package/components/header/_macro.njk +19 -19
- package/components/header/_macro.spec.js +18 -18
- package/components/header/example-header-external-for-surveys.njk +2 -2
- package/components/header/example-header-external-welsh.njk +2 -2
- package/components/header/example-header-external-with-sub-navigation-removed.njk +1 -1
- package/components/header/example-header-external-with-sub-navigation.njk +1 -1
- package/components/header/example-header-multiple-logos.njk +4 -4
- package/components/hero/_hero.scss +6 -8
- package/components/hero/_macro.njk +1 -1
- package/components/icon/_icon.scss +4 -4
- package/components/icon/_macro.njk +4 -4
- package/components/icon/_macro.spec.js +2 -2
- package/components/image/_image.scss +1 -1
- package/components/image/_macro.njk +1 -1
- package/components/image/_macro.spec.js +10 -10
- package/components/image/example-image-for-regular-screens.njk +1 -1
- package/components/input/_input-type.scss +0 -2
- package/components/input/_input.scss +10 -10
- package/components/input/_macro.njk +4 -2
- package/components/input/example-input-search-with-character-check.njk +1 -1
- package/components/input/example-input-search.njk +1 -1
- package/components/label/_label.scss +1 -3
- package/components/language-selector/_macro.njk +3 -3
- package/components/language-selector/_macro.spec.js +7 -7
- package/components/list/_list.scss +1 -5
- package/components/list/_macro.njk +9 -10
- package/components/list/_macro.spec.js +50 -9
- package/components/list/example-inline-list-with-social-icon-prefix.njk +1 -1
- package/components/message/_macro.njk +3 -3
- package/components/message/_macro.spec.js +3 -3
- package/components/message-list/_macro.njk +2 -2
- package/components/message-list/_macro.spec.js +8 -4
- package/components/message-list/_message-list.scss +2 -2
- package/components/navigation/_macro.njk +9 -9
- package/components/navigation/_macro.spec.js +2 -2
- package/components/navigation/_navigation.scss +2 -6
- package/components/navigation/navigation.dom.js +1 -1
- package/components/navigation/navigation.spec.js +4 -4
- package/components/pagination/_macro.njk +2 -2
- package/components/pagination/_pagination.scss +1 -7
- package/components/panel/_macro.njk +5 -4
- package/components/panel/_macro.spec.js +2 -2
- package/components/panel/_panel.scss +12 -8
- package/components/password/_macro.njk +1 -1
- package/components/password/_macro.spec.js +2 -2
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_phase-banner.scss +3 -4
- package/components/phase-banner/example-phase-banner-alpha.njk +1 -1
- package/components/phase-banner/example-phase-banner-beta.njk +1 -1
- package/components/question/_macro.njk +8 -8
- package/components/question/_macro.spec.js +3 -3
- package/components/question/_question.scss +3 -3
- package/components/radios/_macro.njk +1 -1
- package/components/radios/_macro.spec.js +1 -1
- package/components/radios/_radios.scss +1 -1
- package/components/radios/example-radios-with-clear-button-expanded.njk +1 -1
- package/components/radios/example-radios-with-clear-button.njk +1 -1
- package/components/related-content/_macro.spec.js +2 -2
- package/components/related-content/_related-content.scss +1 -1
- package/components/related-content/example-related-content-general.njk +2 -2
- package/components/related-content/example-related-content-social-media.njk +1 -1
- package/components/reply/_macro.njk +3 -1
- package/components/reply/_macro.spec.js +1 -1
- package/components/reply/reply.spec.js +1 -1
- package/components/section-navigation/_macro.njk +10 -10
- package/components/section-navigation/_macro.spec.js +15 -15
- package/components/section-navigation/_section-navigation.scss +3 -8
- package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +3 -3
- package/components/section-navigation/example-section-navigation-vertical.njk +14 -14
- package/components/section-navigation/example-section-navigation.njk +3 -3
- package/components/select/example-select-with-inline-label.njk +1 -1
- package/components/share-page/_macro.njk +7 -7
- package/components/share-page/_macro.spec.js +2 -2
- package/components/share-page/example-share-page.njk +1 -1
- package/components/status/_status.scss +1 -1
- package/components/summary/_macro.njk +33 -33
- package/components/summary/_macro.spec.js +34 -34
- package/components/summary/_summary.scss +2 -4
- package/components/summary/example-summary-card-grouped.njk +34 -34
- package/components/summary/example-summary-grouped-total.njk +7 -7
- package/components/summary/example-summary-grouped-with-errors.njk +9 -9
- package/components/summary/example-summary-grouped.njk +34 -34
- package/components/summary/example-summary-household.njk +7 -7
- package/components/summary/example-summary-hub-minimal.njk +8 -8
- package/components/summary/example-summary-hub.njk +16 -16
- package/components/summary/example-summary-multiple.njk +7 -7
- package/components/summary/example-summary-no-action.njk +5 -5
- package/components/summary/example-summary.njk +9 -9
- package/components/table/_table.scss +2 -3
- package/components/table-of-contents/_macro.njk +3 -3
- package/components/table-of-contents/_macro.spec.js +3 -3
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
- package/components/tabs/_macro.njk +3 -3
- package/components/tabs/_macro.spec.js +3 -3
- package/components/tabs/_tabs.scss +3 -4
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/text-indent/_text-indent.scss +1 -1
- package/components/text-indent/example-text-indent.njk +1 -1
- package/components/timeline/_macro.njk +4 -4
- package/components/timeline/_macro.spec.js +3 -3
- package/components/timeline/_timeline.scss +4 -3
- package/components/timeline/example-timeline.njk +1 -1
- package/components/upload/_upload.scss +2 -2
- package/components/video/_macro.njk +4 -4
- package/components/video/_macro.spec.js +2 -2
- package/components/video/_video.scss +1 -1
- package/components/video/example-video.njk +2 -2
- package/components/video/video.spec.js +2 -2
- package/css/main.css +1 -1
- package/layout/_dsTemplate.njk +1 -1
- package/layout/_template.njk +31 -31
- package/package.json +3 -2
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +2 -0
- package/scss/base/_typography.scss +0 -2
- package/scss/main.scss +0 -1
- package/scss/objects/_container.scss +1 -1
- package/scss/objects/_page.scss +2 -3
- package/scss/overrides/rtl.scss +1 -1
- package/scss/utilities/_grid.scss +103 -96
- package/scss/utilities/_margin.scss +11 -5
- package/scss/utilities/_padding.scss +12 -5
- package/scss/utilities/_typography.scss +2 -1
- package/scss/vars/_forms.scss +8 -10
- package/scss/vars/_grid.scss +4 -4
- package/scss/vars/_typography.scss +26 -19
- package/components/call-to-action/_call-to-action.scss +0 -8
- package/components/call-to-action/_macro.njk +0 -24
- package/components/call-to-action/_macro.spec.js +0 -48
- package/components/call-to-action/example-call-to-action-default.njk +0 -15
- package/components/metadata/_macro.njk +0 -14
|
@@ -57,10 +57,10 @@ export default class AutosuggestAddress {
|
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
// Set up AIMS api variables and auth
|
|
60
|
-
this.
|
|
61
|
-
this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
60
|
+
this.apiDomain = this.container.getAttribute('data-api-domain');
|
|
61
|
+
this.lookupUrl = `${this.apiDomain}/addresses/eq?input=`;
|
|
62
|
+
this.lookupGroupUrl = `${this.apiDomain}/addresses/eq/bucket?`;
|
|
63
|
+
this.retrieveUrl = `${this.apiDomain}/addresses/eq/uprn/`;
|
|
64
64
|
|
|
65
65
|
// Query string options
|
|
66
66
|
this.manualQueryParams = this.container.getAttribute('data-query-params');
|
|
@@ -77,7 +77,7 @@ export default class AutosuggestAddress {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
async checkAPIStatus() {
|
|
80
|
-
this.fetch = abortableFetch(this.
|
|
80
|
+
this.fetch = abortableFetch(this.lookupUrl + 'cf142&limit=10', {
|
|
81
81
|
method: 'GET',
|
|
82
82
|
headers: this.setAuthorization(this.authorizationToken),
|
|
83
83
|
});
|
|
@@ -109,24 +109,24 @@ export default class AutosuggestAddress {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
async findAddress(text, grouped) {
|
|
112
|
-
let
|
|
112
|
+
let queryUrl, fullQueryUrl;
|
|
113
113
|
|
|
114
114
|
if (this.manualQueryParams) {
|
|
115
115
|
const manualQueryParams = this.container.getAttribute('data-query-params');
|
|
116
|
-
|
|
116
|
+
fullQueryUrl = this.lookupUrl + text + manualQueryParams;
|
|
117
117
|
} else {
|
|
118
118
|
const fullPostcodeQuery = this.testFullPostcodeQuery(text);
|
|
119
119
|
let limit = fullPostcodeQuery ? 100 : 10;
|
|
120
120
|
|
|
121
|
-
|
|
121
|
+
queryUrl = grouped ? this.lookupGroupUrl + this.groupQuery : this.lookupUrl + text + '&limit=' + limit;
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
fullQueryUrl = this.generateUrlParams(queryUrl);
|
|
124
124
|
if (fullPostcodeQuery && grouped !== false) {
|
|
125
|
-
|
|
125
|
+
fullQueryUrl = fullQueryUrl + '&groupfullpostcodes=combo';
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
this.fetch = abortableFetch(
|
|
129
|
+
this.fetch = abortableFetch(fullQueryUrl, {
|
|
130
130
|
method: 'GET',
|
|
131
131
|
headers: this.setAuthorization(this.authorizationToken),
|
|
132
132
|
});
|
|
@@ -248,11 +248,11 @@ export default class AutosuggestAddress {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
async retrieveAddress(id, type = null) {
|
|
251
|
-
let retrieveUrl = this.
|
|
251
|
+
let retrieveUrl = this.retrieveUrl + id;
|
|
252
252
|
|
|
253
|
-
const
|
|
253
|
+
const fullUprnUrl = this.generateUrlParams(retrieveUrl, id, type);
|
|
254
254
|
|
|
255
|
-
this.fetch = abortableFetch(
|
|
255
|
+
this.fetch = abortableFetch(fullUprnUrl, {
|
|
256
256
|
method: 'GET',
|
|
257
257
|
headers: this.setAuthorization(this.authorizationToken),
|
|
258
258
|
});
|
|
@@ -315,8 +315,8 @@ export default class AutosuggestAddress {
|
|
|
315
315
|
};
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
|
|
319
|
-
let
|
|
318
|
+
generateUrlParams(baseUrl, uprn, type) {
|
|
319
|
+
let fullUrl = baseUrl,
|
|
320
320
|
addressType;
|
|
321
321
|
|
|
322
322
|
const classificationFilterParam = '&classificationfilter=',
|
|
@@ -336,37 +336,37 @@ export default class AutosuggestAddress {
|
|
|
336
336
|
|
|
337
337
|
if (!uprn) {
|
|
338
338
|
if (this.classificationFilter && this.classificationFilter !== 'residential') {
|
|
339
|
-
|
|
339
|
+
fullUrl = fullUrl + classificationFilterParam + this.classificationFilter;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
342
|
if (this.classificationFilter === 'workplace') {
|
|
343
343
|
if (this.regionCode === 'gb-eng') {
|
|
344
|
-
|
|
344
|
+
fullUrl = fullUrl + eboostParam;
|
|
345
345
|
} else if (this.regionCode === 'gb-wls') {
|
|
346
|
-
|
|
346
|
+
fullUrl = fullUrl + wboostParam;
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
if (this.regionCode === 'gb-nir') {
|
|
351
351
|
if (this.classificationFilter === 'educational') {
|
|
352
|
-
|
|
352
|
+
fullUrl = fullUrl + nionlyParam;
|
|
353
353
|
} else {
|
|
354
|
-
|
|
354
|
+
fullUrl = fullUrl + niboostParam;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
if (this.lang === 'cy') {
|
|
359
|
-
|
|
359
|
+
fullUrl = fullUrl + favourwelshParam;
|
|
360
360
|
}
|
|
361
361
|
} else if (uprn) {
|
|
362
|
-
|
|
362
|
+
fullUrl = baseUrl + addresstypeParam + addressType;
|
|
363
363
|
}
|
|
364
364
|
|
|
365
365
|
if (this.epoch === 'true') {
|
|
366
|
-
|
|
366
|
+
fullUrl = fullUrl + epochParam;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
-
return
|
|
369
|
+
return fullUrl;
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
handleAPIError() {
|
|
@@ -30,8 +30,8 @@ const EXAMPLE_ADDRESS_INPUT = {
|
|
|
30
30
|
errorTitle: 'There is a problem with your answer',
|
|
31
31
|
errorMessageEnter: 'Enter an address',
|
|
32
32
|
errorMessageSelect: 'Select an address',
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
errorMessageApi: 'Sorry, there is a problem loading addresses',
|
|
34
|
+
errorMessageApiLinkText: 'Enter address manually',
|
|
35
35
|
options: {
|
|
36
36
|
regionCode: 'gb-eng',
|
|
37
37
|
addressType: 'residential',
|
|
@@ -52,20 +52,21 @@ const EXAMPLE_ADDRESS_INPUT = {
|
|
|
52
52
|
label: 'Postcode',
|
|
53
53
|
},
|
|
54
54
|
searchButton: 'Search for an address',
|
|
55
|
+
manualLinkUrl: '#0',
|
|
55
56
|
manualLinkText: 'Manually enter address',
|
|
56
57
|
};
|
|
57
58
|
|
|
58
59
|
const EXAMPLE_ADDRESS_INPUT_WITH_API = {
|
|
59
60
|
...EXAMPLE_ADDRESS_INPUT,
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
apiDomain: '/fake/api',
|
|
62
|
+
apiDomainBearerToken: 'someToken',
|
|
62
63
|
externalInitialiser: true,
|
|
63
64
|
};
|
|
64
65
|
|
|
65
66
|
const { setTimeout } = require('node:timers/promises');
|
|
66
67
|
|
|
67
68
|
describe('script: address-input', () => {
|
|
68
|
-
const apiFaker = new PuppeteerEndpointFaker(EXAMPLE_ADDRESS_INPUT_WITH_API.
|
|
69
|
+
const apiFaker = new PuppeteerEndpointFaker(EXAMPLE_ADDRESS_INPUT_WITH_API.apiDomain);
|
|
69
70
|
|
|
70
71
|
apiFaker.setOverrides(
|
|
71
72
|
[
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
},
|
|
11
11
|
"isEditable": true,
|
|
12
12
|
"mandatory": true,
|
|
13
|
-
"
|
|
14
|
-
'
|
|
13
|
+
"apiDomain": "https://mock-address-api.gcp.onsdigital.uk",
|
|
14
|
+
'apiDomainBearerToken': "some_token",
|
|
15
15
|
"instructions": "Use up and down keys to navigate suggestions once you\'ve typed more than two characters. Use the enter key to select a suggestion. Touch device users, explore by touch or with swipe gestures.",
|
|
16
16
|
"ariaYouHaveSelected": "You have selected",
|
|
17
17
|
"ariaMinChars": "Enter 3 or more characters for suggestions.",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"errorTitle": "There is a problem with your answer",
|
|
31
31
|
"errorMessageEnter": "Enter an address",
|
|
32
32
|
"errorMessageSelect": "Select an address",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"errorMessageApi": "Sorry, there is a problem loading addresses.",
|
|
34
|
+
"errorMessageApiLinkText": "Enter address manually",
|
|
35
35
|
"options": {
|
|
36
36
|
"regionCode": "gb-eng",
|
|
37
37
|
"addressType": "residential"
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"label": "Postcode"
|
|
50
50
|
},
|
|
51
51
|
"searchButton": "Search for an address",
|
|
52
|
+
"manualLinkUrl": "#0",
|
|
52
53
|
"manualLinkText": "Manually enter address"
|
|
53
54
|
})
|
|
54
55
|
}}
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"mandatory": true,
|
|
13
13
|
"externalInitialiser": true,
|
|
14
14
|
"autocomplete": "off",
|
|
15
|
-
"
|
|
16
|
-
'
|
|
15
|
+
"apiDomain": "https://mock-address-api.gcp.onsdigital.uk",
|
|
16
|
+
'apiDomainBearerToken': "some_token",
|
|
17
17
|
"instructions": "Use up and down keys to navigate suggestions once you\'ve typed more than two characters. Use the enter key to select a suggestion. Touch device users, explore by touch or with swipe gestures.",
|
|
18
18
|
"ariaYouHaveSelected": "You have selected",
|
|
19
19
|
"ariaMinChars": "Enter 3 or more characters for suggestions.",
|
|
@@ -31,9 +31,8 @@
|
|
|
31
31
|
"errorTitle": "There is a problem with your answer",
|
|
32
32
|
"errorMessageEnter": "Enter an address",
|
|
33
33
|
"errorMessageSelect": "Select an address",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"errorMessageAPILink": "#0",
|
|
34
|
+
"errorMessageApi": "Sorry, there is a problem. We are working to fix it. Please try again later or",
|
|
35
|
+
"errorMessageApiLinkText": "contact us for more help",
|
|
37
36
|
"options": {
|
|
38
37
|
"regionCode": "gb-eng",
|
|
39
38
|
"addressType": "residential"
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
border-radius: $input-radius;
|
|
6
6
|
display: inline-block;
|
|
7
7
|
|
|
8
|
-
@include mq(
|
|
8
|
+
@include mq('2xs', s) {
|
|
9
9
|
width: 100%;
|
|
10
10
|
}
|
|
11
11
|
}
|
|
@@ -94,19 +94,19 @@
|
|
|
94
94
|
&__panel.ons-panel--warn {
|
|
95
95
|
background: none;
|
|
96
96
|
border: 0;
|
|
97
|
-
margin: 0;
|
|
97
|
+
margin: 0 !important;
|
|
98
98
|
.ons-panel__icon {
|
|
99
|
-
font-size:
|
|
100
|
-
line-height:
|
|
99
|
+
font-size: 1.3rem;
|
|
100
|
+
line-height: 1.5rem;
|
|
101
101
|
margin-top: 0;
|
|
102
|
-
min-height:
|
|
103
|
-
min-width:
|
|
104
|
-
top:
|
|
102
|
+
min-height: 1.5rem;
|
|
103
|
+
min-width: 1.5rem;
|
|
104
|
+
top: 1rem;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
.ons-panel__body {
|
|
108
108
|
font-weight: $font-weight-bold;
|
|
109
|
-
padding: 0.
|
|
109
|
+
padding: 0.75rem 0.75rem 0.75rem 2rem;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
data-results-title="{{ params.resultsTitle }}"
|
|
16
16
|
data-no-results="{{ params.noResults }}"
|
|
17
17
|
data-type-more="{{ params.typeMore }}"
|
|
18
|
-
{% if params.
|
|
19
|
-
{% if params.
|
|
20
|
-
{% if params.
|
|
18
|
+
{% if params.apiDomain %}data-api-domain="{{ params.apiDomain }}"{% endif %}
|
|
19
|
+
{% if params.apiDomainBearerToken %}data-authorization-token="{{ params.apiDomainBearerToken }}"{% endif %}
|
|
20
|
+
{% if params.apiManualQueryParams == true %}data-query-params=""{% endif %}
|
|
21
21
|
{% if params.allowMultiple == true %}data-allow-multiple="true"{% endif %}
|
|
22
22
|
{% if params.autosuggestData %}data-autosuggest-data="{{ params.autosuggestData }}"{% endif %}
|
|
23
23
|
{% if params.errorTitle %}data-error-title="{{ params.errorTitle }}"{% endif %}
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
{% if params.ariaGroupedResults %}data-aria-grouped-results="{{ params.ariaGroupedResults }}"{% endif %}
|
|
27
27
|
{% if params.groupCount %}data-group-count="{{ params.groupCount }}"{% endif %}
|
|
28
28
|
{% if params.tooManyResults %}data-too-many-results="{{ params.tooManyResults }}"{% endif %}
|
|
29
|
-
{% if params.
|
|
30
|
-
{% if params.
|
|
29
|
+
{% if params.errorMessageApi %}data-error-api="{{ params.errorMessageApi }}"{% endif %}
|
|
30
|
+
{% if params.errorMessageApiLinkText %}data-error-api-link-text="{{ params.errorMessageApiLinkText }}"{% endif %}
|
|
31
31
|
{% if params.language %}data-lang="{{ params.language }}"{% endif %}
|
|
32
32
|
{% if params.options %}
|
|
33
33
|
{% if params.options.oneYearAgo %}data-options-one-year-ago="true"{% endif %}
|
|
@@ -597,7 +597,7 @@ describe('script: autosuggest', () => {
|
|
|
597
597
|
...EXAMPLE_AUTOSUGGEST,
|
|
598
598
|
errorTitle: 'There is a problem with your answer',
|
|
599
599
|
errorMessage: 'Enter an address ',
|
|
600
|
-
|
|
600
|
+
errorMessageApi: 'Sorry, there is a problem.',
|
|
601
601
|
}),
|
|
602
602
|
);
|
|
603
603
|
|
|
@@ -5,7 +5,7 @@ import * as cheerio from 'cheerio';
|
|
|
5
5
|
import axe from '../../tests/helpers/axe';
|
|
6
6
|
import { renderComponent } from '../../tests/helpers/rendering';
|
|
7
7
|
|
|
8
|
-
describe('FOR: Back-to-top', () => {
|
|
8
|
+
describe('FOR: Macro: Back-to-top', () => {
|
|
9
9
|
describe('GIVEN: Params: default', () => {
|
|
10
10
|
describe('WHEN: params are at default', () => {
|
|
11
11
|
const $ = cheerio.load(renderComponent('back-to-top'));
|
|
@@ -31,15 +31,15 @@ layout: ~
|
|
|
31
31
|
%}
|
|
32
32
|
|
|
33
33
|
{% block main %}
|
|
34
|
-
<h1 class="ons-u-fs-
|
|
35
|
-
<span class="ons-u-fs-m ons-u-db ons-u-mb-
|
|
34
|
+
<h1 class="ons-u-fs-2xl">
|
|
35
|
+
<span class="ons-u-fs-m ons-u-db ons-u-mb-2xs ons-u-lighter">Press releases</span>
|
|
36
36
|
<span class="ons-u-vh">: </span>
|
|
37
|
-
<span class="ons-u-fs-
|
|
37
|
+
<span class="ons-u-fs-2xl ons-u-db">ONS launches Integrated Data Service to boost government collaboration on data sharing</span>
|
|
38
38
|
</h1>
|
|
39
39
|
|
|
40
40
|
<div class="ons-grid">
|
|
41
41
|
<div class="ons-grid__col ons-col-7@m">
|
|
42
|
-
<div class="ons-page__body ons-u-mt-
|
|
42
|
+
<div class="ons-page__body ons-u-mt-l">
|
|
43
43
|
<p>
|
|
44
44
|
In a groundbreaking move, the Office for National Statistics (ONS) has embarked on a transformative journey with the
|
|
45
45
|
introduction of the Integrated Data Service (IDS). This sophisticated, cloud-based platform is meticulously crafted to
|
|
@@ -106,7 +106,7 @@ layout: ~
|
|
|
106
106
|
appropriately and making sure it is put to use for the public good."
|
|
107
107
|
</p>
|
|
108
108
|
|
|
109
|
-
<div class="ons-u-mt-
|
|
109
|
+
<div class="ons-u-mt-xl ons-u-mt-3xl@m">
|
|
110
110
|
{{
|
|
111
111
|
onsContentPagination({
|
|
112
112
|
"ariaLabel": 'Article pagination',
|
|
@@ -179,7 +179,7 @@ layout: ~
|
|
|
179
179
|
"id": 'share-this-article',
|
|
180
180
|
"title": 'Share this article',
|
|
181
181
|
"iconPosition": 'before',
|
|
182
|
-
"iconSize": '
|
|
182
|
+
"iconSize": '2xl',
|
|
183
183
|
"itemsList": [
|
|
184
184
|
{
|
|
185
185
|
"url": '#0',
|
|
@@ -5,125 +5,131 @@ import * as cheerio from 'cheerio';
|
|
|
5
5
|
import axe from '../../tests/helpers/axe';
|
|
6
6
|
import { mapAll } from '../../tests/helpers/cheerio';
|
|
7
7
|
import { renderComponent, templateFaker } from '../../tests/helpers/rendering';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
itemsList: [
|
|
27
|
-
{
|
|
28
|
-
itemClasses: 'item-extra-class item-another-extra-class',
|
|
29
|
-
linkClasses: 'link-extra-class link-another-extra-class',
|
|
30
|
-
url: 'https://example.com/',
|
|
31
|
-
text: 'Home',
|
|
32
|
-
attributes: {
|
|
33
|
-
'data-a': '123',
|
|
34
|
-
'data-b': '456',
|
|
35
|
-
},
|
|
36
|
-
id: 'first-breadcrumb',
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
url: 'https://example.com/guide/',
|
|
40
|
-
text: 'Guide',
|
|
41
|
-
id: 'second-breadcrumb',
|
|
42
|
-
attributes: {
|
|
43
|
-
'data-a': '789',
|
|
44
|
-
'data-b': 'ABC',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
describe('macro: breadcrumbs', () => {
|
|
51
|
-
it('passes jest-axe checks', async () => {
|
|
52
|
-
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
53
|
-
|
|
54
|
-
const results = await axe($.html());
|
|
55
|
-
expect(results).toHaveNoViolations();
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('has additionally provided style classes', () => {
|
|
59
|
-
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
60
|
-
|
|
61
|
-
expect($('.ons-breadcrumbs').hasClass('extra-class')).toBe(true);
|
|
62
|
-
expect($('.ons-breadcrumbs').hasClass('another-extra-class')).toBe(true);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('has a default `aria-label` of "Breadcrumbs"', () => {
|
|
66
|
-
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_MINIMAL));
|
|
67
|
-
|
|
68
|
-
expect($('.ons-breadcrumbs').attr('aria-label')).toBe('Breadcrumbs');
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('has the provided `ariaLabel` for `aria-label`', () => {
|
|
72
|
-
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
73
|
-
|
|
74
|
-
expect($('.ons-breadcrumbs').attr('aria-label')).toBe('Breadcrumbs label');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('has the provided `id`', () => {
|
|
78
|
-
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
|
|
79
|
-
|
|
80
|
-
expect($('.ons-breadcrumbs').attr('id')).toBe('example-breadcrumbs');
|
|
8
|
+
import { EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS, EXAMPLE_BREADCRUMBS_ALL_PARAMS } from './_test_examples';
|
|
9
|
+
|
|
10
|
+
describe('FOR: Macro: Breadcrumbs', () => {
|
|
11
|
+
describe('GIVEN: Params: required', () => {
|
|
12
|
+
describe('WHEN: required params are provided', () => {
|
|
13
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS));
|
|
14
|
+
test('THEN: jest-axe tests pass', async () => {
|
|
15
|
+
const results = await axe($.html());
|
|
16
|
+
expect(results).toHaveNoViolations();
|
|
17
|
+
});
|
|
18
|
+
const faker = templateFaker();
|
|
19
|
+
const iconsSpy = faker.spy('icon');
|
|
20
|
+
faker.renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS);
|
|
21
|
+
test('THEN: renders chevron icon next to item', () => {
|
|
22
|
+
const iconTypes = iconsSpy.occurrences.map((occurrence) => occurrence.iconType);
|
|
23
|
+
expect(iconTypes).toEqual(['chevron']);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
81
26
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
27
|
+
describe('GIVEN: Params: all', () => {
|
|
28
|
+
describe('WHEN: all Params are provided', () => {
|
|
29
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS));
|
|
30
|
+
test('THEN: jest-axe tests pass', async () => {
|
|
31
|
+
const results = await axe($.html());
|
|
32
|
+
expect(results).toHaveNoViolations();
|
|
33
|
+
});
|
|
34
|
+
const faker = templateFaker();
|
|
35
|
+
const iconsSpy = faker.spy('icon');
|
|
36
|
+
faker.renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS);
|
|
37
|
+
test('THEN: renders chevron icon next to each item', () => {
|
|
38
|
+
const iconTypes = iconsSpy.occurrences.map((occurrence) => occurrence.iconType);
|
|
39
|
+
expect(iconTypes).toEqual(['chevron', 'chevron']);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
88
42
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
43
|
+
describe('GIVEN: Params: classes', () => {
|
|
44
|
+
describe('WHEN: additional classes are provided', () => {
|
|
45
|
+
const $ = cheerio.load(
|
|
46
|
+
renderComponent('breadcrumbs', {
|
|
47
|
+
...EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS,
|
|
48
|
+
classes: 'extra-class another-extra-class',
|
|
49
|
+
}),
|
|
50
|
+
);
|
|
51
|
+
test('THEN: renders with correct additional classes', () => {
|
|
52
|
+
expect($('.ons-breadcrumbs').hasClass('extra-class')).toBe(true);
|
|
53
|
+
expect($('.ons-breadcrumbs').hasClass('another-extra-class')).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
95
56
|
});
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
57
|
+
describe('GIVEN: Params: ariaLabel', () => {
|
|
58
|
+
describe('WHEN: ariaLabel is not provided', () => {
|
|
59
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS));
|
|
60
|
+
test('THEN: renders with default aria-label of "Breadcrumbs"', () => {
|
|
61
|
+
expect($('.ons-breadcrumbs').attr('aria-label')).toBe('Breadcrumbs');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
describe('WHEN: ariaLabel is provided', () => {
|
|
65
|
+
const $ = cheerio.load(
|
|
66
|
+
renderComponent('breadcrumbs', {
|
|
67
|
+
...EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS,
|
|
68
|
+
ariaLabel: 'Breadcrumbs label',
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
test('THEN: renders with provided aria-label', () => {
|
|
72
|
+
expect($('.ons-breadcrumbs').attr('aria-label')).toBe('Breadcrumbs label');
|
|
73
|
+
});
|
|
74
|
+
});
|
|
102
75
|
});
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
expect(testValuesA).toEqual(['123', '789']);
|
|
116
|
-
const testValuesB = mapAll($('.ons-breadcrumbs__link'), (node) => node.attr('data-b'));
|
|
117
|
-
expect(testValuesB).toEqual(['456', 'ABC']);
|
|
76
|
+
describe('GIVEN: Params: id', () => {
|
|
77
|
+
describe('WHEN: id is provided', () => {
|
|
78
|
+
const $ = cheerio.load(
|
|
79
|
+
renderComponent('breadcrumbs', {
|
|
80
|
+
...EXAMPLE_BREADCRUMBS_REQUIRED_PARAMS,
|
|
81
|
+
id: 'example-breadcrumbs',
|
|
82
|
+
}),
|
|
83
|
+
);
|
|
84
|
+
test('THEN: renders with provided id', () => {
|
|
85
|
+
expect($('.ons-breadcrumbs').attr('id')).toBe('example-breadcrumbs');
|
|
86
|
+
});
|
|
87
|
+
});
|
|
118
88
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
89
|
+
describe('GIVEN: Params: itemsList (multiple)', () => {
|
|
90
|
+
describe('WHEN: itemClasses param is provided', () => {
|
|
91
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS));
|
|
92
|
+
test('THEN: renders item with provided style classes', () => {
|
|
93
|
+
expect($('.ons-breadcrumbs__item:first').hasClass('item-extra-class')).toBe(true);
|
|
94
|
+
expect($('.ons-breadcrumbs__item:first').hasClass('item-another-extra-class')).toBe(true);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
describe('WHEN: linkClasses param is provided', () => {
|
|
98
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS));
|
|
99
|
+
test('THEN: renders link with provided style classes', () => {
|
|
100
|
+
expect($('.ons-breadcrumbs__link').hasClass('link-extra-class')).toBe(true);
|
|
101
|
+
expect($('.ons-breadcrumbs__link').hasClass('link-another-extra-class')).toBe(true);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
describe('WHEN: id param is provided', () => {
|
|
105
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS));
|
|
106
|
+
test('THEN: renders items with provided id', () => {
|
|
107
|
+
const ids = mapAll($('.ons-breadcrumbs__link'), (node) => node.attr('id'));
|
|
108
|
+
expect(ids).toEqual(['first-breadcrumb', 'second-breadcrumb']);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('WHEN: url param is provided', () => {
|
|
112
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS));
|
|
113
|
+
test('THEN: renders items with provided url link', () => {
|
|
114
|
+
const urls = mapAll($('.ons-breadcrumbs__link'), (node) => node.attr('href'));
|
|
115
|
+
expect(urls).toEqual(['https://example.com/', 'https://example.com/guide/']);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
describe('WHEN: text param is provided', () => {
|
|
119
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS));
|
|
120
|
+
test('THEN: renders item links with provided text', () => {
|
|
121
|
+
const labels = mapAll($('.ons-breadcrumbs__link'), (node) => node.text().trim());
|
|
122
|
+
expect(labels).toEqual(['Home', 'Guide']);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
describe('WHEN: attributes param is provided', () => {
|
|
126
|
+
const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_ALL_PARAMS));
|
|
127
|
+
test('THEN: renders items with provided attributes', () => {
|
|
128
|
+
const testValuesA = mapAll($('.ons-breadcrumbs__link'), (node) => node.attr('data-a'));
|
|
129
|
+
expect(testValuesA).toEqual(['123', '789']);
|
|
130
|
+
const testValuesB = mapAll($('.ons-breadcrumbs__link'), (node) => node.attr('data-b'));
|
|
131
|
+
expect(testValuesB).toEqual(['456', 'ABC']);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
128
134
|
});
|
|
129
135
|
});
|