@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
@@ -25,12 +25,12 @@ describe('script: modal', () => {
25
25
  });
26
26
 
27
27
  it('displays the modal', async () => {
28
- const modalIsVisible = await page.$eval('.ons-modal', node => node.classList.contains('ons-u-db'));
28
+ const modalIsVisible = await page.$eval('.ons-modal', (node) => node.classList.contains('ons-u-db'));
29
29
  expect(modalIsVisible).toBe(true);
30
30
  });
31
31
 
32
32
  it('has the correct body class added', async () => {
33
- const bodyClassAddition = await page.$eval('body', node => node.classList.contains('ons-modal-overlay'));
33
+ const bodyClassAddition = await page.$eval('body', (node) => node.classList.contains('ons-modal-overlay'));
34
34
  expect(bodyClassAddition).toBe(true);
35
35
  });
36
36
 
@@ -41,12 +41,12 @@ describe('script: modal', () => {
41
41
  });
42
42
 
43
43
  it('hides the modal', async () => {
44
- const modalIsVisible = await page.$eval('.ons-modal', node => node.classList.contains('ons-u-db'));
44
+ const modalIsVisible = await page.$eval('.ons-modal', (node) => node.classList.contains('ons-u-db'));
45
45
  expect(modalIsVisible).toBe(false);
46
46
  });
47
47
 
48
48
  it('has the body class removed', async () => {
49
- const bodyClassAddition = await page.$eval('body', node => node.classList.contains('ons-modal-overlay'));
49
+ const bodyClassAddition = await page.$eval('body', (node) => node.classList.contains('ons-modal-overlay'));
50
50
  expect(bodyClassAddition).toBe(false);
51
51
  });
52
52
 
@@ -64,7 +64,7 @@ describe('script: modal', () => {
64
64
  });
65
65
 
66
66
  it('closes the modal', async () => {
67
- const modalIsVisible = await page.$eval('.ons-modal', node => node.classList.contains('ons-u-db'));
67
+ const modalIsVisible = await page.$eval('.ons-modal', (node) => node.classList.contains('ons-u-db'));
68
68
  expect(modalIsVisible).toBe(false);
69
69
  });
70
70
  });
