@ons/design-system 73.9.1 → 73.10.0-beta.2

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 (60) hide show
  1. package/components/chart/_chart.scss +0 -9
  2. package/components/chart/_macro.njk +96 -128
  3. package/components/chart/_macro.spec.js +43 -28
  4. package/components/chart/example-area-chart-with-axis-min-and-max-values.njk +6 -3
  5. package/components/chart/example-area-chart.njk +6 -3
  6. package/components/chart/example-bar-chart-with-annotations.njk +6 -3
  7. package/components/chart/example-bar-chart-with-axis-min-and-max-values.njk +6 -3
  8. package/components/chart/example-bar-chart-with-point-range-and-reference-line-annotations.njk +6 -3
  9. package/components/chart/example-bar-chart.njk +6 -3
  10. package/components/chart/example-bar-with-confidence-levels.njk +6 -3
  11. package/components/chart/example-clustered-bar-chart.njk +6 -3
  12. package/components/chart/example-clustered-column-chart.njk +6 -3
  13. package/components/chart/example-column-chart-with-annotations.njk +6 -3
  14. package/components/chart/example-column-chart-with-axis-min-and-max-values.njk +6 -3
  15. package/components/chart/example-column-chart-with-custom-reference-line-value.njk +6 -3
  16. package/components/chart/example-column-chart-with-range-annotations.njk +6 -3
  17. package/components/chart/example-column-chart-with-reference-line-annotations.njk +6 -3
  18. package/components/chart/example-column-chart.njk +6 -3
  19. package/components/chart/example-column-with-confidence-levels.njk +6 -3
  20. package/components/chart/example-column-with-line-chart.njk +6 -3
  21. package/components/chart/example-iframe-chart.njk +6 -3
  22. package/components/chart/example-line-chart-with-annotations.njk +6 -3
  23. package/components/chart/example-line-chart-with-axis-min-and-max-values.njk +6 -3
  24. package/components/chart/example-line-chart-with-custom-reference-line-value.njk +6 -3
  25. package/components/chart/example-line-chart-with-label-format.njk +6 -3
  26. package/components/chart/example-line-chart-with-markers.njk +6 -3
  27. package/components/chart/example-line-chart-with-range-annotations-inside.njk +6 -3
  28. package/components/chart/example-line-chart-with-range-annotations-outside-left-right.njk +6 -3
  29. package/components/chart/example-line-chart-with-range-annotations-outside-top-bottom.njk +6 -3
  30. package/components/chart/example-line-chart-with-reference-line-annotations.njk +6 -3
  31. package/components/chart/example-line-chart.njk +6 -3
  32. package/components/chart/example-scatter-chart-with-axis-min-and-max-values.njk +6 -3
  33. package/components/chart/example-scatter-chart.njk +6 -3
  34. package/components/chart/example-stacked-bar-chart.njk +6 -3
  35. package/components/chart/example-stacked-column-chart.njk +6 -3
  36. package/components/featured-article/_macro.njk +3 -37
  37. package/components/featured-article/example-featured-article-with-chart.njk +19 -14
  38. package/components/featured-article/example-featured-article-with-image.njk +12 -7
  39. package/components/featured-article/featured-article.scss +1 -1
  40. package/components/featured-article/macro.spec.js +44 -67
  41. package/components/figure/_figure.scss +31 -0
  42. package/components/figure/_macro.njk +93 -0
  43. package/components/figure/_macro.spec.js +423 -0
  44. package/components/figure/example-figure-heading-level-2.njk +34 -0
  45. package/components/figure/example-figure-with-div.njk +29 -0
  46. package/components/figure/example-figure-without-footer.njk +12 -0
  47. package/components/figure/example-figure-without-header.njk +24 -0
  48. package/components/figure/example-figure.njk +34 -0
  49. package/components/image/_image.scss +0 -7
  50. package/components/image/_macro.njk +25 -14
  51. package/components/image/_macro.spec.js +122 -7
  52. package/components/image/example-image-with-figure-fields.njk +25 -0
  53. package/components/list/_macro.njk +1 -0
  54. package/components/list/_macro.spec.js +16 -0
  55. package/components/table/_macro.njk +125 -111
  56. package/components/table/_macro.spec.js +107 -2
  57. package/components/table/example-table-with-figure-fields.njk +85 -0
  58. package/css/main.css +1 -1
  59. package/package.json +2 -2
  60. package/scss/main.scss +1 -0
