@ons/design-system 68.0.0 → 68.0.1

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 (199) hide show
  1. package/README.md +6 -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.scss +1 -1
  16. package/components/autosuggest/autosuggest.dom.js +1 -1
  17. package/components/autosuggest/autosuggest.helpers.js +1 -1
  18. package/components/back-to-top/_back-to-top.scss +34 -0
  19. package/components/back-to-top/_macro.njk +17 -0
  20. package/components/back-to-top/_macro.spec.js +60 -0
  21. package/components/back-to-top/back-to-top.dom.js +12 -0
  22. package/components/back-to-top/back-to-top.js +58 -0
  23. package/components/back-to-top/back-to-top.spec.js +117 -0
  24. package/components/back-to-top/example-back-to-top.njk +37 -0
  25. package/components/back-to-top/example-full-page-back-to-top.njk +192 -0
  26. package/components/browser-banner/_macro.spec.js +4 -12
  27. package/components/button/_macro.njk +6 -6
  28. package/components/button/_macro.spec.js +1 -5
  29. package/components/button/button.js +7 -8
  30. package/components/button/button.spec.js +17 -39
  31. package/components/call-to-action/_macro.spec.js +2 -6
  32. package/components/card/_macro.njk +25 -25
  33. package/components/card/_macro.spec.js +10 -34
  34. package/components/char-check-limit/_macro.njk +1 -1
  35. package/components/char-check-limit/_macro.spec.js +3 -7
  36. package/components/char-check-limit/character-check.spec.js +24 -20
  37. package/components/checkboxes/_checkbox-macro.njk +1 -1
  38. package/components/checkboxes/_checkbox.scss +0 -3
  39. package/components/checkboxes/_macro.spec.js +1 -5
  40. package/components/checkboxes/checkbox-with-autoselect.js +3 -3
  41. package/components/checkboxes/checkbox-with-fieldset.js +2 -2
  42. package/components/checkboxes/checkboxes-with-reveal.js +4 -2
  43. package/components/checkboxes/checkboxes.dom.js +2 -2
  44. package/components/checkboxes/checkboxes.spec.js +13 -13
  45. package/components/content-pagination/_macro.spec.js +2 -2
  46. package/components/cookies-banner/cookies-banner.dom.js +1 -1
  47. package/components/cookies-banner/cookies-banner.js +1 -1
  48. package/components/cookies-banner/cookies-banner.spec.js +7 -7
  49. package/components/date-input/_macro.njk +71 -69
  50. package/components/date-input/_macro.spec.js +20 -5
  51. package/components/date-input/example-date-input-double-field.njk +27 -0
  52. package/components/date-input/example-date-input-single-field.njk +18 -0
  53. package/components/details/details.spec.js +12 -12
  54. package/components/details/example-details-with-warning.njk +5 -7
  55. package/components/document-list/_macro.spec.js +9 -27
  56. package/components/document-list/document-list.scss +1 -1
  57. package/components/document-list/example-document-list-downloads.njk +3 -3
  58. package/components/document-list/example-document-list-search-result-featured.njk +1 -1
  59. package/components/document-list/example-document-list-search-results.njk +3 -3
  60. package/components/download-resources/download-resources.js +54 -54
  61. package/components/download-resources/download-resources.spec.js +3 -1
  62. package/components/duration/_macro.njk +52 -48
  63. package/components/duration/_macro.spec.js +112 -4
  64. package/components/duration/example-duration-error-for-single-field.njk +1 -1
  65. package/components/duration/example-duration-single-field.njk +24 -0
  66. package/components/error/_macro.njk +1 -1
  67. package/components/error/_macro.spec.js +2 -6
  68. package/components/feedback/_macro.njk +1 -1
  69. package/components/feedback/_macro.spec.js +4 -20
  70. package/components/field/_field-group.scss +3 -4
  71. package/components/field/_macro.spec.js +1 -3
  72. package/components/fieldset/_fieldset.scss +1 -2
  73. package/components/fieldset/_macro.spec.js +3 -9
  74. package/components/footer/_footer.scss +8 -0
  75. package/components/footer/_macro.njk +8 -7
  76. package/components/footer/_macro.spec.js +14 -2
  77. package/components/header/_macro.njk +1 -1
  78. package/components/header/_macro.spec.js +1 -1
  79. package/components/helpers/grid.njk +15 -15
  80. package/components/icon/_macro.njk +17 -13
  81. package/components/icon/_macro.spec.js +8 -16
  82. package/components/image/_macro.spec.js +1 -5
  83. package/components/input/_macro.njk +22 -23
  84. package/components/input/_macro.spec.js +1 -1
  85. package/components/input/character-check.dom.js +1 -1
  86. package/components/input/input.spec.js +1 -4
  87. package/components/label/_label.scss +1 -0
  88. package/components/label/_macro.njk +3 -3
  89. package/components/label/_macro.spec.js +4 -13
  90. package/components/list/_macro.spec.js +4 -12
  91. package/components/message/_macro.njk +17 -17
  92. package/components/message/_macro.spec.js +9 -33
  93. package/components/message-list/_macro.spec.js +7 -39
  94. package/components/metadata/_macro.njk +10 -10
  95. package/components/modal/_macro.spec.js +3 -9
  96. package/components/modal/modal.dom.js +1 -1
  97. package/components/modal/modal.spec.js +5 -5
  98. package/components/multiple-input-fields/_macro.njk +49 -0
  99. package/components/mutually-exclusive/_macro.spec.js +2 -10
  100. package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +26 -26
  101. package/components/mutually-exclusive/mutually-exclusive.date.spec.js +128 -14
  102. package/components/mutually-exclusive/mutually-exclusive.dom.js +1 -1
  103. package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +129 -8
  104. package/components/mutually-exclusive/mutually-exclusive.email.spec.js +7 -7
  105. package/components/mutually-exclusive/mutually-exclusive.js +13 -13
  106. package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +29 -29
  107. package/components/mutually-exclusive/mutually-exclusive.number.spec.js +7 -7
  108. package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +8 -8
  109. package/components/navigation/navigation.spec.js +0 -2
  110. package/components/pagination/_macro.spec.js +11 -53
  111. package/components/panel/_macro.njk +17 -17
  112. package/components/panel/_macro.spec.js +25 -25
  113. package/components/panel/_panel.scss +10 -9
  114. package/components/panel/example-panel-bare.njk +3 -4
  115. package/components/panel/example-panel-with-announcement.njk +6 -10
  116. package/components/panel/example-panel-with-error-summary.njk +2 -2
  117. package/components/panel/example-panel-with-information.njk +0 -1
  118. package/components/panel/example-panel-with-success-message.njk +1 -1
  119. package/components/panel/example-panel-with-warning.njk +2 -3
  120. package/components/password/password.dom.js +1 -1
  121. package/components/phase-banner/_macro.spec.js +3 -9
  122. package/components/question/_macro.njk +1 -1
  123. package/components/question/_macro.spec.js +5 -19
  124. package/components/question/_question.scss +1 -4
  125. package/components/question/example-question-interviewer-note.njk +1 -1
  126. package/components/quote/_macro.spec.js +2 -10
  127. package/components/radios/clear-radios.js +3 -3
  128. package/components/radios/radio-with-fieldset.js +4 -4
  129. package/components/radios/radios.dom.js +1 -1
  130. package/components/radios/radios.spec.js +26 -26
  131. package/components/related-content/_macro.spec.js +2 -4
  132. package/components/related-content/_section-macro.spec.js +2 -8
  133. package/components/relationships/example-relationships-error.njk +16 -18
  134. package/components/relationships/relationships.dom.js +1 -1
  135. package/components/relationships/relationships.js +2 -2
  136. package/components/reply/_macro.spec.js +3 -3
  137. package/components/reply/reply.dom.js +1 -1
  138. package/components/reply/reply.spec.js +3 -3
  139. package/components/section-navigation/_macro.njk +12 -12
  140. package/components/section-navigation/_macro.spec.js +13 -21
  141. package/components/select/_macro.spec.js +6 -6
  142. package/components/share-page/_macro.spec.js +6 -14
  143. package/components/skip-to-content/_macro.spec.js +3 -11
  144. package/components/skip-to-content/skip-to-content.dom.js +1 -1
  145. package/components/skip-to-content/skip-to-content.js +1 -1
  146. package/components/skip-to-content/skip-to-content.spec.js +2 -2
  147. package/components/status/_macro.njk +2 -2
  148. package/components/status/_macro.spec.js +5 -9
  149. package/components/status/example-status-dead.njk +1 -1
  150. package/components/status/example-status-error.njk +1 -1
  151. package/components/status/example-status-pending.njk +1 -1
  152. package/components/status/example-status-small.njk +1 -1
  153. package/components/status/example-status-success.njk +1 -1
  154. package/components/summary/_macro.njk +7 -8
  155. package/components/summary/_macro.spec.js +27 -9
  156. package/components/table/_macro.spec.js +6 -10
  157. package/components/table/scrollable-table.dom.js +1 -1
  158. package/components/table/scrollable-table.js +1 -1
  159. package/components/table/sortable-table.js +4 -4
  160. package/components/table/table.spec.js +21 -17
  161. package/components/table-of-contents/_macro.njk +31 -31
  162. package/components/table-of-contents/_macro.spec.js +3 -11
  163. package/components/table-of-contents/toc.dom.js +1 -1
  164. package/components/table-of-contents/toc.spec.js +36 -32
  165. package/components/tabs/example-tabs-details.njk +1 -1
  166. package/components/tabs/tabs.dom.js +1 -1
  167. package/components/tabs/tabs.js +8 -8
  168. package/components/text-indent/_macro.spec.js +2 -6
  169. package/components/textarea/textarea.dom.js +1 -1
  170. package/components/textarea/textarea.spec.js +8 -8
  171. package/components/timeout-modal/_macro.spec.js +1 -3
  172. package/components/timeout-modal/timeout-modal.dom.js +1 -1
  173. package/components/timeout-modal/timeout-modal.spec.js +10 -10
  174. package/components/timeout-panel/_macro.njk +16 -17
  175. package/components/timeout-panel/_macro.spec.js +1 -1
  176. package/components/timeout-panel/timeout-panel.dom.js +1 -1
  177. package/components/timeout-panel/timeout-panel.spec.js +8 -8
  178. package/components/video/_macro.spec.js +1 -5
  179. package/components/video/video.dom.js +1 -1
  180. package/components/video/video.spec.js +16 -12
  181. package/css/main.css +1 -1
  182. package/favicons/safari-pinned-tab.svg +23 -23
  183. package/js/analytics.js +15 -14
  184. package/js/cookies-settings.dom.js +1 -1
  185. package/js/cookies-settings.spec.js +19 -19
  186. package/js/domready.js +1 -1
  187. package/js/fetch.js +1 -1
  188. package/js/inpagelink.js +3 -3
  189. package/js/main.js +1 -0
  190. package/js/print-button.js +1 -1
  191. package/js/timeout.js +1 -1
  192. package/package.json +2 -1
  193. package/scripts/main.es5.js +1 -1
  194. package/scripts/main.js +1 -1
  195. package/scss/base/_typography.scss +8 -2
  196. package/scss/main.scss +1 -0
  197. package/scss/overrides/hcm.scss +8 -1
  198. package/scss/vars/_colors.scss +2 -1
  199. package/components/date-field-input/_macro.njk +0 -86
