@ons/design-system 73.0.2 → 73.0.4

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 (49) hide show
  1. package/README.md +3 -1
  2. package/components/accordion/_macro.njk +2 -0
  3. package/components/accordion/_macro.spec.js +39 -0
  4. package/components/accordion/accordion.js +2 -0
  5. package/components/accordion/example-accordion.njk +6 -1
  6. package/components/back-to-top/example-full-page-back-to-top.njk +2 -2
  7. package/components/button/example-button-new-window.njk +1 -0
  8. package/components/chart/chart-constants.js +2 -1
  9. package/components/chart/chart.js +2 -0
  10. package/components/chart/example-area-chart-with-axis-min-and-max-values.njk +1 -1
  11. package/components/chart/example-clustered-column-chart.njk +1 -1
  12. package/components/chart/example-line-chart-with-annotations.njk +1 -1
  13. package/components/chart/example-line-chart-with-axis-min-and-max-values.njk +1 -1
  14. package/components/chart/example-line-chart-with-custom-reference-line-value.njk +1 -1
  15. package/components/chart/example-line-chart-with-markers.njk +1 -37
  16. package/components/chart/example-line-chart-with-range-annotations-inside.njk +1 -1
  17. package/components/chart/example-line-chart-with-range-annotations-outside-left-right.njk +1 -1
  18. package/components/chart/example-line-chart-with-range-annotations-outside-top-bottom.njk +1 -1
  19. package/components/chart/example-line-chart-with-reference-line-annotations.njk +1 -1
  20. package/components/chart/example-line-chart.njk +1 -1
  21. package/components/chart/example-scatter-chart-with-axis-min-and-max-values.njk +1 -1
  22. package/components/chart/example-scatter-chart.njk +1 -1
  23. package/components/chart/example-stacked-column-chart.njk +26 -37
  24. package/components/chart/specific-chart-options.js +16 -1
  25. package/components/cookies-banner/_macro.njk +1 -3
  26. package/components/featured-article/example-featured-article-with-chart.njk +1 -1
  27. package/components/icon/_macro.njk +12 -3
  28. package/components/icon/_macro.spec.js +2 -2
  29. package/components/image/_image.scss +2 -1
  30. package/components/list/example-inline-list-with-social-icon-prefix.njk +2 -2
  31. package/components/pagination/_macro.njk +7 -6
  32. package/components/pagination/_macro.spec.js +44 -44
  33. package/components/panel/_macro.njk +8 -2
  34. package/components/panel/_macro.spec.js +24 -2
  35. package/components/panel/_panel.scss +2 -0
  36. package/components/panel/example-panel-with-pending.njk +9 -0
  37. package/components/radios/_macro.njk +2 -1
  38. package/components/radios/_macro.spec.js +36 -0
  39. package/components/related-content/example-related-content-social-media.njk +2 -2
  40. package/components/share-page/_macro.njk +6 -6
  41. package/components/share-page/_macro.spec.js +9 -9
  42. package/components/share-page/example-share-page.njk +1 -1
  43. package/components/table/_macro.njk +4 -19
  44. package/css/main.css +1 -1
  45. package/layout/_template.njk +9 -9
  46. package/package.json +1 -1
  47. package/scripts/main.es5.js +1 -1
  48. package/scripts/main.js +1 -1
  49. /package/favicons/{twitter.png → x.png} +0 -0
@@ -75,7 +75,7 @@ describe('macro: pagination', () => {
75
75
 
76
76
  it('has a single list item', () => {
77
77
  expect($('li').length).toBe(1);
78
- assertIsCurrentPage($('.ons-pagination__item'), '/page/1', 'Current page (Page 1 of 1)', '1');
78
+ assertIsCurrentPage($('.ons-pagination__item'), '/page/1', 'Page 1 of 1', '1');
79
79
  });
80
80
  });
81
81
 