@@ -123,11 +123,7 @@ describe('macro: mutually-exclusive', () => {
123
123
  it('renders visually hidden "Or" label', () => {
124
124
  const $ = cheerio.load(renderComponent('mutually-exclusive', EXAMPLE_MUTUALLY_EXCLUSIVE, FAKE_FIELD));
125
125
 
126
- expect(
127
- $('.ons-checkboxes__label')
128
- .text()
129
- .trim(),
130
- ).toBe('Or');
126
+ expect($('.ons-checkboxes__label').text().trim()).toBe('Or');
131
127
  });
132
128
 
133
129
  it('renders a checkbox component with the expected parameters', () => {
@@ -159,11 +155,7 @@ describe('macro: mutually-exclusive', () => {
159
155
  it('renders visually hidden "Or" label', () => {
160
156
  const $ = cheerio.load(renderComponent('mutually-exclusive', EXAMPLE_MUTUALLY_EXCLUSIVE_RADIOS, FAKE_FIELD));
161
157
 
162
- expect(
163
- $('.ons-checkboxes__label')
164
- .text()
165
- .trim(),
166
- ).toBe('Or');
158
+ expect($('.ons-checkboxes__label').text().trim()).toBe('Or');
167
159
  });
168
160
 
169
161
  it('renders a radios component with the expected parameters', () => {
@@ -80,22 +80,22 @@ describe('script: mutually-exclusive', () => {
80
80
  });
81
81
 
82
82
  it('then the mutually exclusive option is checked', async () => {
83
- const isChecked = await page.$eval('#no-central-heating', node => node.checked);
83
+ const isChecked = await page.$eval('#no-central-heating', (node) => node.checked);
84
84
  expect(isChecked).toBe(true);
85
85
  });
86
86
 
87
87
  it('then the checkboxes are not checked', async () => {
88
- expect(await page.$eval('#gas', node => node.checked)).toBe(false);
89
- expect(await page.$eval('#electric', node => node.checked)).toBe(false);
90
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
91
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(false);
92
- expect(await page.$eval('#other-fuel-textbox', node => node.value)).toBe('');
88
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(false);
89
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(false);
90
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
91
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(false);
92
+ expect(await page.$eval('#other-fuel-textbox', (node) => node.value)).toBe('');
93
93
  });
94
94
 
95
95
  it('then the aria-live message should reflect the removed non exclusive options', async () => {
96
96
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
97
97
 
98
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
98
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
99
99
  expect(alertText).toBe('Gas deselected. Electric deselected. Other deselected. Please specify deselected.');
100
100
  });
101
101
  });
@@ -114,20 +114,20 @@ describe('script: mutually-exclusive', () => {
114
114
  });
115
115
 
116
116
  it('then the expected checkboxes are checked', async () => {
117
- expect(await page.$eval('#gas', node => node.checked)).toBe(true);
118
- expect(await page.$eval('#electric', node => node.checked)).toBe(true);
119
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
120
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(true);
117
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(true);
118
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(true);
119
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
120
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(true);
121
121
  });
122
122
 
123
123
  it('then the exclusive option should not be checked', async () => {
124
- expect(await page.$eval('#no-central-heating', node => node.checked)).toBe(false);
124
+ expect(await page.$eval('#no-central-heating', (node) => node.checked)).toBe(false);
125
125
  });
126
126
 
127
127
  it('then the aria-live message should reflect the removed exclusive option', async () => {
128
128
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
129
129
 
130
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
130
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
131
131
  expect(alertText).toBe('No central heating deselected.');
132
132
  });
133
133
 
@@ -139,7 +139,7 @@ describe('script: mutually-exclusive', () => {
139
139
  it('the aria-live message should not be updated', async () => {
140
140
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
141
141
 
142
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
142
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
143
143
  expect(alertText).toBe('No central heating deselected.');
144
144
  });
145
145
  });
@@ -155,20 +155,20 @@ describe('script: mutually-exclusive', () => {
155
155
  });
156
156
 
157
157
  it('then the expected checkboxes are checked', async () => {
158
- expect(await page.$eval('#gas', node => node.checked)).toBe(true);
159
- expect(await page.$eval('#electric', node => node.checked)).toBe(true);
160
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
161
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(true);
158
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(true);
159
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(true);
160
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
161
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(true);
162
162
  });
163
163
 
164
164
  it('then the exclusive option should not be checked', async () => {
165
- expect(await page.$eval('#no-central-heating', node => node.checked)).toBe(false);
165
+ expect(await page.$eval('#no-central-heating', (node) => node.checked)).toBe(false);
166
166
  });
167
167
 
168
168
  it('then the aria-live message should say nothing', async () => {
169
169
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
170
170
 
171
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
171
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
172
172
  expect(alertText).toBe('');
173
173
  });
174
174
  });
@@ -181,20 +181,20 @@ describe('script: mutually-exclusive', () => {
181
181
  });
182
182
 
183
183
  it('then the expected checkboxes are not checked', async () => {
184
- expect(await page.$eval('#gas', node => node.checked)).toBe(false);
185
- expect(await page.$eval('#electric', node => node.checked)).toBe(false);
186
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
187
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(false);
184
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(false);
185
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(false);
186
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
187
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(false);
188
188
  });
189
189
 
190
190
  it('then the exclusive option should be checked', async () => {
191
- expect(await page.$eval('#no-central-heating', node => node.checked)).toBe(true);
191
+ expect(await page.$eval('#no-central-heating', (node) => node.checked)).toBe(true);
192
192
  });
193
193
 
194
194
  it('then the aria-live message should say nothing', async () => {
195
195
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
196
196
 
197
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
197
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
198
198
  expect(alertText).toBe('');
199
199
  });
200
200
  });
@@ -61,23 +61,23 @@ describe('script: mutually-exclusive', () => {
61
61
  });
62
62
 
63
63
  it('then the mutually exclusive option should be checked', async () => {
64
- const isChecked = await page.$eval('#date-exclusive-exclusive-option', node => node.checked);
64
+ const isChecked = await page.$eval('#date-exclusive-exclusive-option', (node) => node.checked);
65
65
  expect(isChecked).toBe(true);
66
66
  });
67
67
 
68
68
  it('then the date input should be cleared', async () => {
69
- const dayValue = await page.$eval('#date-mutually-exclusive-day', node => node.value);
69
+ const dayValue = await page.$eval('#date-mutually-exclusive-day', (node) => node.value);
70
70
  expect(dayValue).toBe('');
71
- const monthValue = await page.$eval('#date-mutually-exclusive-month', node => node.value);
71
+ const monthValue = await page.$eval('#date-mutually-exclusive-month', (node) => node.value);
72
72
  expect(monthValue).toBe('');
73
- const yearValue = await page.$eval('#date-mutually-exclusive-year', node => node.value);
73
+ const yearValue = await page.$eval('#date-mutually-exclusive-year', (node) => node.value);
74
74
  expect(yearValue).toBe('');
75
75
  });
76
76
 
77
77
  it('then the aria alert should tell the user that the date input has been cleared', async () => {
78
78
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
79
79
 
80
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
80
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
81
81
  expect(alertText).toBe('Day cleared. Month cleared. Year cleared.');
82
82
  });
83
83
  });
