@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.
Files changed (212) hide show
  1. package/README.md +10 -1
  2. package/components/access-code/_macro.njk +4 -4
  3. package/components/access-code/_macro.spec.js +10 -10
  4. package/components/access-code/example-access-code-error.njk +2 -2
  5. package/components/access-code/example-access-code.njk +2 -2
  6. package/components/accordion/_macro.njk +1 -1
  7. package/components/accordion/_macro.spec.js +162 -91
  8. package/components/accordion/_test_examples.js +13 -0
  9. package/components/address-input/_macro.njk +7 -7
  10. package/components/address-input/_macro.spec.js +16 -15
  11. package/components/address-input/autosuggest.address.error.js +1 -1
  12. package/components/address-input/autosuggest.address.js +25 -25
  13. package/components/address-input/autosuggest.address.spec.js +6 -5
  14. package/components/address-input/example-address-input-editable.njk +5 -4
  15. package/components/address-input/example-address-input.njk +4 -5
  16. package/components/autosuggest/_autosuggest.scss +8 -8
  17. package/components/autosuggest/_macro.njk +5 -5
  18. package/components/autosuggest/autosuggest.spec.js +1 -1
  19. package/components/back-to-top/_back-to-top.scss +2 -2
  20. package/components/back-to-top/_macro.spec.js +1 -1
  21. package/components/back-to-top/example-full-page-back-to-top.njk +6 -6
  22. package/components/breadcrumbs/_breadcrumbs.scss +1 -1
  23. package/components/breadcrumbs/_macro.spec.js +121 -115
  24. package/components/breadcrumbs/_test_examples.js +36 -0
  25. package/components/browser-banner/_macro.spec.js +1 -1
  26. package/components/button/_button.scss +24 -16
  27. package/components/button/_macro.njk +5 -5
  28. package/components/button/_macro.spec.js +2 -2
  29. package/components/button/example-button-custom.njk +1 -1
  30. package/components/card/_card.scss +0 -6
  31. package/components/card/_macro.njk +9 -9
  32. package/components/card/_macro.spec.js +57 -24
  33. package/components/card/example-card-set-with-images.njk +30 -18
  34. package/components/card/example-card-set-with-lists.njk +57 -45
  35. package/components/card/example-card-set.njk +27 -15
  36. package/components/card/example-card.njk +9 -5
  37. package/components/char-check-limit/_macro.njk +1 -1
  38. package/components/checkboxes/_checkbox.scss +4 -4
  39. package/components/checkboxes/_checkboxes.scss +1 -1
  40. package/components/checkboxes/example-checkboxes-with-hidden-label.njk +4 -4
  41. package/components/cookies-banner/_cookies-banner.scss +5 -5
  42. package/components/cookies-banner/_macro.njk +15 -13
  43. package/components/cookies-banner/_macro.spec.js +1 -1
  44. package/components/details/_details.scss +5 -6
  45. package/components/details/_macro.njk +4 -4
  46. package/components/details/_macro.spec.js +1 -1
  47. package/components/document-list/_document-list.scss +0 -2
  48. package/components/document-list/_macro.njk +18 -18
  49. package/components/document-list/_macro.spec.js +16 -14
  50. package/components/document-list/example-document-list-article-featured.njk +5 -3
  51. package/components/document-list/example-document-list-articles.njk +15 -9
  52. package/components/document-list/example-document-list-downloads.njk +15 -9
  53. package/components/document-list/example-document-list-search-result-featured.njk +5 -3
  54. package/components/document-list/example-document-list-search-results.njk +20 -12
  55. package/components/download-resources/_download-resources.scss +1 -2
  56. package/components/download-resources/download-resources.spec.js +12 -6
  57. package/components/external-link/_macro.njk +1 -1
  58. package/components/external-link/_macro.spec.js +1 -1
  59. package/components/external-link/example-external-link.njk +1 -1
  60. package/components/feedback/_macro.njk +1 -1
  61. package/components/feedback/_macro.spec.js +3 -3
  62. package/components/feedback/example-feedback-call-to-action.njk +1 -1
  63. package/components/field/_field-group.scss +0 -2
  64. package/components/field/_field.scss +1 -2
  65. package/components/fieldset/_fieldset.scss +2 -2
  66. package/components/fieldset/_macro.njk +1 -1
  67. package/components/fieldset/_macro.spec.js +1 -1
  68. package/components/footer/_footer.scss +12 -7
  69. package/components/footer/_macro.njk +54 -34
  70. package/components/footer/_macro.spec.js +90 -28
  71. package/components/footer/example-footer-cymraeg.njk +1 -1
  72. package/components/footer/example-footer-transactional.njk +1 -1
  73. package/components/footer/example-footer-warning.njk +1 -1
  74. package/components/footer/example-footer-with-alternative-organisation.njk +99 -94
  75. package/components/footer/example-footer-with-coat-of-arms.njk +1 -1
  76. package/components/footer/example-footer-with-copyright.njk +1 -1
  77. package/components/footer/example-footer-with-multiple-logos-and-split-display.njk +173 -0
  78. package/components/footer/example-footer-with-multiple-logos.njk +172 -0
  79. package/components/footer/example-footer.njk +1 -1
  80. package/components/header/_header.scss +7 -14
  81. package/components/header/_macro.njk +19 -19
  82. package/components/header/_macro.spec.js +18 -18
  83. package/components/header/example-header-external-for-surveys.njk +2 -2
  84. package/components/header/example-header-external-welsh.njk +2 -2
  85. package/components/header/example-header-external-with-sub-navigation-removed.njk +1 -1
  86. package/components/header/example-header-external-with-sub-navigation.njk +1 -1
  87. package/components/header/example-header-multiple-logos.njk +4 -4
  88. package/components/hero/_hero.scss +6 -8
  89. package/components/hero/_macro.njk +1 -1
  90. package/components/icon/_icon.scss +4 -4
  91. package/components/icon/_macro.njk +4 -4
  92. package/components/icon/_macro.spec.js +2 -2
  93. package/components/image/_image.scss +1 -1
  94. package/components/image/_macro.njk +1 -1
  95. package/components/image/_macro.spec.js +10 -10
  96. package/components/image/example-image-for-regular-screens.njk +1 -1
  97. package/components/input/_input-type.scss +0 -2
  98. package/components/input/_input.scss +10 -10
  99. package/components/input/_macro.njk +4 -2
  100. package/components/input/example-input-search-with-character-check.njk +1 -1
  101. package/components/input/example-input-search.njk +1 -1
  102. package/components/label/_label.scss +1 -3
  103. package/components/language-selector/_macro.njk +3 -3
  104. package/components/language-selector/_macro.spec.js +7 -7
  105. package/components/list/_list.scss +1 -5
  106. package/components/list/_macro.njk +9 -10
  107. package/components/list/_macro.spec.js +50 -9
  108. package/components/list/example-inline-list-with-social-icon-prefix.njk +1 -1
  109. package/components/message/_macro.njk +3 -3
  110. package/components/message/_macro.spec.js +3 -3
  111. package/components/message-list/_macro.njk +2 -2
  112. package/components/message-list/_macro.spec.js +8 -4
  113. package/components/message-list/_message-list.scss +2 -2
  114. package/components/navigation/_macro.njk +9 -9
  115. package/components/navigation/_macro.spec.js +2 -2
  116. package/components/navigation/_navigation.scss +2 -6
  117. package/components/navigation/navigation.dom.js +1 -1
  118. package/components/navigation/navigation.spec.js +4 -4
  119. package/components/pagination/_macro.njk +2 -2
  120. package/components/pagination/_pagination.scss +1 -7
  121. package/components/panel/_macro.njk +5 -4
  122. package/components/panel/_macro.spec.js +2 -2
  123. package/components/panel/_panel.scss +12 -8
  124. package/components/password/_macro.njk +1 -1
  125. package/components/password/_macro.spec.js +2 -2
  126. package/components/phase-banner/_macro.njk +1 -1
  127. package/components/phase-banner/_phase-banner.scss +3 -4
  128. package/components/phase-banner/example-phase-banner-alpha.njk +1 -1
  129. package/components/phase-banner/example-phase-banner-beta.njk +1 -1
  130. package/components/question/_macro.njk +8 -8
  131. package/components/question/_macro.spec.js +3 -3
  132. package/components/question/_question.scss +3 -3
  133. package/components/radios/_macro.njk +1 -1
  134. package/components/radios/_macro.spec.js +1 -1
  135. package/components/radios/_radios.scss +1 -1
  136. package/components/radios/example-radios-with-clear-button-expanded.njk +1 -1
  137. package/components/radios/example-radios-with-clear-button.njk +1 -1
  138. package/components/related-content/_macro.spec.js +2 -2
  139. package/components/related-content/_related-content.scss +1 -1
  140. package/components/related-content/example-related-content-general.njk +2 -2
  141. package/components/related-content/example-related-content-social-media.njk +1 -1
  142. package/components/reply/_macro.njk +3 -1
  143. package/components/reply/_macro.spec.js +1 -1
  144. package/components/reply/reply.spec.js +1 -1
  145. package/components/section-navigation/_macro.njk +10 -10
  146. package/components/section-navigation/_macro.spec.js +15 -15
  147. package/components/section-navigation/_section-navigation.scss +3 -8
  148. package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +3 -3
  149. package/components/section-navigation/example-section-navigation-vertical.njk +14 -14
  150. package/components/section-navigation/example-section-navigation.njk +3 -3
  151. package/components/select/example-select-with-inline-label.njk +1 -1
  152. package/components/share-page/_macro.njk +7 -7
  153. package/components/share-page/_macro.spec.js +2 -2
  154. package/components/share-page/example-share-page.njk +1 -1
  155. package/components/status/_status.scss +1 -1
  156. package/components/summary/_macro.njk +33 -33
  157. package/components/summary/_macro.spec.js +34 -34
  158. package/components/summary/_summary.scss +2 -4
  159. package/components/summary/example-summary-card-grouped.njk +34 -34
  160. package/components/summary/example-summary-grouped-total.njk +7 -7
  161. package/components/summary/example-summary-grouped-with-errors.njk +9 -9
  162. package/components/summary/example-summary-grouped.njk +34 -34
  163. package/components/summary/example-summary-household.njk +7 -7
  164. package/components/summary/example-summary-hub-minimal.njk +8 -8
  165. package/components/summary/example-summary-hub.njk +16 -16
  166. package/components/summary/example-summary-multiple.njk +7 -7
  167. package/components/summary/example-summary-no-action.njk +5 -5
  168. package/components/summary/example-summary.njk +9 -9
  169. package/components/table/_table.scss +2 -3
  170. package/components/table-of-contents/_macro.njk +3 -3
  171. package/components/table-of-contents/_macro.spec.js +3 -3
  172. package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
  173. package/components/tabs/_macro.njk +3 -3
  174. package/components/tabs/_macro.spec.js +3 -3
  175. package/components/tabs/_tabs.scss +3 -4
  176. package/components/tabs/example-tabs-details.njk +1 -1
  177. package/components/text-indent/_text-indent.scss +1 -1
  178. package/components/text-indent/example-text-indent.njk +1 -1
  179. package/components/timeline/_macro.njk +4 -4
  180. package/components/timeline/_macro.spec.js +3 -3
  181. package/components/timeline/_timeline.scss +4 -3
  182. package/components/timeline/example-timeline.njk +1 -1
  183. package/components/upload/_upload.scss +2 -2
  184. package/components/video/_macro.njk +4 -4
  185. package/components/video/_macro.spec.js +2 -2
  186. package/components/video/_video.scss +1 -1
  187. package/components/video/example-video.njk +2 -2
  188. package/components/video/video.spec.js +2 -2
  189. package/css/main.css +1 -1
  190. package/layout/_dsTemplate.njk +1 -1
  191. package/layout/_template.njk +31 -31
  192. package/package.json +3 -2
  193. package/scripts/main.es5.js +1 -1
  194. package/scripts/main.js +1 -1
  195. package/scss/base/_global.scss +2 -0
  196. package/scss/base/_typography.scss +0 -2
  197. package/scss/main.scss +0 -1
  198. package/scss/objects/_container.scss +1 -1
  199. package/scss/objects/_page.scss +2 -3
  200. package/scss/overrides/rtl.scss +1 -1
  201. package/scss/utilities/_grid.scss +103 -96
  202. package/scss/utilities/_margin.scss +11 -5
  203. package/scss/utilities/_padding.scss +12 -5
  204. package/scss/utilities/_typography.scss +2 -1
  205. package/scss/vars/_forms.scss +8 -10
  206. package/scss/vars/_grid.scss +4 -4
  207. package/scss/vars/_typography.scss +26 -19
  208. package/components/call-to-action/_call-to-action.scss +0 -8
  209. package/components/call-to-action/_macro.njk +0 -24
  210. package/components/call-to-action/_macro.spec.js +0 -48
  211. package/components/call-to-action/example-call-to-action-default.njk +0 -15
  212. 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.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/`;
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.lookupURL + 'cf142&limit=10', {
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 queryURL, fullQueryURL;
112
+ let queryUrl, fullQueryUrl;
113
113
 
114
114
  if (this.manualQueryParams) {
115
115
  const manualQueryParams = this.container.getAttribute('data-query-params');
116
- fullQueryURL = this.lookupURL + text + manualQueryParams;
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
- queryURL = grouped ? this.lookupGroupURL + this.groupQuery : this.lookupURL + text + '&limit=' + limit;
121
+ queryUrl = grouped ? this.lookupGroupUrl + this.groupQuery : this.lookupUrl + text + '&limit=' + limit;
122
122
 
123
- fullQueryURL = this.generateURLParams(queryURL);
123
+ fullQueryUrl = this.generateUrlParams(queryUrl);
124
124
  if (fullPostcodeQuery && grouped !== false) {
125
- fullQueryURL = fullQueryURL + '&groupfullpostcodes=combo';
125
+ fullQueryUrl = fullQueryUrl + '&groupfullpostcodes=combo';
126
126
  }
127
127
  }
128
128
 
129
- this.fetch = abortableFetch(fullQueryURL, {
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.retrieveURL + id;
251
+ let retrieveUrl = this.retrieveUrl + id;
252
252
 
253
- const fullUPRNURL = this.generateURLParams(retrieveUrl, id, type);
253
+ const fullUprnUrl = this.generateUrlParams(retrieveUrl, id, type);
254
254
 
255
- this.fetch = abortableFetch(fullUPRNURL, {
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
- generateURLParams(baseURL, uprn, type) {
319
- let fullURL = baseURL,
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
- fullURL = fullURL + classificationFilterParam + this.classificationFilter;
339
+ fullUrl = fullUrl + classificationFilterParam + this.classificationFilter;
340
340
  }
341
341
 
342
342
  if (this.classificationFilter === 'workplace') {
343
343
  if (this.regionCode === 'gb-eng') {
344
- fullURL = fullURL + eboostParam;
344
+ fullUrl = fullUrl + eboostParam;
345
345
  } else if (this.regionCode === 'gb-wls') {
346
- fullURL = fullURL + wboostParam;
346
+ fullUrl = fullUrl + wboostParam;
347
347
  }
348
348
  }
349
349
 
350
350
  if (this.regionCode === 'gb-nir') {
351
351
  if (this.classificationFilter === 'educational') {
352
- fullURL = fullURL + nionlyParam;
352
+ fullUrl = fullUrl + nionlyParam;
353
353
  } else {
354
- fullURL = fullURL + niboostParam;
354
+ fullUrl = fullUrl + niboostParam;
355
355
  }
356
356
  }
357
357
 
358
358
  if (this.lang === 'cy') {
359
- fullURL = fullURL + favourwelshParam;
359
+ fullUrl = fullUrl + favourwelshParam;
360
360
  }
361
361
  } else if (uprn) {
362
- fullURL = baseURL + addresstypeParam + addressType;
362
+ fullUrl = baseUrl + addresstypeParam + addressType;
363
363
  }
364
364
 
365
365
  if (this.epoch === 'true') {
366
- fullURL = fullURL + epochParam;
366
+ fullUrl = fullUrl + epochParam;
367
367
  }
368
368
 
369
- return fullURL;
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
- errorMessageAPI: 'Sorry, there is a problem loading addresses',
34
- errorMessageAPILinkText: 'Enter address manually',
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
- APIDomain: '/fake/api',
61
- APIDomainBearerToken: 'someToken',
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.APIDomain);
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
- "APIDomain": "https://mock-address-api.gcp.onsdigital.uk",
14
- 'APIDomainBearerToken': "some_token",
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
- "errorMessageAPI": "Sorry, there is a problem loading addresses.",
34
- "errorMessageAPILinkText": "Enter address manually",
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
- "APIDomain": "https://mock-address-api.gcp.onsdigital.uk",
16
- 'APIDomainBearerToken': "some_token",
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
- "errorMessageAPI": "Sorry, there is a problem. We are working to fix it. Please try again later or",
35
- "errorMessageAPILinkText": "contact us for more help",
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(xxs, s) {
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: 21px;
100
- line-height: 25px;
99
+ font-size: 1.3rem;
100
+ line-height: 1.5rem;
101
101
  margin-top: 0;
102
- min-height: 24px;
103
- min-width: 26px;
104
- top: 17px;
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.8rem 0.8rem 0.8rem 2rem;
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.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 %}
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.errorMessageAPI %}data-error-api="{{ params.errorMessageAPI }}"{% endif %}
30
- {% if params.errorMessageAPILinkText %}data-error-api-link-text="{{ params.errorMessageAPILinkText }}"{% endif %}
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
- errorMessageAPI: 'Sorry, there is a problem.',
600
+ errorMessageApi: 'Sorry, there is a problem.',
601
601
  }),
602
602
  );
603
603
 
@@ -1,12 +1,12 @@
1
1
  .ons-back-to-top {
2
2
  &__description {
3
- margin-left: 0.2rem;
3
+ margin-left: 0.25rem;
4
4
  }
5
5
 
6
6
  &__enabled {
7
7
  background: none;
8
8
  width: fit-content;
9
- padding: 0.5em 0;
9
+ padding: 0.5rem 0;
10
10
  }
11
11
 
12
12
  &__sticky {
@@ -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-xxl">
35
- <span class="ons-u-fs-m ons-u-db ons-u-mb-xs ons-u-lighter">Press releases</span>
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-xxl ons-u-db">ONS launches Integrated Data Service to boost government collaboration on data sharing</span>
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-m">
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-l ons-u-mt-xl@m">
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": 'xxl',
182
+ "iconSize": '2xl',
183
183
  "itemsList": [
184
184
  {
185
185
  "url": '#0',
@@ -22,7 +22,7 @@ $breadcrumb-chevron-height: 0.65rem;
22
22
 
23
23
  .ons-icon {
24
24
  height: $breadcrumb-chevron-height;
25
- margin: 0 0.2rem;
25
+ margin: 0 0.25rem;
26
26
  vertical-align: middle;
27
27
  width: $breadcrumb-chevron-height;
28
28
  }
@@ -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
- const EXAMPLE_BREADCRUMBS_MINIMAL = {
10
- itemsList: [
11
- {
12
- url: 'https://example.com/',
13
- text: 'Home',
14
- },
15
- {
16
- url: 'https://example.com/guide/',
17
- text: 'Guide',
18
- },
19
- ],
20
- };
21
-
22
- const EXAMPLE_BREADCRUMBS = {
23
- classes: 'extra-class another-extra-class',
24
- ariaLabel: 'Breadcrumbs label',
25
- id: 'example-breadcrumbs',
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
- it('has additionally provided style classes on `item` element', () => {
84
- const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
85
-
86
- expect($('.ons-breadcrumbs__item:first').hasClass('item-extra-class')).toBe(true);
87
- expect($('.ons-breadcrumbs__item:first').hasClass('item-another-extra-class')).toBe(true);
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
- it('has additionally provided style classes on `link` element', () => {
91
- const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
92
-
93
- expect($('.ons-breadcrumbs__link:first').hasClass('link-extra-class')).toBe(true);
94
- expect($('.ons-breadcrumbs__link:first').hasClass('link-another-extra-class')).toBe(true);
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
- it('has provided `url` on `link` elements', () => {
98
- const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
99
-
100
- const urls = mapAll($('.ons-breadcrumbs__link'), (node) => node.attr('href'));
101
- expect(urls).toEqual(['https://example.com/', 'https://example.com/guide/']);
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
- it('has provided `text` on `link` elements', () => {
105
- const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
106
-
107
- const labels = mapAll($('.ons-breadcrumbs__link'), (node) => node.text().trim());
108
- expect(labels).toEqual(['Home', 'Guide']);
109
- });
110
-
111
- it('has provided `attributes` on `link` elements', () => {
112
- const $ = cheerio.load(renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS));
113
-
114
- const testValuesA = mapAll($('.ons-breadcrumbs__link'), (node) => node.attr('data-a'));
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
- it('has a "chevron" icon for each breadcrumb item', () => {
121
- const faker = templateFaker();
122
- const iconsSpy = faker.spy('icon');
123
-
124
- faker.renderComponent('breadcrumbs', EXAMPLE_BREADCRUMBS_MINIMAL);
125
-
126
- const iconTypes = iconsSpy.occurrences.map((occurrence) => occurrence.iconType);
127
- expect(iconTypes).toEqual(['chevron', 'chevron']);
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
  });