@ons/design-system 67.2.0 → 69.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 (182) hide show
  1. package/README.md +5 -0
  2. package/components/access-code/_macro.njk +1 -1
  3. package/components/access-code/_macro.spec.js +2 -10
  4. package/components/access-code/access-code.dom.js +1 -1
  5. package/components/access-code/access-code.spec.js +2 -2
  6. package/components/access-code/example-access-code-error.njk +9 -14
  7. package/components/access-code/example-access-code.njk +3 -5
  8. package/components/accordion/accordion.js +4 -4
  9. package/components/address-input/_macro.spec.js +3 -15
  10. package/components/address-input/autosuggest.address.dom.js +1 -1
  11. package/components/address-input/autosuggest.address.js +3 -2
  12. package/components/address-input/autosuggest.address.setter.js +3 -3
  13. package/components/address-input/autosuggest.address.spec.js +66 -69
  14. package/components/address-output/_macro.spec.js +6 -30
  15. package/components/autosuggest/autosuggest.dom.js +1 -1
  16. package/components/autosuggest/autosuggest.helpers.js +1 -1
  17. package/components/back-to-top/_back-to-top.scss +34 -0
  18. package/components/back-to-top/_macro.njk +17 -0
  19. package/components/back-to-top/_macro.spec.js +60 -0
  20. package/components/back-to-top/back-to-top.dom.js +12 -0
  21. package/components/back-to-top/back-to-top.js +58 -0
  22. package/components/back-to-top/back-to-top.spec.js +117 -0
  23. package/components/back-to-top/example-back-to-top.njk +37 -0
  24. package/components/back-to-top/example-full-page-back-to-top.njk +192 -0
  25. package/components/browser-banner/_macro.spec.js +4 -12
  26. package/components/button/_macro.njk +6 -6
  27. package/components/button/_macro.spec.js +1 -5
  28. package/components/button/button.js +7 -8
  29. package/components/button/button.spec.js +17 -39
  30. package/components/call-to-action/_macro.spec.js +2 -6
  31. package/components/card/_macro.njk +25 -25
  32. package/components/card/_macro.spec.js +6 -30
  33. package/components/char-check-limit/_macro.njk +1 -1
  34. package/components/char-check-limit/_macro.spec.js +3 -7
  35. package/components/char-check-limit/character-check.spec.js +24 -20
  36. package/components/checkboxes/_checkbox-macro.njk +1 -1
  37. package/components/checkboxes/_checkbox.scss +0 -3
  38. package/components/checkboxes/_macro.spec.js +1 -5
  39. package/components/checkboxes/checkbox-with-autoselect.js +3 -3
  40. package/components/checkboxes/checkbox-with-fieldset.js +2 -2
  41. package/components/checkboxes/checkboxes-with-reveal.js +4 -2
  42. package/components/checkboxes/checkboxes.dom.js +2 -2
  43. package/components/checkboxes/checkboxes.spec.js +13 -13
  44. package/components/content-pagination/_macro.spec.js +2 -2
  45. package/components/cookies-banner/cookies-banner.dom.js +1 -1
  46. package/components/cookies-banner/cookies-banner.js +1 -1
  47. package/components/cookies-banner/cookies-banner.spec.js +7 -7
  48. package/components/details/details.spec.js +12 -12
  49. package/components/details/example-details-with-warning.njk +5 -7
  50. package/components/document-list/_macro.spec.js +9 -27
  51. package/components/document-list/document-list.scss +1 -1
  52. package/components/document-list/example-document-list-downloads.njk +3 -3
  53. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  54. package/components/document-list/example-document-list-search-results.njk +3 -3
  55. package/components/download-resources/download-resources.js +54 -54
  56. package/components/download-resources/download-resources.spec.js +3 -1
  57. package/components/error/_macro.njk +1 -1
  58. package/components/error/_macro.spec.js +2 -6
  59. package/components/feedback/_macro.spec.js +4 -20
  60. package/components/field/_macro.spec.js +1 -3
  61. package/components/fieldset/_fieldset.scss +1 -2
  62. package/components/fieldset/_macro.spec.js +3 -9
  63. package/components/footer/_footer.scss +8 -0
  64. package/components/footer/_macro.njk +8 -7
  65. package/components/footer/_macro.spec.js +14 -2
  66. package/components/helpers/grid.njk +15 -15
  67. package/components/icon/_macro.njk +7 -3
  68. package/components/icon/_macro.spec.js +4 -12
  69. package/components/image/_macro.spec.js +1 -5
  70. package/components/input/_macro.njk +22 -23
  71. package/components/input/_macro.spec.js +1 -1
  72. package/components/input/character-check.dom.js +1 -1
  73. package/components/input/input.spec.js +1 -4
  74. package/components/label/_label.scss +1 -0
  75. package/components/label/_macro.njk +2 -2
  76. package/components/label/_macro.spec.js +4 -13
  77. package/components/list/_macro.spec.js +4 -12
  78. package/components/message/_macro.njk +17 -17
  79. package/components/message/_macro.spec.js +9 -33
  80. package/components/message-list/_macro.spec.js +7 -39
  81. package/components/modal/_macro.spec.js +3 -9
  82. package/components/modal/modal.dom.js +1 -1
  83. package/components/modal/modal.spec.js +5 -5
  84. package/components/mutually-exclusive/_macro.spec.js +2 -10
  85. package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +26 -26
  86. package/components/mutually-exclusive/mutually-exclusive.date.spec.js +9 -9
  87. package/components/mutually-exclusive/mutually-exclusive.dom.js +1 -1
  88. package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +8 -8
  89. package/components/mutually-exclusive/mutually-exclusive.email.spec.js +7 -7
  90. package/components/mutually-exclusive/mutually-exclusive.js +13 -13
  91. package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +29 -29
  92. package/components/mutually-exclusive/mutually-exclusive.number.spec.js +7 -7
  93. package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +8 -8
  94. package/components/navigation/navigation.spec.js +0 -2
  95. package/components/pagination/_macro.spec.js +11 -53
  96. package/components/panel/_macro.njk +17 -17
  97. package/components/panel/_macro.spec.js +25 -25
  98. package/components/panel/_panel.scss +10 -9
  99. package/components/panel/example-panel-bare.njk +3 -4
  100. package/components/panel/example-panel-with-announcement.njk +6 -10
  101. package/components/panel/example-panel-with-error-summary.njk +2 -2
  102. package/components/panel/example-panel-with-information.njk +0 -1
  103. package/components/panel/example-panel-with-success-message.njk +1 -1
  104. package/components/panel/example-panel-with-warning.njk +2 -3
  105. package/components/password/password.dom.js +1 -1
  106. package/components/phase-banner/_macro.spec.js +3 -9
  107. package/components/question/_macro.njk +1 -1
  108. package/components/question/_macro.spec.js +5 -19
  109. package/components/question/_question.scss +1 -4
  110. package/components/question/example-question-interviewer-note.njk +1 -1
  111. package/components/quote/_macro.spec.js +2 -10
  112. package/components/radios/clear-radios.js +3 -3
  113. package/components/radios/radio-with-fieldset.js +4 -4
  114. package/components/radios/radios.dom.js +1 -1
  115. package/components/radios/radios.spec.js +26 -26
  116. package/components/related-content/_macro.spec.js +2 -4
  117. package/components/related-content/_section-macro.spec.js +2 -8
  118. package/components/relationships/example-relationships-error.njk +16 -18
  119. package/components/relationships/relationships.dom.js +1 -1
  120. package/components/relationships/relationships.js +2 -2
  121. package/components/reply/_macro.spec.js +3 -3
  122. package/components/reply/reply.dom.js +1 -1
  123. package/components/reply/reply.spec.js +3 -3
  124. package/components/section-navigation/_macro.spec.js +13 -21
  125. package/components/select/_macro.spec.js +6 -6
  126. package/components/share-page/_macro.spec.js +6 -14
  127. package/components/skip-to-content/_macro.spec.js +3 -11
  128. package/components/skip-to-content/skip-to-content.dom.js +1 -1
  129. package/components/skip-to-content/skip-to-content.js +1 -1
  130. package/components/skip-to-content/skip-to-content.spec.js +2 -2
  131. package/components/status/_macro.njk +2 -2
  132. package/components/status/_macro.spec.js +5 -9
  133. package/components/status/example-status-dead.njk +1 -1
  134. package/components/status/example-status-error.njk +1 -1
  135. package/components/status/example-status-pending.njk +1 -1
  136. package/components/status/example-status-small.njk +1 -1
  137. package/components/status/example-status-success.njk +1 -1
  138. package/components/summary/_macro.njk +4 -5
  139. package/components/summary/_macro.spec.js +27 -9
  140. package/components/table/_macro.spec.js +6 -10
  141. package/components/table/scrollable-table.dom.js +1 -1
  142. package/components/table/scrollable-table.js +1 -1
  143. package/components/table/sortable-table.js +4 -4
  144. package/components/table/table.spec.js +21 -17
  145. package/components/table-of-contents/_macro.njk +31 -31
  146. package/components/table-of-contents/_macro.spec.js +3 -11
  147. package/components/table-of-contents/toc.dom.js +1 -1
  148. package/components/table-of-contents/toc.spec.js +36 -32
  149. package/components/tabs/example-tabs-details.njk +1 -1
  150. package/components/tabs/tabs.dom.js +1 -1
  151. package/components/tabs/tabs.js +8 -8
  152. package/components/text-indent/_macro.spec.js +2 -6
  153. package/components/textarea/textarea.dom.js +1 -1
  154. package/components/textarea/textarea.spec.js +8 -8
  155. package/components/timeout-modal/_macro.spec.js +1 -3
  156. package/components/timeout-modal/timeout-modal.dom.js +1 -1
  157. package/components/timeout-modal/timeout-modal.spec.js +10 -10
  158. package/components/timeout-panel/_macro.njk +16 -17
  159. package/components/timeout-panel/_macro.spec.js +1 -1
  160. package/components/timeout-panel/timeout-panel.dom.js +1 -1
  161. package/components/timeout-panel/timeout-panel.spec.js +8 -8
  162. package/components/video/_macro.spec.js +1 -5
  163. package/components/video/video.dom.js +1 -1
  164. package/components/video/video.spec.js +16 -12
  165. package/css/main.css +1 -1
  166. package/favicons/safari-pinned-tab.svg +23 -23
  167. package/js/analytics.js +15 -14
  168. package/js/cookies-settings.dom.js +1 -1
  169. package/js/cookies-settings.spec.js +19 -19
  170. package/js/domready.js +1 -1
  171. package/js/fetch.js +1 -1
  172. package/js/inpagelink.js +3 -3
  173. package/js/main.js +1 -0
  174. package/js/print-button.js +1 -1
  175. package/js/timeout.js +1 -1
  176. package/package.json +2 -1
  177. package/scripts/main.es5.js +1 -1
  178. package/scripts/main.js +1 -1
  179. package/scss/base/_typography.scss +8 -2
  180. package/scss/main.scss +1 -0
  181. package/scss/overrides/hcm.scss +8 -1
  182. package/scss/vars/_colors.scss +2 -1