@@ -96,14 +96,14 @@ describe('script: mutually-exclusive', () => {
96
96
  });
97
97
 
98
98
  it('then the mutually exclusive option should be checked', async () => {
99
- const isChecked = await page.$eval('#date-exclusive-exclusive-option', node => node.checked);
99
+ const isChecked = await page.$eval('#date-exclusive-exclusive-option', (node) => node.checked);
100
100
  expect(isChecked).toBe(false);
101
101
  });
102
102
 
103
103
  it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
104
104
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
105
105
 
106
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
106
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
107
107
  expect(alertText).toBe('I have never had a paid job deselected.');
108
108
  });
109
109
  });
@@ -120,7 +120,7 @@ describe('script: mutually-exclusive', () => {
120
120
  it('then the aria alert shouldnt say anything', async () => {
121
121
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
122
122
 
123
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
123
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
124
124
  expect(alertText).toBe('');
125
125
  });
126
126
  });
@@ -133,7 +133,7 @@ describe('script: mutually-exclusive', () => {
133
133
  it('then the aria alert shouldnt say anything', async () => {
134
134
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
135
135
 
136
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
136
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
137
137
  expect(alertText).toBe('');
138
138
  });
139
139
  });
@@ -8,7 +8,7 @@ async function mutuallyExclusiveInputs() {
8
8
  if (exclusiveWrapperElements.length) {
9
9
  const MutuallyExclusive = (await import('./mutually-exclusive')).default;
10
10
 
11
- exclusiveWrapperElements.forEach(element => new MutuallyExclusive(element));
11
+ exclusiveWrapperElements.forEach((element) => new MutuallyExclusive(element));
12
12
  }
13
13
  }
14
14
 
@@ -66,21 +66,21 @@ describe('script: mutually-exclusive', () => {
66
66
  });
67
67
 
68
68
  it('then the mutually exclusive option should be checked', async () => {
69
- const isChecked = await page.$eval('#duration-exclusive-option', node => node.checked);
69
+ const isChecked = await page.$eval('#duration-exclusive-option', (node) => node.checked);
70
70
  expect(isChecked).toBe(true);
71
71
  });
72
72
 
73
73
  it('then the inputs should be cleared', async () => {
74
- const yearsValue = await page.$eval('#address-duration-years', node => node.value);
74
+ const yearsValue = await page.$eval('#address-duration-years', (node) => node.value);
75
75
  expect(yearsValue).toBe('');
76
- const monthsValue = await page.$eval('#address-duration-months', node => node.value);
76
+ const monthsValue = await page.$eval('#address-duration-months', (node) => node.value);
77
77
  expect(monthsValue).toBe('');
78
78
  });
79
79
 
80
80
  it('then the aria alert should tell the user that the inputs have been cleared', async () => {
81
81
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
82
82
 
83
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
83
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
84
84
  expect(alertText).toBe('Years cleared. Months cleared.');
85
85
  });
86
86
  });
@@ -98,14 +98,14 @@ describe('script: mutually-exclusive', () => {
98
98
  });
99
99
 
100
100
  it('then the exclusive option should be unchecked', async () => {
101
- const isChecked = await page.$eval('#duration-exclusive-option', node => node.checked);
101
+ const isChecked = await page.$eval('#duration-exclusive-option', (node) => node.checked);
102
102
  expect(isChecked).toBe(false);
103
103
  });
104
104
 
105
105
  it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
106
106
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
107
107
 
108
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
108
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
109
109
  expect(alertText).toBe('I have not moved in to this address yet deselected.');
110
110
  });
111
111
  });
@@ -121,7 +121,7 @@ describe('script: mutually-exclusive', () => {
121
121
  it('then the aria alert shouldnt say anything', async () => {
122
122
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
123
123
 
124
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
124
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
125
125
  expect(alertText).toBe('');
126
126
  });
127
127
  });