@@ -103,9 +103,9 @@ describe('macro: pagination', () => {
103
103
 
104
104
  it('has a 3 list items ("1", "2", "Next page")', () => {
105
105
  expect($('li').length).toBe(3);
106
- assertIsCurrentPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Current page (Page 1 of 2)', '1');
107
- assertIsNextPage($('.ons-pagination__item:nth-child(2)'), '/page/2', 'Go to page 2', '2');
108
- assertIsNextPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Go to the next page (2)', 'Next page');
106
+ assertIsCurrentPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Page 1 of 2', '1');
107
+ assertIsNextPage($('.ons-pagination__item:nth-child(2)'), '/page/2', 'Page 2', '2');
108
+ assertIsNextPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Next page (2)', 'Next page');
109
109
  });
110
110
  });
111
111
 
@@ -133,9 +133,9 @@ describe('macro: pagination', () => {
133
133
 
134
134
  it('has a 3 list items ("Previous page", "1", "2")', () => {
135
135
  expect($('li').length).toBe(3);
136
- assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Go to the previous page (1)', 'Previous page');
137
- assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Go to page 1', '1');
138
- assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Current page (Page 2 of 2)', '2');
136
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Previous page (1)', 'Previous page');
137
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Page 1', '1');
138
+ assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Page 2 of 2', '2');
139
139
  });
140
140
  });
141
141
 
@@ -163,11 +163,11 @@ describe('macro: pagination', () => {
163
163
 
164
164
  it('has a 5 list items ("Previous page", "1", "2", "3", "Next page")', () => {
165
165
  expect($('li').length).toBe(5);
166
- assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Go to the previous page (1)', 'Previous page');
167
- assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Go to page 1', '1');
168
- assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Current page (Page 2 of 3)', '2');
169
- assertIsNextPage($('.ons-pagination__item:nth-child(4)'), '/page/3', 'Go to page 3', '3');
170
- assertIsNextPage($('.ons-pagination__item:nth-child(5)'), '/page/3', 'Go to the next page (3)', 'Next page');
166
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Previous page (1)', 'Previous page');
167
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Page 1', '1');
168
+ assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Page 2 of 3', '2');
169
+ assertIsNextPage($('.ons-pagination__item:nth-child(4)'), '/page/3', 'Page 3', '3');
170
+ assertIsNextPage($('.ons-pagination__item:nth-child(5)'), '/page/3', 'Next page (3)', 'Next page');
171
171
  });
172
172
  });
173
173
 
@@ -195,13 +195,13 @@ describe('macro: pagination', () => {
195
195
 
196
196
  it('has a 7 list items ("Previous page", "1", "2", "3", "4", "5", "Next page")', () => {
197
197
  expect($('li').length).toBe(7);
198
- assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Go to the previous page (1)', 'Previous page');
199
- assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Go to page 1', '1');
200
- assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Current page (Page 2 of 5)', '2');
201
- assertIsNextPage($('.ons-pagination__item:nth-child(4)'), '/page/3', 'Go to page 3', '3');
202
- assertIsOtherPage($('.ons-pagination__item:nth-child(5)'), '/page/4', 'Go to page 4', '4');
203
- assertIsOtherPage($('.ons-pagination__item:nth-child(6)'), '/page/5', 'Go to the last page (5)', '5');
204
- assertIsNextPage($('.ons-pagination__item:nth-child(7)'), '/page/3', 'Go to the next page (3)', 'Next page');
198
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Previous page (1)', 'Previous page');
199
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Page 1', '1');
200
+ assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Page 2 of 5', '2');
201
+ assertIsNextPage($('.ons-pagination__item:nth-child(4)'), '/page/3', 'Page 3', '3');
202
+ assertIsOtherPage($('.ons-pagination__item:nth-child(5)'), '/page/4', 'Page 4', '4');
203
+ assertIsOtherPage($('.ons-pagination__item:nth-child(6)'), '/page/5', 'Last page (5)', '5');
204
+ assertIsNextPage($('.ons-pagination__item:nth-child(7)'), '/page/3', 'Next page (3)', 'Next page');
205
205
  });
206
206
  });