@@ -2,7 +2,7 @@
2
2
 
3
3
  {{
4
4
  onsPanel({
5
- "type": 'success',
5
+ "variant": 'success',
6
6
  "id": 'success-id',
7
7
  "iconType": 'check',
8
8
  "body": 'Information has been successfully submitted'
@@ -1,8 +1,7 @@
1
1
  {% from "components/panel/_macro.njk" import onsPanel %}
2
2
 
3
3
  {% call onsPanel({
4
- "type": 'warn'
5
- })
6
- %}
4
+ "variant": 'warn'
5
+ }) %}
7
6
  All of the information about this person will be deleted
8
7
  {% endcall %}
@@ -6,7 +6,7 @@ async function initialisePasswords() {
6
6
  if (passwordFields.length) {
7
7
  const Password = (await import('./password')).default;
8
8
 
9
- passwordFields.forEach(field => new Password(field));
9
+ passwordFields.forEach((field) => new Password(field));
10
10
  }
11
11
  }
12
12
 
@@ -20,18 +20,14 @@ describe('macro: phase-banner', () => {
20
20
  it('has expected html content', () => {
21
21
  const $ = cheerio.load(renderComponent('phase-banner', EXAMPLE_PHASE_BANNER_MINIMAL));
22
22
 
23
- const htmlContent = $('.ons-phase-banner__desc')
24
- .html()
25
- .trim();
23
+ const htmlContent = $('.ons-phase-banner__desc').html().trim();
26
24
  expect(htmlContent).toBe('Example content with a <a href="#">link</a>');
27
25
  });
28
26
 
29
27
  it('has the "Beta" badge by default', () => {
30
28
  const $ = cheerio.load(renderComponent('phase-banner', EXAMPLE_PHASE_BANNER_MINIMAL));
31
29
 
32
- const badgeText = $('.ons-phase-banner__badge')
33
- .text()
34
- .trim();
30
+ const badgeText = $('.ons-phase-banner__badge').text().trim();
35
31
  expect(badgeText).toBe('Beta');
36
32
  });
37
33
 
@@ -43,9 +39,7 @@ describe('macro: phase-banner', () => {
43
39
  }),
44
40
  );
45
41
 
46
- const badgeText = $('.ons-phase-banner__badge')
47
- .text()
48
- .trim();
42
+ const badgeText = $('.ons-phase-banner__badge').text().trim();
49
43
  expect(badgeText).toBe('Alpha');
50
44
  });