@@ -6,7 +6,7 @@ import axe from '../../tests/helpers/axe';
6
6
  import { renderComponent } from '../../tests/helpers/rendering';
7
7
 
8
8
  const EXAMPLE_MESSAGE_MINIMAL = {
9
- type: 'sent',
9
+ variant: 'sent',
10
10
  fromLabel: 'From',
11
11
  fromValue: 'Example Sender',
12
12
  sentLabel: 'Date sent',
@@ -35,13 +35,13 @@ describe('macro: message', () => {
35
35
  it.each([
36
36
  ['sent', 'ons-message--sent'],
37
37
  ['received', 'ons-message--received'],
38
- ])('has appropriate class for provided `type` (%s -> %s)', (type, expectedClass) => {
38
+ ])('has appropriate class for provided `variant` (%s -> %s)', (variant, expectedClass) => {
39
39
  const $ = cheerio.load(
40
40
  renderComponent(
41
41
  'message',
42
42
  {
43
43
  ...EXAMPLE_MESSAGE_MINIMAL,
44
- type,
44
+ variant,
45
45
  },
46
46
  ['Message content...'],
47
47
  ),
@@ -59,21 +59,13 @@ describe('macro: message', () => {
59
59
  it('has the provided `fromLabel`', () => {
60
60
  const $ = cheerio.load(renderComponent('message', EXAMPLE_MESSAGE_MINIMAL, ['Message content...']));
61
61
 
62
- expect(
63
- $('.ons-message__sender .ons-message__term')
64
- .text()
65
- .trim(),
66
- ).toBe('From:');
62
+ expect($('.ons-message__sender .ons-message__term').text().trim()).toBe('From:');
67
63
  });
68
64
 
69
65
  it('has the provided `fromValue`', () => {
70
66
  const $ = cheerio.load(renderComponent('message', EXAMPLE_MESSAGE_MINIMAL, ['Message content...']));
71
67
 
72
- expect(
73
- $('.ons-message__sender .ons-message__value')
74
- .text()
75
- .trim(),
76
- ).toBe('Example Sender');
68
+ expect($('.ons-message__sender .ons-message__value').text().trim()).toBe('Example Sender');
77
69
  });
78
70
 
79
71
  it('has the provided `fromId`', () => {
@@ -85,21 +77,13 @@ describe('macro: message', () => {
85
77
  it('has the provided `sentLabel`', () => {
86
78
  const $ = cheerio.load(renderComponent('message', EXAMPLE_MESSAGE_MINIMAL, ['Message content...']));
87
79
 
88
- expect(
89
- $('.ons-message__timestamp .ons-message__term')
90
- .text()
91
- .trim(),
92
- ).toBe('Date sent:');
80
+ expect($('.ons-message__timestamp .ons-message__term').text().trim()).toBe('Date sent:');
93
81
  });
94
82
 
95
83
  it('has the provided `sentValue`', () => {
96
84
  const $ = cheerio.load(renderComponent('message', EXAMPLE_MESSAGE_MINIMAL, ['Message content...']));
97
85
 
98
- expect(
99
- $('.ons-message__timestamp .ons-message__value')
100
- .text()
101
- .trim(),
102
- ).toBe('Tue 4 Jul 2020 at 7:47');
86
+ expect($('.ons-message__timestamp .ons-message__value').text().trim()).toBe('Tue 4 Jul 2020 at 7:47');
103
87
  });
104
88
 
105
89
  it('has the provided `sentId`', () => {
@@ -117,20 +101,12 @@ describe('macro: message', () => {
117
101
  it('has the provided `unreadLinkText`', () => {
118
102
  const $ = cheerio.load(renderComponent('message', EXAMPLE_MESSAGE, ['Message content...']));
119
103
 
120
- expect(
121
- $('.ons-message__unread-link')
122
- .text()
123
- .trim(),
124
- ).toBe('Unread message');
104
+ expect($('.ons-message__unread-link').text().trim()).toBe('Unread message');
125
105
  });
126
106
 
127
107
  it('has the message content', () => {
128
108
  const $ = cheerio.load(renderComponent('message', EXAMPLE_MESSAGE_MINIMAL, ['Message content...']));
129
109
 
130
- expect(
131
- $('.ons-message__body')
132
- .text()
133
- .trim(),
134
- ).toBe('Message content...');
110
+ expect($('.ons-message__body').text().trim()).toBe('Message content...');
135
111
  });
136
112
  });
@@ -85,31 +85,19 @@ describe('macro: message-list', () => {
85
85
  it('has `unreadText` for unread messages', () => {
86
86
  const $ = cheerio.load(renderComponent('message-list', EXAMPLE_MESSAGE_LIST));
87
87
 
88
- expect(
89
- $('#message1 .ons-message-item__unread')
90
- .text()
91
- .trim(),
92
- ).toBe('(New)');
88
+ expect($('#message1 .ons-message-item__unread').text().trim()).toBe('(New)');
93
89
  });
94
90
 
95
91
  it('has visually hidden label `fromLabel`', () => {
96
92
  const $ = cheerio.load(renderComponent('message-list', EXAMPLE_MESSAGE_LIST_MINIMAL));
97
93
 
98
- expect(
99
- $('.ons-message-item__metadata-term--from:first')
100
- .text()
101
- .trim(),
102
- ).toBe('From:');
94
+ expect($('.ons-message-item__metadata-term--from:first').text().trim()).toBe('From:');
103
95
  });
104
96
 
105
97
  it('has visually hidden label `dateLabel`', () => {
106
98
  const $ = cheerio.load(renderComponent('message-list', EXAMPLE_MESSAGE_LIST_MINIMAL));
107
99
 
108
- expect(
109
- $('.ons-message-item__metadata-term--date:first')
110
- .text()
111
- .trim(),
112
- ).toBe('Date:');
100
+ expect($('.ons-message-item__metadata-term--date:first').text().trim()).toBe('Date:');
113
101
  });
114
102
 
115
103
  it('has visually hidden label `hiddenReadLabel`', () => {
@@ -123,31 +111,11 @@ describe('macro: message-list', () => {
123
111
 
124
112
  const $message2 = $('.ons-message-item:nth-child(2)');
125
113
 
126
- expect(
127
- $message2
128
- .find('.ons-message-item__subject')
129
- .text()
130
- .trim(),
131
- ).toBe('Another example message subject');
114
+ expect($message2.find('.ons-message-item__subject').text().trim()).toBe('Another example message subject');
132
115
  expect($message2.find('.ons-message-item__subject').attr('id')).toBe('message2');
133
- expect(
134
- $message2
135
- .find('.ons-message-item__metadata-value--from')
136
- .text()
137
- .trim(),
138
- ).toBe('Example Sender 2');
139
- expect(
140
- $message2
141
- .find('.ons-message-item__metadata-value--date')
142
- .text()
143
- .trim(),
144
- ).toBe('Mon 1 Oct 2019 at 9:52');
145
- expect(
146
- $message2
147
- .find('.ons-message-item__body')
148
- .text()
149
- .trim(),
150
- ).toBe('Another example message.');
116
+ expect($message2.find('.ons-message-item__metadata-value--from').text().trim()).toBe('Example Sender 2');
117
+ expect($message2.find('.ons-message-item__metadata-value--date').text().trim()).toBe('Mon 1 Oct 2019 at 9:52');
118
+ expect($message2.find('.ons-message-item__body').text().trim()).toBe('Another example message.');
151
119
  expect($message2.find('.ons-message-item__link a').attr('href')).toBe('https://example.com/message/2');
152
120
  });
153
121
 
@@ -1,14 +1,14 @@
1
1
  {% from "components/description-list/_macro.njk" import onsDescriptionList %}
2
2
 
3
3
  {% macro onsMetadata(params) %}
4
- {{
5
- onsDescriptionList({
6
- "id": params.id,
7
- "classes": params.classes,
8
- "descriptionListLabel": params.metadataLabel,
9
- "termCol": params.termCol,
10
- "descriptionCol": params.descriptionCol,
11
- "itemsList": params.itemsList
12
- })
13
- }}
4
+ {{
5
+ onsDescriptionList({
6
+ "id": params.id,
7
+ "classes": params.classes,
8
+ "descriptionListLabel": params.metadataLabel,
9
+ "termCol": params.termCol,
10
+ "descriptionCol": params.descriptionCol,
11
+ "itemsList": params.itemsList
12
+ })
13
+ }}
14
14
  {% endmacro %}
@@ -22,18 +22,14 @@ describe('macro: modal', () => {
22
22
  it('has expected `title`', () => {
23
23
  const $ = cheerio.load(renderComponent('modal', EXAMPLE_MODAL_BASIC));
24
24
 
25
- const title = $('.ons-modal__title')
26
- .html()
27
- .trim();
25
+ const title = $('.ons-modal__title').html().trim();
28
26
  expect(title).toBe('Modal title');
29
27
  });
30
28
 
31
29
  it('has expected `body`', () => {
32
30
  const $ = cheerio.load(renderComponent('modal', EXAMPLE_MODAL_BASIC));
33
31
 
34
- const title = $('.ons-modal__body')
35
- .html()
36
- .trim();
32
+ const title = $('.ons-modal__body').html().trim();
37
33
  expect(title).toBe('Modal body text');
38
34
  });
39
35
 
@@ -64,9 +60,7 @@ describe('macro: modal', () => {
64
60
  it('calls with content', () => {
65
61
  const $ = cheerio.load(renderComponent('modal', { EXAMPLE_MODAL_BASIC }, 'Example content...'));
66
62
 
67
- const content = $('.ons-modal__body')
68
- .text()
69
- .trim();
63
+ const content = $('.ons-modal__body').text().trim();
70
64
  expect(content).toBe('Example content...');
71
65
  });
72
66
 
@@ -7,7 +7,7 @@ async function modals() {
7
7
  if (modals.length && !timeouts.length) {
8
8
  const Modal = (await import('./modal')).default;
9
9
 
10
- modals.forEach(component => new Modal(component));
10
+ modals.forEach((component) => new Modal(component));
11
11
  }
12
12
  }
13
13
 
@@ -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
  });
@@ -0,0 +1,49 @@
1
+ {% from "components/mutually-exclusive/_macro.njk" import onsMutuallyExclusive %}
2
+ {% from "components/fieldset/_macro.njk" import onsFieldset %}
3
+
4
+ {% macro onsMultipleInputFields(params) %}
5
+ {% set fields %}
6
+ {% if params.numberOfFields > 1 %}
7
+ <div class="ons-field-group">
8
+ {{ params.fields | safe }}
9
+ </div>
10
+ {% else %}
11
+ {{ params.fields | safe }}
12
+ {% endif %}
13
+ {% endset %}
14
+
15
+ {% if params.mutuallyExclusive %}
16
+ {% call onsMutuallyExclusive({
17
+ "id": params.id,
18
+ "legend": params.legendOrLabel,
19
+ "legendClasses": params.legendClasses,
20
+ "description": params.description,
21
+ "classes": params.classes,
22
+ "dontWrap": params.dontWrap if params.numberOfFields > 1 else true,
23
+ "legendIsQuestionTitle": params.legendIsQuestionTitle,
24
+ "exclusiveOptions": params.mutuallyExclusive.exclusiveOptions,
25
+ "or": params.mutuallyExclusive.or,
26
+ "deselectMessage": params.mutuallyExclusive.deselectMessage,
27
+ "deselectGroupAdjective": params.mutuallyExclusive.deselectGroupAdjective,
28
+ "deselectExclusiveOptionAdjective": params.mutuallyExclusive.deselectExclusiveOptionAdjective,
29
+ "error": params.error
30
+ }) %}
31
+ {{ fields | safe }}
32
+ {% endcall %}
33
+ {% elif params.numberOfFields > 1 %}
34
+ {% call onsFieldset({
35
+ "id": params.id,
36
+ "legend": params.legendOrLabel,
37
+ "legendClasses": params.legendClasses,
38
+ "description": params.description,
39
+ "classes": params.classes,
40
+ "dontWrap": params.dontWrap,
41
+ "legendIsQuestionTitle": params.legendIsQuestionTitle,
42
+ "error": params.error
43
+ }) %}
44
+ {{ fields | safe }}
45
+ {% endcall %}
46
+ {% else %}
47
+ {{ fields | safe }}
48
+ {% endif %}
49
+ {% endmacro %}
@@ -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
  });