207
207
 
@@ -236,13 +236,13 @@ describe('macro: pagination', () => {
236
236
 
237
237
  it('has 7 list items ("Previous page", "1", "2", "3", "...", "6", "Next page")', () => {
238
238
  expect($('li').length).toBe(7);
239
- assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Go to the previous page (1)', 'Previous page');
240
- assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Go to page 1', '1');
241
- assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Current page (Page 2 of 6)', '2');
242
- assertIsNextPage($('.ons-pagination__item:nth-child(4)'), '/page/3', 'Go to page 3', '3');
239
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/1', 'Previous page (1)', 'Previous page');
240
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Page 1', '1');
241
+ assertIsCurrentPage($('.ons-pagination__item:nth-child(3)'), '/page/2', 'Page 2 of 6', '2');
242
+ assertIsNextPage($('.ons-pagination__item:nth-child(4)'), '/page/3', 'Page 3', '3');
243
243
  assertIsGap($('.ons-pagination__item:nth-child(5)'));
244
- assertIsOtherPage($('.ons-pagination__item:nth-child(6)'), '/page/6', 'Go to the last page (6)', '6');
245
- assertIsNextPage($('.ons-pagination__item:nth-child(7)'), '/page/3', 'Go to the next page (3)', 'Next page');
244
+ assertIsOtherPage($('.ons-pagination__item:nth-child(6)'), '/page/6', 'Last page (6)', '6');
245
+ assertIsNextPage($('.ons-pagination__item:nth-child(7)'), '/page/3', 'Next page (3)', 'Next page');
246
246
  });
247
247
  });
248
248
 
@@ -282,15 +282,15 @@ describe('macro: pagination', () => {
282
282
 
283
283
  it('has a 9 list items ("Previous page", "1", "...", "4", "5", "6", "...", "11", "Next page")', () => {
284
284
  expect($('li').length).toBe(9);
285
- assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/4', 'Go to the previous page (4)', 'Previous page');
286
- assertIsOtherPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Go to the first page', '1');
285
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/4', 'Previous page (4)', 'Previous page');
286
+ assertIsOtherPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'First page', '1');
287
287
  assertIsGap($('.ons-pagination__item:nth-child(3)'));
288
- assertIsPreviousPage($('.ons-pagination__item:nth-child(4)'), '/page/4', 'Go to page 4', '4');
289
- assertIsCurrentPage($('.ons-pagination__item:nth-child(5)'), '/page/5', 'Current page (Page 5 of 11)', '5');
290
- assertIsNextPage($('.ons-pagination__item:nth-child(6)'), '/page/6', 'Go to page 6', '6');
288
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(4)'), '/page/4', 'Page 4', '4');
289
+ assertIsCurrentPage($('.ons-pagination__item:nth-child(5)'), '/page/5', 'Page 5 of 11', '5');
290
+ assertIsNextPage($('.ons-pagination__item:nth-child(6)'), '/page/6', 'Page 6', '6');
291
291
  assertIsGap($('.ons-pagination__item:nth-child(7)'));
292
- assertIsOtherPage($('.ons-pagination__item:nth-child(8)'), '/page/11', 'Go to the last page (11)', '11');
293
- assertIsNextPage($('.ons-pagination__item:nth-child(9)'), '/page/6', 'Go to the next page (6)', 'Next page');
292
+ assertIsOtherPage($('.ons-pagination__item:nth-child(8)'), '/page/11', 'Last page (11)', '11');
293
+ assertIsNextPage($('.ons-pagination__item:nth-child(9)'), '/page/6', 'Next page (6)', 'Next page');
294
294
  });
295
295
  });
296
296
 