@@ -29,15 +29,6 @@
29
29
  outline-offset: 2px;
30
30
  }
31
31
 
32
- &__download-title {
33
- @extend .ons-u-pt-l;
34
- @extend .ons-u-fs-r--b;
35
- }
36
-
37
- &__caption {
38
- color: var(--ons-color-grey-75);
39
- }
40
-
41
32
  &__annotations-footnotes-number {
42
33
  // !important is necessary for some range annotation labels at mobile, otherwise
43
34
  // the inline-styled block display takes precedence. This inline style is only
@@ -1,21 +1,11 @@
1
- {% from "components/list/_macro.njk" import onsList %}
2
- {% from "components/details/_macro.njk" import onsDetails %}
3
-
4
1
  {% macro onsChart(params) %}
2
+ {% from "components/figure/_macro.njk" import onsFigure %}
5
3
  {% set supportedChartTypes = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
6
4
  {% set supportedChartTypesWithLine = ['column'] %}
7
5
  {% set supportedChartTypesWithScatter = ['columnrange'] %}
8
6
  {% set supportedChartTypesWithXAxisMinAndMax = ['scatter'] %}
9
7
  {% set supportedChartTypesWithYAxisMinAndMax = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
10
8
  {% set supportedAspectRatios = ['16-9', '4-3', '21-9', '1-1', '3-2', '9-16'] %}
11
- {% set headingLevel = params.headingLevel | default(2) %}
12
- {% set openingTitleTag = "<h" ~ headingLevel %}
13
- {% set closingTitleTag = "</h" ~ headingLevel ~ ">" %}
14
- {% set openingSubtitleTag = "<h" ~ (headingLevel + 1) %}
15
- {% set closingSubtitleTag = "</h" ~ (headingLevel + 1) ~ ">" %}
16
- {% set openingDownloadTitleTag = "<h" ~ (headingLevel + 2) %}
17
- {% set closingDownloadTitleTag = "</h" ~ (headingLevel + 2) ~ ">" %}
18
- {% set audioDescriptionId = "chart-audio-description-" ~ params.id %}
19
9
  {% set instructionsId = "chart-instructions-" ~ params.id %}
20
10
  {% set iframeAspectRatio = params.iframeAspectRatio if params.iframeAspectRatio in supportedAspectRatios else '16-9' %}
21
11
  {% set instructions = params.instructions | default('Use the Tab key to move focus into the chart. Once inside, use the arrow keys to navigate between data points. As you move, tooltips will be announced to describe each point. Touch device users, explore by touch or with swipe gestures.') %}
@@ -54,132 +44,110 @@
54
44
  {% endif %}
55
45
  {% endif %}
56
46
  >
57
- <figure class="ons-chart" aria-describedby="{{ audioDescriptionId }}">
58
- {{ openingTitleTag | safe }} class="ons-chart__title">{{ params.title }}{{ closingTitleTag | safe }}
59
- {% if params.subtitle %}
60
- {{ openingSubtitleTag | safe }}
61
- class="ons-chart__subtitle">{{ params.subtitle }}{{ closingSubtitleTag | safe }}
62
- {% endif %}
63
-
64
- <p class="ons-u-vh" id="{{ audioDescriptionId }}">{{ params.description }}</p>
65
-
66
- {% if params.iframeUrl %}
67
- <div
68
- class="ons-chart__iframe-wrapper{{ ' ons-chart__non-js-hide' if params.fallbackImageUrl else '' }}"
69
- id="{{ params.id }}"
70
- >
71
- <iframe
72
- src="{{ params.iframeUrl }}"
73
- title="{{ params.title }}"
74
- class="ons-chart__iframe ons-chart__iframe--{{ iframeAspectRatio }}"
75
- frameborder="0"
76
- scrolling="no"
77
- ></iframe>
78
- </div>
79
- {% else %}
80
- {% if params.chartType == 'boxplot' and (params.estimateLineLabel or params.uncertaintyRangeLabel) and params.legend == true %}
81
- <div class="ons-chart__boxplot-legend">
82
- {% if params.uncertaintyRangeLabel %}
83
- <div class="ons-chart__boxplot-legend-item">
84
- <span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--uncertainty"></span>
85
- <span class="ons-chart__boxplot-legend-label">{{ params.uncertaintyRangeLabel }}</span>
86
- </div>
87
- {% endif %}
88
- {% if params.estimateLineLabel %}
89
- <div class="ons-chart__boxplot-legend-item">
90
- <span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--estimate"></span>
91
- <span class="ons-chart__boxplot-legend-label">{{ params.estimateLineLabel }}</span>
92
- </div>
93
- {% endif %}
94
- </div>
95
- {% endif %}
96
- {% if params.chartType in supportedChartTypes %}
47
+ {%
48
+ call onsFigure({
49
+ "id": params.id,
50
+ "headingLevel": params.headingLevel,
51
+ "figureNumber": params.figureNumber,
52
+ "title": params.title,
53
+ "subtitle": params.subtitle,
54
+ "audioDescription": params.description,
55
+ "caption": params.caption,
56
+ "footnotes": params.footnotes,
57
+ "download": params.download
58
+ })
59
+ %}
60
+ <div class="ons-chart">
61
+ {% if params.iframeUrl %}
97
62
  <div
98
- data-highcharts-chart-container
99
- class="ons-chart__container"
100
- tabindex="0"
101
- role="region"
102
- aria-label="chart container"
103
- aria-describedby="{{ instructionsId }}"
63
+ class="ons-chart__iframe-wrapper{{ ' ons-chart__non-js-hide' if params.fallbackImageUrl else '' }}"
64
+ id="iframe--{{ params.id }}"
104
65
  >
105
- <div id="{{ instructionsId }}" class="ons-u-vh">{{ instructions }}</div>
106
- <div data-highcharts-chart class="ons-chart__chart"></div>
66
+ <iframe
67
+ src="{{ params.iframeUrl }}"
68
+ title="{{ params.title }}"
69
+ class="ons-chart__iframe ons-chart__iframe--{{ iframeAspectRatio }}"
70
+ frameborder="0"
71
+ scrolling="no"
72
+ ></iframe>
107
73
  </div>
108
74
  {% else %}
109
- <p data-invalid-chart-type data-unsupported-chart-text>
110
- <b>{{ '"' + params.chartType + '" - ' + (params.unsupportedChartText or 'chart type is not supported') }}</b>
111
- </p>
75
+ {% if params.chartType == 'boxplot' and (params.estimateLineLabel or params.uncertaintyRangeLabel) and params.legend == true %}
76
+ <div class="ons-chart__boxplot-legend">
77
+ {% if params.uncertaintyRangeLabel %}
78
+ <div class="ons-chart__boxplot-legend-item">
79
+ <span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--uncertainty"></span>
80
+ <span class="ons-chart__boxplot-legend-label">{{ params.uncertaintyRangeLabel }}</span>
81
+ </div>
82
+ {% endif %}
83
+ {% if params.estimateLineLabel %}
84
+ <div class="ons-chart__boxplot-legend-item">
85
+ <span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--estimate"></span>
86
+ <span class="ons-chart__boxplot-legend-label">{{ params.estimateLineLabel }}</span>
87
+ </div>
88
+ {% endif %}
89
+ </div>
90
+ {% endif %}
91
+ {% if params.chartType in supportedChartTypes %}
92
+ <div
93
+ data-highcharts-chart-container
94
+ class="ons-chart__container"
95
+ tabindex="0"
96
+ role="region"
97
+ aria-label="chart container"
98
+ aria-describedby="{{ instructionsId }}"
99
+ >
100
+ <div id="{{ instructionsId }}" class="ons-u-vh">{{ instructions }}</div>
101
+ <div data-highcharts-chart class="ons-chart__chart"></div>
102
+ </div>
103
+ {% else %}
104
+ <p data-invalid-chart-type data-unsupported-chart-text>
105
+ <b>{{ '"' + params.chartType + '" - ' + (params.unsupportedChartText or 'chart type is not supported') }}</b>
106
+ </p>
107
+ {% endif %}
112
108
  {% endif %}
113
- {% endif %}
114
109
 
115
- {% if params.fallbackImageUrl %}
116
- {% set fallbackImageId = ["fallback-image--", params.id] | join %}
117
- <noscript id="{{ fallbackImageId }}">
118
- {# Note that a more detailed description of the chart is provided in the audio description above #}
119
- <img
120
- src="{{ params.fallbackImageUrl }}"
121
- alt="{{ params.fallbackImageAlt or 'Fallback image for the chart as JavaScript is disabled' }}"
122
- class="ons-chart__fallback-image"
123
- />
124
- </noscript>
125
- {% endif %}
126
- {#
110
+ {% if params.fallbackImageUrl %}
111
+ {% set fallbackImageId = ["fallback-image--", params.id] | join %}
112
+ <noscript id="{{ fallbackImageId }}">
113
+ {# Note that a more detailed description of the chart is provided in the figure's audio description #}
114
+ <img
115
+ src="{{ params.fallbackImageUrl }}"
116
+ alt="{{ params.fallbackImageAlt or 'Fallback image for the chart as JavaScript is disabled' }}"
117
+ class="ons-chart__fallback-image"
118
+ />
119
+ </noscript>
120
+ {% endif %}
121
+ {#
127
122
  Footnotes for the annotations at mobile
128
123
  Hidden from screen readers because the full text will be read out where they appear in the chart
129
124
  #}
130
- {% if (params.annotations or params.rangeAnnotations or params.referenceLineAnnotations) and not params.iframeUrl %}
131
- <ul class="ons-chart__annotations-footnotes" aria-hidden="true" data-annotations-footnotes>
132
- {% for annotation in params.annotations %}
133
- <li class="ons-chart__annotations-footnotes_item">
134
- <span class="ons-chart__annotations-footnotes-number">{{ loop.index }}</span>
135
- {{ annotation.text }}
136
- </li>
137
- {% endfor %}
138
- {% for rangeAnnotation in params.rangeAnnotations %}
139
- <li class="ons-chart__annotations-footnotes_item">
140
- <span class="ons-chart__annotations-footnotes-number">{{ loop.index + params.annotations | length }}</span>
141
- {{ rangeAnnotation.text }}
142
- </li>
143
- {% endfor %}
144
- {% for referenceLineAnnotation in params.referenceLineAnnotations %}
145
- <li class="ons-chart__annotations-footnotes_item">
146
- <span class="ons-chart__annotations-footnotes-number"
147
- >{{ loop.index + params.annotations | length + params.rangeAnnotations | length }}</span
148
- >
149
- {{ referenceLineAnnotation.text }}
150
- </li>
151
- {% endfor %}
152
- </ul>
153
- {% endif %}
154
- {% if params.caption %}
155
- <figcaption class="ons-chart__caption">{{ params.caption }}</figcaption>
156
- {% endif %}
157
- </figure>
158
-
159
- {% if params.download.title and params.download.itemsList | length > 0 %}
160
- {{ openingDownloadTitleTag | safe }}
161
- class="ons-chart__download-title">{{ params.download.title }}{{ closingDownloadTitleTag | safe }}
162
- {{
163
- onsList({
164
- "element": "ol",
165
- "itemsList": params.download.itemsList
166
- })
167
- }}
168
- {% endif %}
169
-
170
- {% if params.footnotes %}
171
- {% set footnotesId = ["footnotes--", params.id] | join %}
172
-
173
- {{
174
- onsDetails({
175
- "id": footnotesId,
176
- "title": params.footnotes.title,
177
- "content": params.footnotes.content,
178
- "headingLevel": headingLevel + 2,
179
- "classes": "ons-u-mt-xl"
180
- })
181
- }}
182
- {% endif %}
125
+ {% if (params.annotations or params.rangeAnnotations or params.referenceLineAnnotations) and not params.iframeUrl %}
126
+ <ul class="ons-chart__annotations-footnotes" aria-hidden="true" data-annotations-footnotes>
127
+ {% for annotation in params.annotations %}
128
+ <li class="ons-chart__annotations-footnotes_item">
129
+ <span class="ons-chart__annotations-footnotes-number">{{ loop.index }}</span>
130
+ {{ annotation.text }}
131
+ </li>
132
+ {% endfor %}
133
+ {% for rangeAnnotation in params.rangeAnnotations %}
134
+ <li class="ons-chart__annotations-footnotes_item">
135
+ <span class="ons-chart__annotations-footnotes-number">{{ loop.index + params.annotations | length }}</span>
136
+ {{ rangeAnnotation.text }}
137
+ </li>
138
+ {% endfor %}
139
+ {% for referenceLineAnnotation in params.referenceLineAnnotations %}
140
+ <li class="ons-chart__annotations-footnotes_item">
141
+ <span class="ons-chart__annotations-footnotes-number"
142
+ >{{ loop.index + params.annotations | length + params.rangeAnnotations | length }}</span
143
+ >
144
+ {{ referenceLineAnnotation.text }}
145
+ </li>
146
+ {% endfor %}
147
+ </ul>
148
+ {% endif %}
149
+ </div>
150
+ {% endcall %}
183
151
 
184
152
  {% if (params.chartType in supportedChartTypes) and not params.iframeUrl %}
185
153
  {% set series = [] %}
@@ -40,11 +40,11 @@ describe('Macro: Chart', () => {
40
40
  });
41
41
 
42
42
  test('THEN: it renders the title', () => {
43
- expect($('.ons-chart__title').text()).toBe('Example Line Chart');
43
+ expect($('.ons-figure__title').text()).toBe('Example Line Chart');
44
44
  });
45
45
 
46
46
  test('THEN: it renders the subtitle', () => {
47
- expect($('.ons-chart__subtitle').text()).toBe('A sample subtitle');
47
+ expect($('.ons-figure__subtitle').text()).toBe('A sample subtitle');
48
48
  });
49
49
 
50
50
  test('THEN: it renders the chart container with the correct data attributes', () => {
@@ -61,7 +61,7 @@ describe('Macro: Chart', () => {
61
61
 
62
62
  test('THEN: it does NOT render optional fields', () => {
63
63
  expect($('figcaption').length).toBe(0);
64
- expect($('.ons-chart__download-title').length).toBe(0);
64
+ expect($('.ons-details__title').length).toBe(0);
65
65
  });
66
66
 
67
67
  test('THEN: it renders the chart container with the correct aria attributes', () => {
@@ -128,15 +128,30 @@ describe('Macro: Chart', () => {
128
128
  );
129
129
 
130
130
  test('THEN: renders title with correct tag', () => {
131
- expect($('.ons-chart__title')[0].tagName).toBe('h3');
131
+ expect($('.ons-figure__title')[0].tagName).toBe('h3');
132
132
  });
133
133
 
134
134
  test('THEN: renders subtitle with correct tag', () => {
135
- expect($('.ons-chart__subtitle')[0].tagName).toBe('h4');
135
+ expect($('.ons-figure__subtitle')[0].tagName).toBe('h4');
136
136
  });
137
137
 
138
138
  test('THEN: renders download title with correct tag', () => {
139
- expect($('.ons-chart__download-title')[0].tagName).toBe('h5');
139
+ expect($('.ons-details__title')[0].tagName).toBe('h5');
140
+ });
141
+ });
142
+ });
143
+
144
+ describe('GIVEN: Params: figureNumber', () => {
145
+ describe('WHEN: figureNumber is provided', () => {
146
+ const $ = cheerio.load(
147
+ renderComponent('chart', {
148
+ ...EXAMPLE_LINE_CHART_REQUIRED_PARAMS,
149
+ figureNumber: 'Figure 1',
150
+ }),
151
+ );
152
+
153
+ test('THEN: it renders the figure number', () => {
154
+ expect($('.ons-figure__number').text()).toBe('Figure 1');
140
155
  });
141
156
  });
142
157
  });
@@ -455,7 +470,7 @@ describe('Macro: Chart', () => {
455
470
  );
456
471
 
457
472
  test('THEN: it renders the description for accessibility', () => {
458
- expect($('#chart-audio-description-chart-123').text()).toBe('An accessible description for screen readers.');
473
+ expect($('#figure-audio-description-chart-123').text()).toBe('An accessible description for screen readers.');
459
474
  });
460
475
  });
461
476
  });
@@ -476,9 +491,9 @@ describe('Macro: Chart', () => {
476
491
  );
477
492
 
478
493
  test('THEN: it renders the download section correctly', () => {
479
- expect($('.ons-chart__download-title').text()).toBe('Download Chart Data');
494
+ expect($('.ons-details__title').text()).toBe('Download Chart Data');
480
495
 
481
- const downloadLinks = $('.ons-chart__download-title').next().find('li a');
496
+ const downloadLinks = $('.ons-details__content li a');
482
497
  expect(downloadLinks.eq(0).text()).toBe('Download as PNG');
483
498
  expect(downloadLinks.eq(0).attr('href')).toBe('https://example.com/chart.png');
484
499
  expect(downloadLinks.eq(1).text()).toBe('Download as CSV');
@@ -689,7 +704,7 @@ describe('Macro: Chart', () => {
689
704
 
690
705
  test('THEN: it does NOT render optional fields', () => {
691
706
  expect($('figcaption').length).toBe(0);
692
- expect($('.ons-chart__download-title').length).toBe(0);
707
+ expect($('.ons-details__title').length).toBe(0);
693
708
  });
694
709
 
695
710
  test('THEN: it includes the Highcharts JSON config', () => {
@@ -895,7 +910,7 @@ describe('Macro: Chart', () => {
895
910
  );
896
911
 
897
912
  test('THEN: it renders the description for accessibility', () => {
898
- expect($('#chart-audio-description-bar-chart-123').text()).toBe('An accessible description for screen readers.');
913
+ expect($('#figure-audio-description-bar-chart-123').text()).toBe('An accessible description for screen readers.');
899
914
  });
900
915
  });
901
916
  });
@@ -916,9 +931,9 @@ describe('Macro: Chart', () => {
916
931
  );
917
932
 
918
933
  test('THEN: it renders the download section correctly', () => {
919
- expect($('.ons-chart__download-title').text()).toBe('Download Chart Data');
934
+ expect($('.ons-details__title').text()).toBe('Download Chart Data');
920
935
 
921
- const downloadLinks = $('.ons-chart__download-title').next().find('li a');
936
+ const downloadLinks = $('.ons-details__content li a');
922
937
  expect(downloadLinks.eq(0).text()).toBe('Download as PNG');
923
938
  expect(downloadLinks.eq(0).attr('href')).toBe('https://example.com/chart.png');
924
939
  expect(downloadLinks.eq(1).text()).toBe('Download as CSV');
@@ -1009,7 +1024,7 @@ describe('Macro: Chart', () => {
1009
1024
 
1010
1025
  test('THEN: it does NOT render optional fields', () => {
1011
1026
  expect($('figcaption').length).toBe(0);
1012
- expect($('.ons-chart__download-title').length).toBe(0);
1027
+ expect($('.ons-details__title').length).toBe(0);
1013
1028
  });
1014
1029
 
1015
1030
  test('THEN: it includes the Highcharts JSON config', () => {
@@ -1180,7 +1195,7 @@ describe('Macro: Chart', () => {
1180
1195
  );
1181
1196
 
1182
1197
  test('THEN: it renders the description for accessibility', () => {
1183
- expect($('#chart-audio-description-column-chart-123').text()).toBe('An accessible description for screen readers.');
1198
+ expect($('#figure-audio-description-column-chart-123').text()).toBe('An accessible description for screen readers.');
1184
1199
  });
1185
1200
  });
1186
1201
  });
@@ -1201,9 +1216,9 @@ describe('Macro: Chart', () => {
1201
1216
  );
1202
1217
 
1203
1218
  test('THEN: it renders the download section correctly', () => {
1204
- expect($('.ons-chart__download-title').text()).toBe('Download Chart Data');
1219
+ expect($('.ons-details__title').text()).toBe('Download Chart Data');
1205
1220
 
1206
- const downloadLinks = $('.ons-chart__download-title').next().find('li a');
1221
+ const downloadLinks = $('.ons-details__content li a');
1207
1222
  expect(downloadLinks.eq(0).text()).toBe('Download as PNG');
1208
1223
  expect(downloadLinks.eq(0).attr('href')).toBe('https://example.com/chart.png');
1209
1224
  expect(downloadLinks.eq(1).text()).toBe('Download as CSV');
@@ -1549,7 +1564,7 @@ describe('Macro: Chart', () => {
1549
1564
  );
1550
1565
 
1551
1566
  test('THEN: it renders the description for accessibility', () => {
1552
- expect($('#chart-audio-description-area-chart-123').text()).toBe('An accessible description for screen readers.');
1567
+ expect($('#figure-audio-description-area-chart-123').text()).toBe('An accessible description for screen readers.');
1553
1568
  });
1554
1569
  });
1555
1570
  });
@@ -1570,9 +1585,9 @@ describe('Macro: Chart', () => {
1570
1585
  );
1571
1586
 
1572
1587
  test('THEN: it renders the download section correctly', () => {
1573
- expect($('.ons-chart__download-title').text()).toBe('Download Chart Data');
1588
+ expect($('.ons-details__title').text()).toBe('Download Chart Data');
1574
1589
 
1575
- const downloadLinks = $('.ons-chart__download-title').next().find('li a');
1590
+ const downloadLinks = $('.ons-details__content li a');
1576
1591
  expect(downloadLinks.eq(0).text()).toBe('Download as PNG');
1577
1592
  expect(downloadLinks.eq(0).attr('href')).toBe('https://example.com/chart.png');
1578
1593
  expect(downloadLinks.eq(1).text()).toBe('Download as CSV');
@@ -1594,9 +1609,9 @@ describe('Macro: Chart', () => {
1594
1609
  }),
1595
1610
  );
1596
1611
  test('THEN: it renders the footnotes', () => {
1597
- expect($('#footnotes--area-chart-123').length).toBe(1);
1598
- expect($('#footnotes--area-chart-123').find('ol').length).toBe(1);
1599
- expect($('#footnotes--area-chart-123').text()).toContain('Footnotes');
1612
+ expect($('#figure-footnotes--area-chart-123').length).toBe(1);
1613
+ expect($('#figure-footnotes--area-chart-123').find('ol').length).toBe(1);
1614
+ expect($('#figure-footnotes--area-chart-123').text()).toContain('Footnotes');
1600
1615
  });
1601
1616
  });
1602
1617
  });
@@ -1795,7 +1810,7 @@ describe('Macro: Chart', () => {
1795
1810
  );
1796
1811
 
1797
1812
  test('THEN: it renders the description for accessibility', () => {
1798
- expect($('#chart-audio-description-boxplot-chart-123').text()).toBe(accessibleDescription);
1813
+ expect($('#figure-audio-description-boxplot-chart-123').text()).toBe(accessibleDescription);
1799
1814
  });
1800
1815
  });
1801
1816
  });
@@ -2019,15 +2034,15 @@ describe('Macro: Chart', () => {
2019
2034
  });
2020
2035
 
2021
2036
  test('THEN: it still renders the title', () => {
2022
- expect($('.ons-chart__title').text()).toBe('Example Invalid Chart');
2037
+ expect($('.ons-figure__title').text()).toBe('Example Invalid Chart');
2023
2038
  });
2024
2039
 
2025
2040
  test('THEN: it still renders the subtitle', () => {
2026
- expect($('.ons-chart__subtitle').text()).toBe('A sample subtitle');
2041
+ expect($('.ons-figure__subtitle').text()).toBe('A sample subtitle');
2027
2042
  });
2028
2043
 
2029
2044
  test('THEN: it still renders the description', () => {
2030
- expect($('#chart-audio-description-invalid-chart-123').text()).toBe('A detailed description');
2045
+ expect($('#figure-audio-description-invalid-chart-123').text()).toBe('A detailed description');
2031
2046
  });
2032
2047
 
2033
2048
  test('THEN: it still renders the caption', () => {
@@ -2035,7 +2050,7 @@ describe('Macro: Chart', () => {
2035
2050
  });
2036
2051
 
2037
2052
  test('THEN: it still renders the download', () => {
2038
- expect($('.ons-chart__download-title').text()).toBe('Download this chart');
2053
+ expect($('.ons-details__title').text()).toBe('Download this chart');
2039
2054
  });
2040
2055
  });
2041
2056
  });
@@ -15,16 +15,19 @@
15
15
  'itemsList': [
16
16
  {
17
17
  "text": "Excel spreadsheet (XLSX format, 18KB)",
18
- "url": "#"
18
+ "url": "#",
19
+ "download": "file"
19
20
  },
20
21
  {
21
22
  "text": "Simple text file (CSV format, 25KB)",
22
- "url": "#"
23
+ "url": "#",
24
+ "download": "file"
23
25
  },
24
26
  {
25
27
 
26
28
  "text": "Image (PNG format, 25KB)",
27
- "url": "#"
29
+ "url": "#",
30
+ "download": "file"
28
31
  }
29
32
  ]},
30
33
  "legend": "true",
@@ -15,16 +15,19 @@
15
15
  'itemsList': [
16
16
  {
17
17
  "text": "Excel spreadsheet (XLSX format, 18KB)",
18
- "url": "#"
18
+ "url": "#",
19
+ "download": "file"
19
20
  },
20
21
  {
21
22
  "text": "Simple text file (CSV format, 25KB)",
22
- "url": "#"
23
+ "url": "#",
24
+ "download": "file"
23
25
  },
24
26
  {
25
27
 
26
28
  "text": "Image (PNG format, 25KB)",
27
- "url": "#"
29
+ "url": "#",
30
+ "download": "file"
28
31
  }
29
32
  ]},
30
33
  "legend": "true",
@@ -14,15 +14,18 @@
14
14
  'itemsList': [
15
15
  {
16
16
  "text": "Excel spreadsheet (XLSX format, 18KB)",
17
- "url": "#"
17
+ "url": "#",
18
+ "download": "file"
18
19
  },
19
20
  {
20
21
  "text": "Simple text file (CSV format, 25KB)",
21
- "url": "#"
22
+ "url": "#",
23
+ "download": "file"
22
24
  },
23
25
  {
24
26
  "text": "Image (PNG format, 25KB)",
25
- "url": "#"
27
+ "url": "#",
28
+ "download": "file"
26
29
  }
27
30
  ]
28
31
  },
@@ -14,15 +14,18 @@
14
14
  'itemsList': [
15
15
  {
16
16
  "text": "Excel spreadsheet (XLSX format, 18KB)",
17
- "url": "#"
17
+ "url": "#",
18
+ "download": "file"
18
19
  },
19
20
  {
20
21
  "text": "Simple text file (CSV format, 25KB)",
21
- "url": "#"
22
+ "url": "#",
23
+ "download": "file"
22
24
  },
23
25
  {
24
26
  "text": "Image (PNG format, 25KB)",
25
- "url": "#"
27
+ "url": "#",
28
+ "download": "file"
26
29
  }
27
30
  ]
28
31
  },
@@ -14,15 +14,18 @@
14
14
  'itemsList': [
15
15
  {
16
16
  "text": "Excel spreadsheet (XLSX format, 18KB)",
17
- "url": "#"
17
+ "url": "#",
18
+ "download": "file"
18
19
  },
19
20
  {
20
21
  "text": "Simple text file (CSV format, 25KB)",
21
- "url": "#"
22
+ "url": "#",
23
+ "download": "file"
22
24
  },
23
25
  {
24
26
  "text": "Image (PNG format, 25KB)",
25
- "url": "#"
27
+ "url": "#",
28
+ "download": "file"
26
29
  }
27
30
  ]
28
31
  },
@@ -14,15 +14,18 @@
14
14
  'itemsList': [
15
15
  {
16
16
  "text": "Excel spreadsheet (XLSX format, 18KB)",
17
- "url": "#"
17
+ "url": "#",
18
+ "download": "file"
18
19
  },
19
20
  {
20
21
  "text": "Simple text file (CSV format, 25KB)",
21
- "url": "#"
22
+ "url": "#",
23
+ "download": "file"
22
24
  },
23
25
  {
24
26
  "text": "Image (PNG format, 25KB)",
25
- "url": "#"
27
+ "url": "#",
28
+ "download": "file"
26
29
  }
27
30
  ]
28
31
  },
@@ -13,15 +13,18 @@
13
13
  'itemsList': [
14
14
  {
15
15
  "text": "Excel spreadsheet (XLSX format, 18KB)",
16
- "url": "#"
16
+ "url": "#",
17
+ "download": "file"
17
18
  },
18
19
  {
19
20
  "text": "Simple text file (CSV format, 25KB)",
20
- "url": "#"
21
+ "url": "#",
22
+ "download": "file"
21
23
  },
22
24
  {
23
25
  "text": "Image (PNG format, 25KB)",
24
- "url": "#"
26
+ "url": "#",
27
+ "download": "file"
25
28
  }
26
29
  ]
27
30
  },