@@ -134,7 +134,7 @@ describe('script: mutually-exclusive', () => {
134
134
  it('then the aria alert shouldnt say anything', async () => {
135
135
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
136
136
 
137
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
137
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
138
138
  expect(alertText).toBe('');
139
139
  });
140
140
  });
@@ -44,19 +44,19 @@ describe('script: mutually-exclusive', () => {
44
44
  });
45
45
 
46
46
  it('then the mutually exclusive option should be checked', async () => {
47
- const isChecked = await page.$eval('#email-exclusive-option', node => node.checked);
47
+ const isChecked = await page.$eval('#email-exclusive-option', (node) => node.checked);
48
48
  expect(isChecked).toBe(true);
49
49
  });
50
50
 
51
51
  it('then the email input should be cleared', async () => {
52
- const inputValue = await page.$eval('#email', node => node.value);
52
+ const inputValue = await page.$eval('#email', (node) => node.value);
53
53
  expect(inputValue).toBe('');
54
54
  });
55
55
 
56
56
  it('then the aria alert should tell the user that the email input has been cleared', async () => {
57
57
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
58
58
 
59
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
59
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
60
60
  expect(alertText).toBe('Enter an email cleared.');
61
61
  });
62
62
  });
@@ -73,14 +73,14 @@ describe('script: mutually-exclusive', () => {
73
73
  });
74
74
 
75
75
  it('then the exclusive option should be unchecked', async () => {
76
- const isChecked = await page.$eval('#email-exclusive-option', node => node.checked);
76
+ const isChecked = await page.$eval('#email-exclusive-option', (node) => node.checked);
77
77
  expect(isChecked).toBe(false);
78
78
  });
79
79
 
80
80
  it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
81
81
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
82
82
 
83
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
83
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
84
84
  expect(alertText).toBe('I dont want to receive a confirmation email deselected.');
85
85
  });
86
86
  });
@@ -95,7 +95,7 @@ describe('script: mutually-exclusive', () => {
95
95
  it('then the aria alert shouldnt say anything', async () => {
96
96
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
97
97
 
98
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
98
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
99
99
  expect(alertText).toBe('');
100
100
  });
101
101
  });
@@ -108,7 +108,7 @@ describe('script: mutually-exclusive', () => {
108
108
  it('then the aria alert shouldnt say anything', async () => {
109
109
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
110
110
 
111
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
111
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
112
112
  expect(alertText).toBe('');
113
113
  });
114
114
  });