@@ -330,13 +330,13 @@ describe('macro: pagination', () => {
330
330
 
331
331
  it('has a 7 list items ("Previous page", "1", "...", "9", "10", "11", "Next page")', () => {
332
332
  expect($('li').length).toBe(7);
333
- assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/9', 'Go to the previous page (9)', 'Previous page');
334
- assertIsOtherPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'Go to the first page', '1');
333
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(1)'), '/page/9', 'Previous page (9)', 'Previous page');
334
+ assertIsOtherPage($('.ons-pagination__item:nth-child(2)'), '/page/1', 'First page', '1');
335
335
  assertIsGap($('.ons-pagination__item:nth-child(3)'));
336
- assertIsPreviousPage($('.ons-pagination__item:nth-child(4)'), '/page/9', 'Go to page 9', '9');
337
- assertIsCurrentPage($('.ons-pagination__item:nth-child(5)'), '/page/10', 'Current page (Page 10 of 11)', '10');
338
- assertIsNextPage($('.ons-pagination__item:nth-child(6)'), '/page/11', 'Go to page 11', '11');
339
- assertIsNextPage($('.ons-pagination__item:nth-child(7)'), '/page/11', 'Go to the next page (11)', 'Next page');
336
+ assertIsPreviousPage($('.ons-pagination__item:nth-child(4)'), '/page/9', 'Page 9', '9');
337
+ assertIsCurrentPage($('.ons-pagination__item:nth-child(5)'), '/page/10', 'Page 10 of 11', '10');
338
+ assertIsNextPage($('.ons-pagination__item:nth-child(6)'), '/page/11', 'Page 11', '11');
339
+ assertIsNextPage($('.ons-pagination__item:nth-child(7)'), '/page/11', 'Next page (11)', 'Next page');
340
340
  });
341
341
  });
342
342
 
@@ -370,7 +370,7 @@ describe('macro: pagination', () => {
370
370
  it('renders the default previousAriaLabel and page number on the Previous link if not provided', () => {
371
371
  const prevItem = $default('.ons-pagination__item--previous');
372
372
  expect(prevItem.length).toBe(1);
373
- expect(prevItem.find('a').attr('aria-label')).toBe('Go to the previous page (1)');
373
+ expect(prevItem.find('a').attr('aria-label')).toBe('Previous page (1)');
374
374
  });
375
375
  it('renders the custom nextAriaLabel and page number on the Next link', () => {
376
376
  const nextItem = $custom('.ons-pagination__item--next');
@@ -380,7 +380,7 @@ describe('macro: pagination', () => {
380
380
  it('renders the default nextAriaLabel and page number on the Next link if not provided', () => {
381
381
  const nextItem = $default('.ons-pagination__item--next');
382
382
  expect(nextItem.length).toBe(1);
383
- expect(nextItem.find('a').attr('aria-label')).toBe('Go to the next page (3)');
383
+ expect(nextItem.find('a').attr('aria-label')).toBe('Next page (3)');
384
384
  });
385
385
  });
386
386
 
@@ -430,7 +430,7 @@ describe('macro: pagination', () => {
430
430
  const firstPageLink = $('.ons-pagination__item a').filter(function () {
431
431
  return $(this).text().trim() === '1';
432
432
  });
433
- expect(firstPageLink.attr('aria-label')).toBe('Go to the first page');
433
+ expect(firstPageLink.attr('aria-label')).toBe('First page');
434
434
  });
435
435
  });
436
436
 
@@ -454,7 +454,7 @@ describe('macro: pagination', () => {
454
454
  }),
455
455
  );
456
456
  const currentPageLink = $('.ons-pagination__item--current a');
457
- expect(currentPageLink.attr('aria-label')).toBe('Current page (Page 2 of 3)');
457
+ expect(currentPageLink.attr('aria-label')).toBe('Page 2 of 3');
458
458
  });
459
459
  });
460
460
 