51
45
 
@@ -74,7 +74,7 @@
74
74
  {% from "components/panel/_macro.njk" import onsPanel %}
75
75
  {% call onsPanel({
76
76
  "id": params.warning.id,
77
- "type": "warn"
77
+ "variant": "warn"
78
78
  }) %}
79
79
  <p>{{ params.warning.body }}</p>
80
80
  {% endcall %}
@@ -112,11 +112,7 @@ describe('macro: question', () => {
112
112
  it('has the `title` text', () => {
113
113
  const $ = cheerio.load(renderComponent('question', EXAMPLE_QUESTION_BASIC));
114
114
 
115
- expect(
116
- $('.ons-question__title')
117
- .text()
118
- .trim(),
119
- ).toBe('Question title');
115
+ expect($('.ons-question__title').text().trim()).toBe('Question title');
120
116
  });
121
117
 
122
118
  it('has the provided `id` attribute', () => {
@@ -155,19 +151,13 @@ describe('macro: question', () => {
155
151
  it('has the `description` text', () => {
156
152
  const $ = cheerio.load(renderComponent('question', EXAMPLE_QUESTION_BASIC));
157
153
 
158
- expect(
159
- $('.ons-question__description')
160
- .text()
161
- .trim(),
162
- ).toBe('Question description');
154
+ expect($('.ons-question__description').text().trim()).toBe('Question description');
163
155
  });
164
156
 
165
157
  it('calls with content', () => {
166
158
  const $ = cheerio.load(renderComponent('question', { EXAMPLE_QUESTION_BASIC }, 'Example content...'));
167
159
 
168
- const content = $('.ons-question__answer')
169
- .text()
170
- .trim();
160
+ const content = $('.ons-question__answer').text().trim();
171
161
  expect(content).toEqual(expect.stringContaining('Example content...'));
172
162
  });
173
163
  });
@@ -180,7 +170,7 @@ describe('macro: question', () => {
180
170
  faker.renderComponent('question', EXAMPLE_QUESTION_WARNING);
181
171
 
182
172
  expect(panelSpy.occurrences[0]).toHaveProperty('id', 'warning-id');
183
- expect(panelSpy.occurrences[0]).toHaveProperty('type', 'warn');
173
+ expect(panelSpy.occurrences[0]).toHaveProperty('variant', 'warn');
184
174
  });
185
175
 
186
176
  it('outputs the expected panel content', () => {
@@ -321,11 +311,7 @@ describe('macro: question', () => {
321
311
  it('has a description element visually hidden before the title', () => {
322
312
  const $ = cheerio.load(renderComponent('question', EXAMPLE_QUESTION_DESCRIPTION_FIRST));
323
313
 
324
- expect(
325
- $('.ons-question__title')
326
- .text()
327
- .trim(),
328
- ).toBe('Question description Question title');
314
+ expect($('.ons-question__title').text().trim()).toBe('Question description Question title');
329
315
  });
330
316
 
331
317
  it('has the visible description element with aria-hidden attribute', () => {
@@ -4,16 +4,13 @@
4
4
  &__title {
5
5
  @extend .ons-u-mb-m;
6
6
 
7
- em,
8
- .ons-highlight {
9
- @extend .ons-highlight;
10
- }
11
7
  mark,
12
8
  .ons-instruction {
13
9
  background-color: var(--ons-color-instruction);
14
10
  color: var(--ons-color-text-inverse);
15
11
  margin-right: 0.5rem;
16
12
  padding: 0 0.5rem;
13
+ box-shadow: none;
17
14
  }
18
15
  }
19
16
 
@@ -24,7 +24,7 @@ layout: ~
24
24
 
25
25
  {% block main %}
26
26
  {% call onsQuestion({
27
- "title": "<mark class=\"ons-instruction\">Interviewer note:</mark>Who to interview",
27
+ "title": "<mark>Interviewer note:</mark>Who to interview",
28
28
  "instruction": "<p>Only interview a person who was usually living at the property on <strong>Sunday 21 March 2021</strong>.</p><p>If none of those house members are available, you must save and sign out and return to the address to interview one of them at a later date.</p>",
29
29
  "submitButton": {
30
30
  "variants": "timer",
@@ -25,11 +25,7 @@ describe('macro: quote', () => {
25
25
  }),
26
26
  );
27
27
 
28
- expect(
29
- $('.ons-quote__text')
30
- .text()
31
- .trim(),
32
- ).toBe('Example quote text.');
28
+ expect($('.ons-quote__text').text().trim()).toBe('Example quote text.');
33
29
  });
34
30
 
35
31
  it('has the provided `ref` text with a leading "—" character', () => {
@@ -40,11 +36,7 @@ describe('macro: quote', () => {
40
36
  }),
41
37
  );
42
38
 
43
- expect(
44
- $('.ons-quote__ref')
45
- .text()
46
- .trim(),
47
- ).toBe('— Example quote reference.');
39
+ expect($('.ons-quote__ref').text().trim()).toBe('— Example quote reference.');
48
40
  });
49
41
 
50
42
  it('has a default `textFontSize` of "l"', () => {
@@ -8,7 +8,7 @@ export default class ClearRadios {
8
8
  this.clearAlert = this.ariaElement.getAttribute('data-clear');
9
9
  this.clearedAlert = this.ariaElement.getAttribute('data-cleared');
10
10
 
11
- this.inputs.forEach(input => input.addEventListener('click', this.setClearAttributes.bind(this)));
11
+ this.inputs.forEach((input) => input.addEventListener('click', this.setClearAttributes.bind(this)));
12
12
  this.button.addEventListener('click', this.clearRadios.bind(this));
13
13
  this.checkRadios();
14
14
 
@@ -22,7 +22,7 @@ export default class ClearRadios {
22
22
  }
23
23
 
24
24
  checkRadios() {
25
- this.inputs.forEach(input => {
25
+ this.inputs.forEach((input) => {
26
26
  if (input.checked) {
27
27
  this.setClearAttributes();
28
28
  }
@@ -40,7 +40,7 @@ export default class ClearRadios {
40
40
  clearRadios() {
41
41
  event.preventDefault();
42
42
 
43
- this.inputs.forEach(input => {
43
+ this.inputs.forEach((input) => {
44
44
  input.checked = false;
45
45
  });
46
46
 
@@ -8,20 +8,20 @@ export default class RadioWithFieldset {
8
8
  if (this.selectAllChildrenInput) {
9
9
  this.selectAllChildrenInput.addEventListener('change', this.checkChildInputsOnSelect.bind(this));
10
10
  } else {
11
- this.radios.forEach(radio => radio.addEventListener('change', this.uncheckChildInputsOnDeselect.bind(this)));
11
+ this.radios.forEach((radio) => radio.addEventListener('change', this.uncheckChildInputsOnDeselect.bind(this)));
12
12
  }
13
13
  }
14
14
 
15
15
  checkChildInputsOnSelect() {
16
- this.childInputs.forEach(input => {
16
+ this.childInputs.forEach((input) => {
17
17
  input.checked = this.selectAllChildrenInput.checked === true ? true : false;
18
18
  });
19
19
  }
20
20
 
21
21
  uncheckChildInputsOnDeselect() {
22
- const isOther = this.radios.find(radio => radio.classList.contains('ons-js-other'));
22
+ const isOther = this.radios.find((radio) => radio.classList.contains('ons-js-other'));
23
23
  if (isOther && isOther.checked === false) {
24
- this.childInputs.forEach(input => {
24
+ this.childInputs.forEach((input) => {
25
25
  input.checked = false;
26
26
  });
27
27
  }
@@ -28,7 +28,7 @@ domready(async () => {
28
28
  const otherFieldsets = [...document.querySelectorAll('.ons-js-other-fieldset-radio')];
29
29
  if (otherFieldsets) {
30
30
  const RadioWithInnerFieldset = (await import('./radio-with-fieldset')).default;
31
- otherFieldsets.forEach(otherFieldset => {
31
+ otherFieldsets.forEach((otherFieldset) => {
32
32
  const context = otherFieldset.closest('.ons-radio');
33
33
  new RadioWithInnerFieldset(context);
34
34
  });
@@ -64,14 +64,14 @@ describe('script: radios', () => {
64
64
  });
65
65
 
66
66
  it('radios with other options should be given aria-expanded attributes', async () => {
67
- const ariaExpandedOption1 = await page.$eval('#email', node => node.getAttribute('aria-expanded'));
67
+ const ariaExpandedOption1 = await page.$eval('#email', (node) => node.getAttribute('aria-expanded'));
68
68
  expect(ariaExpandedOption1).toBe('false');
69
- const ariaExpandedOption2 = await page.$eval('#phone', node => node.getAttribute('aria-expanded'));
69
+ const ariaExpandedOption2 = await page.$eval('#phone', (node) => node.getAttribute('aria-expanded'));
70
70
  expect(ariaExpandedOption2).toBe('false');
71
71
  });
72
72
 
73
73
  it('radios with "open" other options should not be given aria-expanded attributes', async () => {
74
- const hasAriaExpandedOption3 = await page.$eval('#text', node => node.hasAttribute('aria-expanded'));
74
+ const hasAriaExpandedOption3 = await page.$eval('#text', (node) => node.hasAttribute('aria-expanded'));
75
75
  expect(hasAriaExpandedOption3).toBe(false);
76
76
  });
77
77
 
@@ -81,27 +81,27 @@ describe('script: radios', () => {
81
81
  });
82
82
 
83
83
  it('then the checked radio aria-expanded attribute should be set to true', async () => {
84
- const ariaExpandedOption1 = await page.$eval('#email', node => node.getAttribute('aria-expanded'));
84
+ const ariaExpandedOption1 = await page.$eval('#email', (node) => node.getAttribute('aria-expanded'));
85
85
  expect(ariaExpandedOption1).toBe('true');
86
86
  });
87
87
 
88
88
  it('then the unchecked radio aria-expanded attribute should be set to false', async () => {
89
- const ariaExpandedOption2 = await page.$eval('#phone', node => node.getAttribute('aria-expanded'));
89
+ const ariaExpandedOption2 = await page.$eval('#phone', (node) => node.getAttribute('aria-expanded'));
90
90
  expect(ariaExpandedOption2).toBe('false');
91
91
  });
92
92
 
93
93
  it('then the unchecked radio aria-expanded attribute of "open" radio should not be set', async () => {
94
- const hasAriaExpanded = await page.$eval('#text', node => node.hasAttribute('aria-expanded'));
94
+ const hasAriaExpanded = await page.$eval('#text', (node) => node.hasAttribute('aria-expanded'));
95
95
  expect(hasAriaExpanded).toBe(false);
96
96
  });
97
97
 
98
98
  it('then the clear button should be visible', async () => {
99
- const isHidden = await page.$eval('.ons-js-clear-btn', node => node.classList.contains('ons-u-db-no-js_enabled'));
99
+ const isHidden = await page.$eval('.ons-js-clear-btn', (node) => node.classList.contains('ons-u-db-no-js_enabled'));
100
100
  expect(isHidden).toBe(false);
101
101
  });
102
102
 
103
103
  it('then the aria live message should announce that the answer can be cleared', async () => {
104
- const alertText = await page.$eval('.ons-js-clear-radio-alert', node => node.innerHTML);
104
+ const alertText = await page.$eval('.ons-js-clear-radio-alert', (node) => node.innerHTML);
105
105
  expect(alertText).toBe('You can clear your answer by clicking the clear selection button under the radio buttons');
106
106
  });
107
107
 
@@ -111,17 +111,17 @@ describe('script: radios', () => {
111
111
  });
112
112
 
113
113
  it('then the checked radio aria-expanded attribute should be set to true', async () => {
114
- const ariaExpandedOption2 = await page.$eval('#phone', node => node.getAttribute('aria-expanded'));
114
+ const ariaExpandedOption2 = await page.$eval('#phone', (node) => node.getAttribute('aria-expanded'));
115
115
  expect(ariaExpandedOption2).toBe('true');
116
116
  });
117
117
 
118
118
  it('then the unchecked radio aria-expanded attribute should be set to false', async () => {
119
- const ariaExpandedOption1 = await page.$eval('#email', node => node.getAttribute('aria-expanded'));
119
+ const ariaExpandedOption1 = await page.$eval('#email', (node) => node.getAttribute('aria-expanded'));
120
120
  expect(ariaExpandedOption1).toBe('false');
121
121
  });
122
122
 
123
123
  it('then the unchecked radio aria-expanded attribute of "open" radio should not be set', async () => {
124
- const hasAriaExpanded = await page.$eval('#text', node => node.hasAttribute('aria-expanded'));
124
+ const hasAriaExpanded = await page.$eval('#text', (node) => node.hasAttribute('aria-expanded'));
125
125
  expect(hasAriaExpanded).toBe(false);
126
126
  });
127
127
  });
@@ -129,30 +129,30 @@ describe('script: radios', () => {
129
129
 
130
130
  describe('the clear button is clicked', () => {
131
131
  beforeEach(async () => {
132
- await page.$eval('.ons-js-clear-btn', node => node.click());
132
+ await page.$eval('.ons-js-clear-btn', (node) => node.click());
133
133
  });
134
134
 
135
135
  it('then the clear button should not be visible', async () => {
136
- const isHidden = await page.$eval('.ons-js-clear-btn', node => node.classList.contains('ons-u-db-no-js_enabled'));
136
+ const isHidden = await page.$eval('.ons-js-clear-btn', (node) => node.classList.contains('ons-u-db-no-js_enabled'));
137
137
  expect(isHidden).toBe(true);
138
138
  });
139
139
 
140
140
  it('then the aria live message should announce that the answer has been cleared', async () => {
141
- const alertText = await page.$eval('.ons-js-clear-radio-alert', node => node.innerHTML);
141
+ const alertText = await page.$eval('.ons-js-clear-radio-alert', (node) => node.innerHTML);
142
142
  expect(alertText).toBe('You have cleared your answer');
143
143
  });
144
144
 
145
145
  it('then all radios should not be checked', async () => {
146
- const checkedRadios = await page.$$eval('.ons-js-radio', nodes => nodes.map(node => node.checked));
146
+ const checkedRadios = await page.$$eval('.ons-js-radio', (nodes) => nodes.map((node) => node.checked));
147
147
  expect(checkedRadios).not.toContain(true);
148
148
  });
149
149
 
150
150
  it('then all other input fields should be empty', async () => {
151
- const emailOtherValue = await page.$eval('#email-other', node => node.value);
151
+ const emailOtherValue = await page.$eval('#email-other', (node) => node.value);
152
152
  expect(emailOtherValue).toBe('');
153
- const telOtherValue = await page.$eval('#tel-other', node => node.value);
153
+ const telOtherValue = await page.$eval('#tel-other', (node) => node.value);
154
154
  expect(telOtherValue).toBe('');
155
- const textOtherValue = await page.$eval('#text-other', node => node.value);
155
+ const textOtherValue = await page.$eval('#text-other', (node) => node.value);
156
156
  expect(textOtherValue).toBe('');
157
157
  });
158
158
  });
@@ -163,7 +163,7 @@ describe('script: radios', () => {
163
163
  });
164
164
 
165
165
  it('then the radio button should be checked', async () => {
166
- const isRadioChecked = await page.$eval('#text', node => node.checked);
166
+ const isRadioChecked = await page.$eval('#text', (node) => node.checked);
167
167
  expect(isRadioChecked).toBe(true);
168
168
  });
169
169
  });
@@ -174,13 +174,13 @@ describe('script: radios', () => {
174
174
  });
175
175
 
176
176
  it('then the input should have a tab index of 0', async () => {
177
- const tabIndex = await page.$eval('#text-other', node => node.getAttribute('tabindex'));
177
+ const tabIndex = await page.$eval('#text-other', (node) => node.getAttribute('tabindex'));
178
178
  expect(tabIndex).toBe('0');
179
179
  });
180
180
  });
181
181
  });
182
182
 
183
- describe('reveal and fieldset', function() {
183
+ describe('reveal and fieldset', function () {
184
184
  const params = {
185
185
  legend: 'What are your favourite pizza toppings?',
186
186
  name: 'food-other',
@@ -237,7 +237,7 @@ describe('script: radios', () => {
237
237
  });
238
238
 
239
239
  it('radios with other options should be given aria-expanded attributes', async () => {
240
- const ariaExpanded = await page.$eval('#other-radio', node => node.getAttribute('aria-expanded'));
240
+ const ariaExpanded = await page.$eval('#other-radio', (node) => node.getAttribute('aria-expanded'));
241
241
  expect(ariaExpanded).toBe('false');
242
242
  });
243
243
 
@@ -247,7 +247,7 @@ describe('script: radios', () => {
247
247
  });
248
248
 
249
249
  it('has aria-expanded attribute should be set to true', async () => {
250
- const ariaExpanded = await page.$eval('#other-radio', node => node.getAttribute('aria-expanded'));
250
+ const ariaExpanded = await page.$eval('#other-radio', (node) => node.getAttribute('aria-expanded'));
251
251
  expect(ariaExpanded).toBe('true');
252
252
  });
253
253
 
@@ -257,7 +257,7 @@ describe('script: radios', () => {
257
257
  });
258
258
 
259
259
  it('the radio with an other input aria-expanded attribute changes', async () => {
260
- const ariaExpanded = await page.$eval('#other-radio', node => node.getAttribute('aria-expanded'));
260
+ const ariaExpanded = await page.$eval('#other-radio', (node) => node.getAttribute('aria-expanded'));
261
261
  expect(ariaExpanded).toBe('false');
262
262
  });
263
263
  });
@@ -273,12 +273,12 @@ describe('script: radios', () => {
273
273
  });
274
274
 
275
275
  it('the other radio aria-expanded attribute should be set to false', async () => {
276
- const ariaExpanded = await page.$eval('#other-radio', node => node.getAttribute('aria-expanded'));
276
+ const ariaExpanded = await page.$eval('#other-radio', (node) => node.getAttribute('aria-expanded'));
277
277
  expect(ariaExpanded).toBe('false');
278
278
  });
279
279
 
280
280
  it('the child of other checkbox should be unchecked', async () => {
281
- const innerInputChecked = await page.$eval('#inner-bacon-other', node => node.checked);
281
+ const innerInputChecked = await page.$eval('#inner-bacon-other', (node) => node.checked);
282
282
  expect(innerInputChecked).toBe(false);
283
283
  });
284
284
  });
@@ -82,9 +82,7 @@ describe('macro: related-content', () => {
82
82
  it('calls with content', () => {
83
83
  const $ = cheerio.load(renderComponent('related-content', { EXAMPLE_RELATED_CONTENT_GENERAL }, 'Example content...'));
84
84
 
85
- const content = $('.ons-related-content')
86
- .text()
87
- .trim();
85
+ const content = $('.ons-related-content').text().trim();
88
86
  expect(content).toEqual(expect.stringContaining('Example content...'));
89
87
  });
90
88
  });
@@ -105,7 +103,7 @@ describe('macro: related-content', () => {
105
103
  it('has the `aria-labelledby` attribute for each section of links', () => {
106
104
  const $ = cheerio.load(renderComponent('related-content', EXAMPLE_RELATED_CONTENT_LINKS));
107
105
 
108
- const values = mapAll($('.ons-related-content__navigation'), node => node.attr('aria-labelledby'));
106
+ const values = mapAll($('.ons-related-content__navigation'), (node) => node.attr('aria-labelledby'));
109
107
  expect(values).toEqual(['related-articles', 'related-links']);
110
108
  });
111
109
 
@@ -20,11 +20,7 @@ describe('macro: related-content/section', () => {
20
20
 
21
21
  it('has the provided `title` text', () => {
22
22
  const $ = cheerio.load(renderComponent('related-content/section', EXAMPLE_RELATED_SECTION_CONTENT));
23
- expect(
24
- $('.ons-related-content__title')
25
- .text()
26
- .trim(),
27
- ).toEqual('Related information');
23
+ expect($('.ons-related-content__title').text().trim()).toEqual('Related information');
28
24
  });
29
25
 
30
26
  it('has the `id` attribute for the title', () => {
@@ -35,9 +31,7 @@ describe('macro: related-content/section', () => {
35
31
  it('has the provided content', () => {
36
32
  const $ = cheerio.load(renderComponent('related-content/section', { EXAMPLE_RELATED_SECTION_CONTENT }, 'Example content...'));
37
33
 
38
- const content = $('.ons-related-content__content')
39
- .text()
40
- .trim();
34
+ const content = $('.ons-related-content__content').text().trim();
41
35
  expect(content).toEqual(expect.stringContaining('Example content...'));
42
36
  });
43
37
  });
@@ -25,24 +25,22 @@ layout: ~
25
25
 
26
26
  {% block main %}
27
27
 
28
- {% call
29
- onsPanel({
30
- title: "There is a problem with your answer",
31
- type: "error"
32
- })
33
- %}
34
- {{
35
- onsList({
36
- "element": "ol",
37
- "itemsList": [
38
- {
39
- "text": "Select a relationship",
40
- "url": "#relationship-error",
41
- "variants": "inPageLink"
42
- }
43
- ]
44
- })
45
- }}
28
+ {% call onsPanel({
29
+ "title": "There is a problem with your answer",
30
+ "variant": "error"
31
+ }) %}
32
+ {{
33
+ onsList({
34
+ "element": "ol",
35
+ "itemsList": [
36
+ {
37
+ "text": "Select a relationship",
38
+ "url": "#relationship-error",
39
+ "variants": "inPageLink"
40
+ }
41
+ ]
42
+ })
43
+ }}
46
44
  {% endcall %}
47
45
  {% call onsQuestion({
48
46
  "title": "Thinking of Joe Bloggs, Amanda Bloggs is their <strong>…</strong>",
@@ -6,6 +6,6 @@ domready(async () => {
6
6
  if (relationships.length) {
7
7
  const Relationships = (await import('./relationships')).default;
8
8
 
9
- relationships.forEach(element => new Relationships(element));
9
+ relationships.forEach((element) => new Relationships(element));
10
10
  }
11
11
  });
@@ -7,7 +7,7 @@ export default class Relationships {
7
7
  this.radios = [...context.querySelectorAll('input[type=radio]')];
8
8
  this.playback = context.querySelector('.ons-js-relationships-playback');
9
9
 
10
- this.radios.forEach(radio => radio.addEventListener('change', this.setPlayback.bind(this)));
10
+ this.radios.forEach((radio) => radio.addEventListener('change', this.setPlayback.bind(this)));
11
11
 
12
12
  this.setPlayback();
13
13
 
@@ -15,7 +15,7 @@ export default class Relationships {
15
15
  }
16
16
 
17
17
  setPlayback() {
18
- const radio = this.radios.find(radio => radio.checked);
18
+ const radio = this.radios.find((radio) => radio.checked);
19
19
 
20
20
  if (radio) {
21
21
  const title = radio.getAttribute('data-title');
@@ -13,9 +13,9 @@ const EXAMPLE_TEXTAREA = {
13
13
  description: 'Reply description',
14
14
  },
15
15
  charCheckLimit: {
16
- limit: 300,
17
- charCountSingular: '{x} more character needed',
18
- charCountPlural: '{x} more characters needed',
16
+ limit: 300,
17
+ charCountSingular: '{x} more character needed',
18
+ charCountPlural: '{x} more characters needed',
19
19
  },
20
20
  rows: 5,
21
21
  };
@@ -6,7 +6,7 @@ async function initialise() {
6
6
  if (replyInputs.length) {
7
7
  const ReplyInput = (await import('./reply-input')).default;
8
8
 
9
- replyInputs.forEach(input => new ReplyInput(input));
9
+ replyInputs.forEach((input) => new ReplyInput(input));
10
10
  }
11
11
  }
12
12
 
@@ -29,7 +29,7 @@ describe('script: reply', () => {
29
29
 
30
30
  it('the button has classes applied', async () => {
31
31
  await setTestPage('/test', renderComponent('reply', EXAMPLE_REPLY));
32
- const disabledButton = await page.$eval('#reply-button', element => element.classList.contains('ons-btn--disabled'));
32
+ const disabledButton = await page.$eval('#reply-button', (element) => element.classList.contains('ons-btn--disabled'));
33
33
  expect(disabledButton).toBe(true);
34
34
  });
35
35
  });
@@ -49,7 +49,7 @@ describe('script: reply', () => {
49
49
  await page.focus('#reply-textarea');
50
50
  await page.keyboard.type('Sausages');
51
51
 
52
- const disabledButton = await page.$eval('#reply-button', element => element.classList.contains('ons-btn--disabled'));
52
+ const disabledButton = await page.$eval('#reply-button', (element) => element.classList.contains('ons-btn--disabled'));
53
53
  expect(disabledButton).toBe(false);
54
54
  });
55
55
  });
@@ -71,7 +71,7 @@ describe('script: reply', () => {
71
71
  await page.keyboard.type('s');
72
72
  await page.keyboard.press('Backspace');
73
73
 
74
- const disabledButton = await page.$eval('#reply-button', element => element.classList.contains('ons-btn--disabled'));
74
+ const disabledButton = await page.$eval('#reply-button', (element) => element.classList.contains('ons-btn--disabled'));
75
75
  expect(disabledButton).toBe(true);
76
76
  });
77
77
  });