@@ -12,7 +12,7 @@ export default class MutuallyExclusive {
12
12
 
13
13
  const groupInputs = [...context.getElementsByClassName(exclusiveGroupItemClass)];
14
14
  this.numberOfGroupInputs = groupInputs.length;
15
- this.groupInputs = groupInputs.map(element => ({
15
+ this.groupInputs = groupInputs.map((element) => ({
16
16
  element,
17
17
  labelText: this.getElementLabelText(element),
18
18
  hasValue: this.inputHasValue(element),
@@ -21,7 +21,7 @@ export default class MutuallyExclusive {
21
21
 
22
22
  const exclusiveElements = [...context.getElementsByClassName(optionClass)];
23
23
  this.numberOfExclusiveElements = exclusiveElements.length;
24
- this.exclusiveElements = exclusiveElements.map(element => ({
24
+ this.exclusiveElements = exclusiveElements.map((element) => ({
25
25
  element,
26
26
  label: context.querySelector(`label[for=${element.id}]`),
27
27
  labelText: this.getElementLabelText(element),
@@ -39,14 +39,14 @@ export default class MutuallyExclusive {
39
39
  }
40
40
 
41
41
  bindEventListeners() {
42
- this.allInputs.forEach(input => {
42
+ this.allInputs.forEach((input) => {
43
43
  const event = ['checkbox', 'radio'].includes(input.element.type) ? 'click' : 'input';
44
44
  input.element.addEventListener(event, () => this.handleValueChange(input));
45
45
  });
46
46
  }
47
47
 
48
48
  handleValueChange(input) {
49
- const previousSelectedValues = this.allInputs.filter(input => input.hasValue).map(input => input.labelText);
49
+ const previousSelectedValues = this.allInputs.filter((input) => input.hasValue).map((input) => input.labelText);
50
50
  let adjective;
51
51
 
52
52
  input.hasValue = this.inputHasValue(input.element);
@@ -57,8 +57,8 @@ export default class MutuallyExclusive {
57
57
  adjective = this.groupAdjective;
58
58
 
59
59
  this.allInputs
60
- .filter(input => !input.exclusive)
61
- .forEach(input => {
60
+ .filter((input) => !input.exclusive)
61
+ .forEach((input) => {
62
62
  input.hasValue = false;
63
63
 
64
64
  if (['checkbox', 'radio'].includes(input.element.type)) {
@@ -70,10 +70,10 @@ export default class MutuallyExclusive {
70
70
  }
71
71
  });
72
72
  } else if (!input.exclusive) {
73
- const inputs = this.allInputs.filter(input => input.exclusive);
73
+ const inputs = this.allInputs.filter((input) => input.exclusive);
74
74
  adjective = this.optionAttrAdjective;
75
75
 
76
- inputs.forEach(input => {
76
+ inputs.forEach((input) => {
77
77
  input.hasValue = false;
78
78
  input.element.checked = false;
79
79
  });
@@ -81,8 +81,8 @@ export default class MutuallyExclusive {
81
81
  this.triggerEvent(input.element, 'change');
82
82
  }
83
83
 
84
- const updatedSelectedValues = this.allInputs.filter(input => input.hasValue).map(input => input.labelText);
85
- const deselectedValues = previousSelectedValues.filter(labelText => !updatedSelectedValues.includes(labelText));
84
+ const updatedSelectedValues = this.allInputs.filter((input) => input.hasValue).map((input) => input.labelText);
85
+ const deselectedValues = previousSelectedValues.filter((labelText) => !updatedSelectedValues.includes(labelText));
86
86
 
87
87
  this.setDeselectMessage();
88
88
 
@@ -113,7 +113,7 @@ export default class MutuallyExclusive {
113
113
  } else if (label.classList.contains(inputLegendClass) && label.querySelector('h1')) {
114
114
  labelText = label.querySelector('h1').innerText;
115
115
  } else {
116
- labelText = [...label.childNodes].filter(node => node.nodeType === 3 && node.textContent.trim())[0].textContent.trim();
116
+ labelText = [...label.childNodes].filter((node) => node.nodeType === 3 && node.textContent.trim())[0].textContent.trim();
117
117
  }
118
118
  }
119
119
 
@@ -129,7 +129,7 @@ export default class MutuallyExclusive {
129
129
  }
130
130
 
131
131
  setAriaLive(deselectedValues, adjective) {
132
- const deselectionMessage = deselectedValues.map(label => `${label} ${adjective}.`).join(' ');
132
+ const deselectionMessage = deselectedValues.map((label) => `${label} ${adjective}.`).join(' ');
133
133
 
134
134
  // Only update aria-live if value changes to prevent typing from clearing the message before it's read
135
135
  if (deselectionMessage) {
@@ -138,7 +138,7 @@ export default class MutuallyExclusive {
138
138
  }
139
139
 
140
140
  setDeselectMessage() {
141
- const groupElementSelected = this.groupInputs.find(input => input.hasValue);
141
+ const groupElementSelected = this.groupInputs.find((input) => input.hasValue);
142
142
 
143
143
  if (!this.deselectMessageElement && groupElementSelected) {
144
144
  const deselectMessageElement = document.createElement('span');
@@ -87,22 +87,22 @@ describe('script: mutually-exclusive', () => {
87
87
  });
88
88
 
89
89
  it('then the mutually exclusive option is checked', async () => {
90
- const isChecked = await page.$eval('#dont-know', node => node.checked);
90
+ const isChecked = await page.$eval('#dont-know', (node) => node.checked);
91
91
  expect(isChecked).toBe(true);
92
92
  });
93
93
 
94
94
  it('then the checkboxes are not checked', async () => {
95
- expect(await page.$eval('#gas', node => node.checked)).toBe(false);
96
- expect(await page.$eval('#electric', node => node.checked)).toBe(false);
97
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
98
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(false);
99
- expect(await page.$eval('#other-fuel-textbox', node => node.value)).toBe('');
95
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(false);
96
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(false);
97
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
98
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(false);
99
+ expect(await page.$eval('#other-fuel-textbox', (node) => node.value)).toBe('');
100
100
  });
101
101
 
102
102
  it('then the aria-live message should reflect the removed non exclusive options', async () => {
103
103
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
104
104
 
105
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
105
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
106
106
  expect(alertText).toBe('Gas deselected. Electric deselected. Other deselected. Please specify deselected.');
107
107
  });
108
108
  });
@@ -121,21 +121,21 @@ describe('script: mutually-exclusive', () => {
121
121
  });
122
122
 
123
123
  it('then the expected checkboxes are checked', async () => {
124
- expect(await page.$eval('#gas', node => node.checked)).toBe(true);
125
- expect(await page.$eval('#electric', node => node.checked)).toBe(true);
126
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
127
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(true);
124
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(true);
125
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(true);
126
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
127
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(true);
128
128
  });
129
129
 
130
130
  it('then the exclusive options should not be checked', async () => {
131
- expect(await page.$eval('#no-central-heating', node => node.checked)).toBe(false);
132
- expect(await page.$eval('#dont-know', node => node.checked)).toBe(false);
131
+ expect(await page.$eval('#no-central-heating', (node) => node.checked)).toBe(false);
132
+ expect(await page.$eval('#dont-know', (node) => node.checked)).toBe(false);
133
133
  });
134
134
 
135
135
  it('then the aria-live message should reflect the removed exclusive option', async () => {
136
136
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
137
137
 
138
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
138
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
139
139
  expect(alertText).toBe('Dont know deselected.');
140
140
  });
141
141
 
@@ -147,7 +147,7 @@ describe('script: mutually-exclusive', () => {
147
147
  it('the aria-live message should not be updated', async () => {
148
148
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
149
149
 
150
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
150
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
151
151
  expect(alertText).toBe('Dont know deselected.');
152
152
  });
153
153
  });
@@ -163,21 +163,21 @@ describe('script: mutually-exclusive', () => {
163
163
  });
164
164
 
165
165
  it('then the expected checkboxes are checked', async () => {
166
- expect(await page.$eval('#gas', node => node.checked)).toBe(true);
167
- expect(await page.$eval('#electric', node => node.checked)).toBe(true);
168
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
169
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(true);
166
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(true);
167
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(true);
168
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
169
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(true);
170
170
  });
171
171
 
172
172
  it('then the exclusive options should not be checked', async () => {
173
- expect(await page.$eval('#no-central-heating', node => node.checked)).toBe(false);
174
- expect(await page.$eval('#dont-know', node => node.checked)).toBe(false);
173
+ expect(await page.$eval('#no-central-heating', (node) => node.checked)).toBe(false);
174
+ expect(await page.$eval('#dont-know', (node) => node.checked)).toBe(false);
175
175
  });
176
176
 
177
177
  it('then the aria-live message should say nothing', async () => {
178
178
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
179
179
 
180
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
180
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
181
181
  expect(alertText).toBe('');
182
182
  });
183
183
  });
@@ -190,21 +190,21 @@ describe('script: mutually-exclusive', () => {
190
190
  });
191
191
 
192
192
  it('then the expected checkboxes are not checked', async () => {
193
- expect(await page.$eval('#gas', node => node.checked)).toBe(false);
194
- expect(await page.$eval('#electric', node => node.checked)).toBe(false);
195
- expect(await page.$eval('#solid-fuel', node => node.checked)).toBe(false);
196
- expect(await page.$eval('#other-fuel', node => node.checked)).toBe(false);
193
+ expect(await page.$eval('#gas', (node) => node.checked)).toBe(false);
194
+ expect(await page.$eval('#electric', (node) => node.checked)).toBe(false);
195
+ expect(await page.$eval('#solid-fuel', (node) => node.checked)).toBe(false);
196
+ expect(await page.$eval('#other-fuel', (node) => node.checked)).toBe(false);
197
197
  });
198
198
 
199
199
  it('then the exclusive option should be checked', async () => {
200
- expect(await page.$eval('#no-central-heating', node => node.checked)).toBe(false);
201
- expect(await page.$eval('#dont-know', node => node.checked)).toBe(true);
200
+ expect(await page.$eval('#no-central-heating', (node) => node.checked)).toBe(false);
201
+ expect(await page.$eval('#dont-know', (node) => node.checked)).toBe(true);
202
202
  });
203
203
 
204
204
  it('then the aria-live message should say nothing', async () => {
205
205
  await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
206
206
 
207
- const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
207
+ const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
208
208
  expect(alertText).toBe('');
209
209
  });
210
210
  });