@@ -482,7 +482,7 @@ describe('macro: pagination', () => {
482
482
  const lastPageLink = $('.ons-pagination__item a').filter(function () {
483
483
  return $(this).text().trim() === '4';
484
484
  });
485
- expect(lastPageLink.attr('aria-label')).toBe('Go to the last page (4)');
485
+ expect(lastPageLink.attr('aria-label')).toBe('Last page (4)');
486
486
  });
487
487
  });
488
488
 
@@ -510,7 +510,7 @@ describe('macro: pagination', () => {
510
510
  const page2Link = $('.ons-pagination__item a').filter(function () {
511
511
  return $(this).text().trim() === '2';
512
512
  });
513
- expect(page2Link.attr('aria-label')).toBe('Go to page 2');
513
+ expect(page2Link.attr('aria-label')).toBe('Page 2');
514
514
  });
515
515
  });
516
516
  });
@@ -69,8 +69,14 @@
69
69
  <span class="ons-panel__assistive-text ons-u-vh"
70
70
  >{{ params.assistiveTextPrefix | default("Important information: ") }}</span
71
71
  >
72
- {% elif params.variant == 'error' or params.variant == 'success' %}
73
- {% set defaultText = "Completed" if params.variant == "success" else "Error" %}
72
+ {% elif params.variant == 'error' or params.variant == 'success' or params.variant == 'pending' %}
73
+ {% if params.variant == "success" %}
74
+ {% set defaultText = "Completed" %}
75
+ {% elif params.variant == "pending" %}
76
+ {% set defaultText = "Pending" %}
77
+ {% else %}
78
+ {% set defaultText = "Error" %}
79
+ {% endif %}
74
80
  <span {% if params.variant == "success" %}id="alert"{% endif %}class="ons-panel__assistive-text ons-u-vh"
75
81
  >{{ params.assistiveTextPrefix | default(defaultText ~ ": ") }}</span
76
82
  >
@@ -15,6 +15,7 @@ describe('macro: panel', () => {
15
15
  ['info', 'Important information:'],
16
16
  ['bare', 'Important information:'],
17
17
  ['error', 'Error:'],
18
+ ['pending', 'Pending:'],
18
19
  ['warn', 'Warning:'],
19
20
  ['warn-branded', 'Warning:'],
20
21
  ['branded', 'Important information:'],
@@ -134,17 +135,22 @@ describe('macro: panel', () => {
134
135
  });
135
136
  });
136
137
 
137
- describe('mode: info', () => {
138
+ describe.each([
139
+ ['info', 'div'],
140
+ ['', 'div'],
141
+ ['pending', 'div'],
142
+ ])('mode: %s', (panelVariant, tagEl) => {
138
143
  it('has the default title tag', () => {
139
144
  const $ = cheerio.load(
140
145
  renderComponent('panel', {
141
146
  ...EXAMPLE_PANEL_BASIC,
142
147
  title: 'Panel title',
148
+ variant: panelVariant,
143
149
  }),
144
150
  );
145
151
 
146
152
  const titleTag = $('.ons-panel__title')[0].tagName;
147
- expect(titleTag).toBe('div');
153
+ expect(titleTag).toBe(tagEl);
148
154
  });
149
155
 
150
156
  it('has the provided `headingLevel`', () => {
@@ -152,6 +158,7 @@ describe('macro: panel', () => {
152
158
  renderComponent('panel', {
153
159
  ...EXAMPLE_PANEL_BASIC,
154
160
  title: 'Panel title',
161
+ variant: panelVariant,
155
162
  headingLevel: 3,
156
163
  }),
157
164
  );
@@ -165,6 +172,7 @@ describe('macro: panel', () => {
165
172
  renderComponent('panel', {
166
173
  ...EXAMPLE_PANEL_BASIC,
167
174
  title: 'Panel title',
175
+ variant: panelVariant,
168
176
  }),
169
177
  );
170
178
 
@@ -216,6 +224,20 @@ describe('macro: panel', () => {
216
224
  expect(titleTag).toBe(tagEl);
217
225
  });
218
226
 
227
+ it('has the provided `headingLevel`', () => {
228
+ const $ = cheerio.load(
229
+ renderComponent('panel', {
230
+ ...EXAMPLE_PANEL_BASIC,
231
+ title: 'Panel title',
232
+ variant: panelVariant,
233
+ headingLevel: 3,
234
+ }),
235
+ );
236
+
237
+ const titleTag = $('.ons-panel__title')[0].tagName;
238
+ expect(titleTag).toBe('h3');
239
+ });
240
+
219
241
  it('has aria-labelledby attribute set with default value', () => {
220
242
  const $ = cheerio.load(
221
243
  renderComponent('panel', {
@@ -247,6 +247,7 @@
247
247
  &--bare,
248
248
  &--success,
249
249
  &--warn,
250
+ &--pending,
250
251
  &--warn-branded,
251
252
  &--announcement {
252
253
  .ons-panel__icon {
@@ -257,6 +258,7 @@
257
258
 
258
259
  @include panel-variant(error, var(--ons-color-errors), var(--ons-color-errors-tint));
259
260
  @include panel-variant(success, var(--ons-color-success), var(--ons-color-success-tint));
261
+ @include panel-variant(pending, var(--ons-color-pending), var(--ons-color-pending-tint));
260
262
  @include panel-variant(info, var(--ons-color-info), var(--ons-color-info-tint));
261
263
  @include panel-variant(branded, var(--ons-color-branded), var(--ons-color-branded-tint));
262
264
  @include panel-variant(warn, transparent, transparent);
@@ -0,0 +1,9 @@
1
+ {% from "components/panel/_macro.njk" import onsPanel %}
2
+
3
+ {{
4
+ onsPanel({
5
+ "variant": 'pending',
6
+ "id": 'pending-id',
7
+ "body": 'Information is being processed'
8
+ })
9
+ }}
@@ -140,7 +140,8 @@
140
140
  "limit": radio.other.charCheckLimit.limit,
141
141
  "charCountSingular": radio.other.charCheckLimit.charCountSingular,
142
142
  "charCountPlural": radio.other.charCheckLimit.charCountPlural
143
- }
143
+ },
144
+ "attributes": radio.other.attributes
144
145
  })
145
146
  }}
146
147
  {% endif %}
@@ -129,6 +129,15 @@ const EXAMPLE_RADIO_ITEM_TEXTAREA_WITH_PRESET_VALUE = {
129
129
  id: 'other-textarea-input',
130
130
  name: 'other-answer',
131
131
  value: 'other answer',
132
+ attributes: { a: 42 },
133
+ label: {
134
+ text: 'Example radio with Text area',
135
+ },
136
+ charCheckLimit: {
137
+ limit: 200,
138
+ charCountSingular: 'You have {x} character remaining',
139
+ charCountPlural: 'You have {x} characters remaining',
140
+ },
132
141
  },
133
142
  };
134
143
 
@@ -558,6 +567,33 @@ describe('macro: radios', () => {
558
567
 
559
568
  expect($('.ons-input--textarea').text()).toBe('other answer');
560
569
  });
570
+
571
+ it('renders other "textarea" component for item', () => {
572
+ const faker = templateFaker();
573
+ const textareaSpy = faker.spy('textarea');
574
+
575
+ faker.renderComponent('radios', {
576
+ ...EXAMPLE_RADIOS_MINIMAL,
577
+ radios: [EXAMPLE_RADIO_ITEM_TEXTAREA_WITH_PRESET_VALUE],
578
+ });
579
+
580
+ expect(textareaSpy.occurrences).toContainEqual({
581
+ id: 'other-textarea-input',
582
+ name: 'other-answer',
583
+ value: 'other answer',
584
+ attributes: { a: 42 },
585
+ label: {
586
+ id: 'other-textarea-input-label',
587
+ text: 'Example radio with Text area',
588
+ classes: 'ons-u-fw-n',
589
+ },
590
+ charCheckLimit: {
591
+ limit: 200,
592
+ charCountSingular: 'You have {x} character remaining',
593
+ charCountPlural: 'You have {x} characters remaining',
594
+ },
595
+ });
596
+ });
561
597
  });
562
598
 
563
599
  describe('clear radios button', () => {
@@ -12,8 +12,8 @@
12
12
  "itemsList": [
13
13
  {
14
14
  "url": '#0',
15
- "text": 'Twitter',
16
- "iconType": 'twitter',
15
+ "text": 'X',
16
+ "iconType": 'x',
17
17
  "rel": 'noreferrer external'
18
18
  },
19
19
  {
@@ -21,13 +21,13 @@
21
21
  }
22
22
  %}
23
23
  {% endif %}
24
- {% if params.twitter and params.twitter == true %}
24
+ {% if params.x and params.x == true %}
25
25
  {%
26
- set twitter =
26
+ set x =
27
27
  {
28
- "url": 'https://twitter.com/intent/tweet?original_referer&text=' ~ params.pageTitle|urlencode ~ '&url=' ~ params.pageUrl|urlencode,
29
- "text": 'Twitter',
30
- "iconType": 'twitter',
28
+ "url": 'https://x.com/intent/tweet?original_referer&text=' ~ params.pageTitle|urlencode ~ '&url=' ~ params.pageUrl|urlencode,
29
+ "text": 'X',
30
+ "iconType": 'x',
31
31
  "rel": 'noreferrer external',
32
32
  "target": '_blank'
33
33
  }
@@ -38,7 +38,7 @@
38
38
  "variants": 'inline',
39
39
  "iconPosition": 'before',
40
40
  "iconSize": params.iconSize | default("2xl"),
41
- "itemsList": [facebook, twitter]
41
+ "itemsList": [facebook, x]
42
42
  })
43
43
  }}
44
44
  {% endmacro %}
@@ -10,7 +10,7 @@ const EXAMPLE_SHARE_PAGE = {
10
10
  pageTitle: 'An example page',
11
11
  pageUrl: 'https://example.com/an-example-page',
12
12
  facebook: true,
13
- twitter: true,
13
+ x: true,
14
14
  };
15
15
 
16
16
  describe('macro: share-page', () => {
@@ -50,16 +50,16 @@ describe('macro: share-page', () => {
50
50
  expect(listsSpy.occurrences[0].iconSize).toBe('xl');
51
51
  });
52
52
 
53
- describe('Share on Twitter', () => {
53
+ describe('Share on X', () => {
54
54
  it('has a link with the expected url', () => {
55
55
  const faker = templateFaker();
56
56
  const listsSpy = faker.spy('list');
57
57
 
58
58
  faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
59
59
 
60
- const twitterItem = listsSpy.occurrences[0].itemsList.find((item) => item.text === 'Twitter');
61
- expect(twitterItem.url).toBe(
62
- 'https://twitter.com/intent/tweet?original_referer&text=An%20example%20page&url=https%3A%2F%2Fexample.com%2Fan-example-page',
60
+ const xItem = listsSpy.occurrences[0].itemsList.find((item) => item.text === 'X');
61
+ expect(xItem.url).toBe(
62
+ 'https://x.com/intent/tweet?original_referer&text=An%20example%20page&url=https%3A%2F%2Fexample.com%2Fan-example-page',
63
63
  );
64
64
  });
65
65
 
@@ -69,10 +69,10 @@ describe('macro: share-page', () => {
69
69
 
70
70
  faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
71
71
 
72
- const twitterItem = listsSpy.occurrences[0].itemsList.find((item) => item.text === 'Twitter');
73
- expect(twitterItem.rel).toContain('noreferrer');
74
- expect(twitterItem.rel).toContain('external');
75
- expect(twitterItem.target).toBe('_blank');
72
+ const xItem = listsSpy.occurrences[0].itemsList.find((item) => item.text === 'X');
73
+ expect(xItem.rel).toContain('noreferrer');
74
+ expect(xItem.rel).toContain('external');
75
+ expect(xItem.target).toBe('_blank');
76
76
  });
77
77
  });
78
78
 
@@ -6,6 +6,6 @@
6
6
  "pageTitle": 'A page to share',
7
7
  "pageUrl": 'https://example.com/a-page-to-share',
8
8
  "facebook": true,
9
- "twitter": true
9
+ "x": true
10
10
  })
11
11
  }}
@@ -2,22 +2,6 @@
2
2
  {% from "components/button/_macro.njk" import onsButton %}
3
3
  {% from "components/icon/_macro.njk" import onsIcon %}
4
4
  {% set variants = params.variants if params.variants %}
5
- {% set hasRowSpan = false %}
6
- {% for row in params.thList %}
7
- {% for th in row.ths %}
8
- {% if th.rowspan %}
9
- {% set hasRowSpan = true %}
10
- {% endif %}
11
- {% endfor %}
12
- {% endfor %}
13
-
14
- {% for row in params.trs %}
15
- {% for td in row.tds %}
16
- {% if td.rowspan %}
17
- {% set hasRowSpan = true %}
18
- {% endif %}
19
- {% endfor %}
20
- {% endfor %}
21
5
 
22
6
  <div class="ons-table-scrollable ons-table-scrollable--on">
23
7
  <div
@@ -26,15 +10,16 @@
26
10
  role="region"
27
11
  aria-label="{{ params.caption }}. {{ params.ariaLabel | default('Scrollable table') }}"
28
12
  >
13
+ {# Uses multiple loops to set the rowspan class so that it can work in both nunjucks and jinja2 environments due to the scoping rules of each language #}
29
14
  <table
30
15
  {% if params.id %}id="{{ params.id }}"{% endif %}
31
- class="ons-table{{ ' ' + params.tableClasses if params.tableClasses else '' }}{% if hasRowSpan %}{{ ' ' }}ons-table--has-rowspan{% endif %}{% if variants %}{% if variants is not string %}{% for variant in variants %}{{ ' ' }}ons-table--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-table--{{ variants }}{% endif %}{% endif %}"
16
+ class="ons-table{{ ' ' + params.tableClasses if params.tableClasses else '' }}{% for row in params.thList %}{% for th in row.ths %}{% if th.rowspan %}{{ ' ' }}ons-table--has-rowspan{% endif %}{% endfor %}{% endfor %}{% for row in params.trs %}{% for td in row.tds %}{% if td.rowspan %}{{ ' ' }}ons-table--has-rowspan{% endif %}{% endfor %}{% endfor %}{% if variants %}{% if variants is not string %}{% for variant in variants %}{{ ' ' }}ons-table--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-table--{{ variants }}{% endif %}{% endif %}"
32
17
  {% if params.sortBy and 'sortable' in variants %}
33
18
  data-aria-sort="{{ params.sortBy }}" data-aria-asc="{{ params.ariaAsc }}" data-aria-desc="{{ params.ariaDesc }}"
34
19
  {% endif %}
35
20
  >
36
21
  {% if params.caption %}
37
- <caption class="ons-table__caption{{ " ons-u-vh" if params.hideCaption }}">
22
+ <caption class="ons-table__caption{{ ' ons-u-vh' if params.hideCaption }}">
38
23
  {{ params.caption }}
39
24
  </caption>
40
25
  {% endif %}
@@ -43,7 +28,7 @@
43
28
  {% if params.thList %}
44
29
  {% set thGroups = params.thList %}
45
30
  {% else %}
46
- {% set thGroups = [ { ths: params.ths } ] %}
31
+ {% set thGroups = [ { "ths": params.ths } ] %}
47
32
  {% endif %}
48
33
  {% for headerCols in thGroups %}
49
34
  <tr class="ons-table__row">