@ons/design-system 74.0.0-next.14 → 74.0.0-next.16
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.
- package/README.md +1 -1
- package/components/card/example-card-set-with-headline-figures.njk +4 -4
- package/components/chart/_chart.scss +0 -12
- package/components/chart/_macro.njk +62 -80
- package/components/chart/_macro.spec.js +0 -240
- package/components/chart/bar-chart.js +6 -1
- package/components/cookies-banner/_macro.njk +1 -1
- package/components/cookies-banner/_macro.spec.js +15 -3
- package/components/header/_macro.njk +4 -0
- package/components/message/_message.scss +3 -3
- package/components/summary/_macro.njk +3 -2
- package/components/summary/_summary.scss +6 -1
- package/components/table-of-contents/example-table-of-contents-sticky-full-page-ordered.njk +104 -106
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +103 -105
- package/components/table-of-contents/example-table-of-contents-sticky.njk +1 -1
- package/css/main.css +1 -1
- package/js/chart.js +0 -2
- package/js/cookies-functions.js +31 -42
- package/js/cookies-functions.spec.js +90 -46
- package/layout/_template.njk +1 -1
- package/package.json +2 -3
- package/scripts/chart.es5.js +1 -3
- package/scripts/chart.js +1 -3
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/objects/_container.scss +21 -4
- package/scss/utilities/_grid.scss +10 -25
- package/scss/vars/_forms.scss +0 -11
- package/scss/vars/_grid.scss +22 -3
- package/scss/vars/_utilities.scss +1 -1
- package/components/chart/chart-iframe-resize.dom.js +0 -8
- package/components/chart/chart-iframe-resize.js +0 -16
- package/components/chart/example-iframe-chart.njk +0 -36
package/README.md
CHANGED
|
@@ -149,7 +149,7 @@ Checkout the branch locally and run:
|
|
|
149
149
|
|
|
150
150
|
If the VR tests fail locally, you'll see an error starting with `Error: docker run --rm -i --add-host=host.docker.internal:host-gateway...`
|
|
151
151
|
|
|
152
|
-
`npx http-server backstop_data -p 8008 -o /html_report/` - View the report in your browser.
|
|
152
|
+
`npx http-server backstop_data -p 8008 -c-1 -o /html_report/` - View the report in your browser.
|
|
153
153
|
|
|
154
154
|
### Approving VR test reference image changes
|
|
155
155
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{% from "components/card/_macro.njk" import onsCard %}
|
|
2
2
|
|
|
3
3
|
<div class="ons-container">
|
|
4
|
-
<div class="ons-grid ons-grid-flex-gap
|
|
5
|
-
<div class="ons-grid__col ons-grid__col--flex-col
|
|
4
|
+
<div class="ons-grid ons-grid-flex-gap">
|
|
5
|
+
<div class="ons-grid__col ons-grid__col--flex-col">
|
|
6
6
|
{{
|
|
7
7
|
onsCard({
|
|
8
8
|
"variant": 'feature',
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}}
|
|
21
21
|
</div>
|
|
22
22
|
|
|
23
|
-
<div class="ons-grid__col ons-grid__col--flex-col
|
|
23
|
+
<div class="ons-grid__col ons-grid__col--flex-col">
|
|
24
24
|
{{
|
|
25
25
|
onsCard({
|
|
26
26
|
"variant": 'feature',
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}}
|
|
39
39
|
</div>
|
|
40
40
|
|
|
41
|
-
<div class="ons-grid__col ons-grid__col--flex-col
|
|
41
|
+
<div class="ons-grid__col ons-grid__col--flex-col">
|
|
42
42
|
{{
|
|
43
43
|
onsCard({
|
|
44
44
|
"variant": 'feature',
|
|
@@ -113,16 +113,6 @@
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
&__iframe {
|
|
117
|
-
width: 100%;
|
|
118
|
-
aspect-ratio: 16 / 9; // Default aspect ratio
|
|
119
|
-
|
|
120
|
-
@media (scripting: none) {
|
|
121
|
-
// Approximately matches the aspect ratio of the fallback image inside the iframe
|
|
122
|
-
aspect-ratio: 16 / 9;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
116
|
&__non-js-hide {
|
|
127
117
|
@media (scripting: none) {
|
|
128
118
|
display: none;
|
|
@@ -130,8 +120,6 @@
|
|
|
130
120
|
}
|
|
131
121
|
}
|
|
132
122
|
|
|
133
|
-
@include iframe-aspect-ratio('ons-chart__iframe--{x}');
|
|
134
|
-
|
|
135
123
|
// This is a workaround to position the axis title to the left
|
|
136
124
|
.highcharts-axis-title {
|
|
137
125
|
width: 100%;
|
|
@@ -7,44 +7,41 @@
|
|
|
7
7
|
{% set supportedChartTypesWithYAxisMinAndMax = ['line', 'bar', 'column', 'scatter', 'area', 'columnrange', 'boxplot'] %}
|
|
8
8
|
{% set supportedAspectRatios = ['16-9', '4-3', '21-9', '1-1', '3-2', '9-16'] %}
|
|
9
9
|
{% set instructionsId = "chart-instructions-" ~ params.id %}
|
|
10
|
-
{% set iframeAspectRatio = params.iframeAspectRatio if params.iframeAspectRatio in supportedAspectRatios else '16-9' %}
|
|
11
10
|
{% 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.') %}
|
|
12
11
|
|
|
13
12
|
<div
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
{
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{
|
|
46
|
-
data-highcharts-data-label-decimal-points="{{ params.dataLabelDecimalPoints }}"
|
|
47
|
-
{% endif %}
|
|
13
|
+
data-highcharts-base-chart data-highcharts-type="{{ params.chartType }}" data-highcharts-theme="{{ params.theme }}"
|
|
14
|
+
data-highcharts-title="{{ params.title }}" data-highcharts-id="{{ params.id }}"
|
|
15
|
+
{% if params.useStackedLayout %}data-highcharts-use-stacked-layout="{{ params.useStackedLayout }}"{% endif %}
|
|
16
|
+
{% if params.percentageHeightDesktop and params.chartType != 'bar' %}
|
|
17
|
+
data-highcharts-percentage-height-desktop="{{ params.percentageHeightDesktop }}"
|
|
18
|
+
{% endif %}
|
|
19
|
+
{% if params.percentageHeightMobile and params.chartType != 'bar' %}
|
|
20
|
+
data-highcharts-percentage-height-mobile="{{ params.percentageHeightMobile }}"
|
|
21
|
+
{% endif %}
|
|
22
|
+
{% if params.xAxis.tickIntervalMobile %}
|
|
23
|
+
data-highcharts-x-axis-tick-interval-mobile="{{ params.xAxis.tickIntervalMobile }}"
|
|
24
|
+
{% endif %}
|
|
25
|
+
{% if params.xAxis.tickIntervalDesktop %}
|
|
26
|
+
data-highcharts-x-axis-tick-interval-desktop="{{ params.xAxis.tickIntervalDesktop }}"
|
|
27
|
+
{% endif %}
|
|
28
|
+
{% if params.yAxis.tickIntervalMobile %}
|
|
29
|
+
data-highcharts-y-axis-tick-interval-mobile="{{ params.yAxis.tickIntervalMobile }}"
|
|
30
|
+
{% endif %}
|
|
31
|
+
{% if params.yAxis.tickIntervalDesktop %}
|
|
32
|
+
data-highcharts-y-axis-tick-interval-desktop="{{ params.yAxis.tickIntervalDesktop }}"
|
|
33
|
+
{% endif %}
|
|
34
|
+
{% if params.estimateLineLabel %}
|
|
35
|
+
data-highcharts-estimate-line-label="{{ params.estimateLineLabel }}"
|
|
36
|
+
{% endif %}
|
|
37
|
+
{% if params.uncertaintyRangeLabel %}
|
|
38
|
+
data-highcharts-uncertainty-range-label="{{ params.uncertaintyRangeLabel }}"
|
|
39
|
+
{% endif %}
|
|
40
|
+
{% if params.yAxis.customReferenceLineValue %}
|
|
41
|
+
data-highcharts-custom-reference-line-value="{{ params.yAxis.customReferenceLineValue }}"
|
|
42
|
+
{% endif %}
|
|
43
|
+
{% if params.dataLabelDecimalPoints and params.dataLabelDecimalPoints >= 1 and params.dataLabelDecimalPoints <= 2 %}
|
|
44
|
+
data-highcharts-data-label-decimal-points="{{ params.dataLabelDecimalPoints }}"
|
|
48
45
|
{% endif %}
|
|
49
46
|
>
|
|
50
47
|
{%
|
|
@@ -61,53 +58,38 @@
|
|
|
61
58
|
})
|
|
62
59
|
%}
|
|
63
60
|
<div class="ons-chart">
|
|
64
|
-
{% if params.
|
|
61
|
+
{% if params.chartType == 'boxplot' and (params.estimateLineLabel or params.uncertaintyRangeLabel) and params.legend == true %}
|
|
62
|
+
<div class="ons-chart__boxplot-legend">
|
|
63
|
+
{% if params.uncertaintyRangeLabel %}
|
|
64
|
+
<div class="ons-chart__boxplot-legend-item">
|
|
65
|
+
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--uncertainty"></span>
|
|
66
|
+
<span class="ons-chart__boxplot-legend-label">{{ params.uncertaintyRangeLabel }}</span>
|
|
67
|
+
</div>
|
|
68
|
+
{% endif %}
|
|
69
|
+
{% if params.estimateLineLabel %}
|
|
70
|
+
<div class="ons-chart__boxplot-legend-item">
|
|
71
|
+
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--estimate"></span>
|
|
72
|
+
<span class="ons-chart__boxplot-legend-label">{{ params.estimateLineLabel }}</span>
|
|
73
|
+
</div>
|
|
74
|
+
{% endif %}
|
|
75
|
+
</div>
|
|
76
|
+
{% endif %}
|
|
77
|
+
{% if params.chartType in supportedChartTypes %}
|
|
65
78
|
<div
|
|
66
|
-
|
|
67
|
-
|
|
79
|
+
data-highcharts-chart-container
|
|
80
|
+
class="ons-chart__container"
|
|
81
|
+
tabindex="0"
|
|
82
|
+
role="region"
|
|
83
|
+
aria-label="chart container"
|
|
84
|
+
aria-describedby="{{ instructionsId }}"
|
|
68
85
|
>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
title="{{ params.title }}"
|
|
72
|
-
class="ons-chart__iframe ons-chart__iframe--{{ iframeAspectRatio }}"
|
|
73
|
-
frameborder="0"
|
|
74
|
-
scrolling="no"
|
|
75
|
-
></iframe>
|
|
86
|
+
<div id="{{ instructionsId }}" class="ons-u-vh">{{ instructions }}</div>
|
|
87
|
+
<div data-highcharts-chart class="ons-chart__chart"></div>
|
|
76
88
|
</div>
|
|
77
89
|
{% else %}
|
|
78
|
-
|
|
79
|
-
<
|
|
80
|
-
|
|
81
|
-
<div class="ons-chart__boxplot-legend-item">
|
|
82
|
-
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--uncertainty"></span>
|
|
83
|
-
<span class="ons-chart__boxplot-legend-label">{{ params.uncertaintyRangeLabel }}</span>
|
|
84
|
-
</div>
|
|
85
|
-
{% endif %}
|
|
86
|
-
{% if params.estimateLineLabel %}
|
|
87
|
-
<div class="ons-chart__boxplot-legend-item">
|
|
88
|
-
<span class="ons-chart__boxplot-legend-item ons-chart__boxplot-legend-item--estimate"></span>
|
|
89
|
-
<span class="ons-chart__boxplot-legend-label">{{ params.estimateLineLabel }}</span>
|
|
90
|
-
</div>
|
|
91
|
-
{% endif %}
|
|
92
|
-
</div>
|
|
93
|
-
{% endif %}
|
|
94
|
-
{% if params.chartType in supportedChartTypes %}
|
|
95
|
-
<div
|
|
96
|
-
data-highcharts-chart-container
|
|
97
|
-
class="ons-chart__container"
|
|
98
|
-
tabindex="0"
|
|
99
|
-
role="region"
|
|
100
|
-
aria-label="chart container"
|
|
101
|
-
aria-describedby="{{ instructionsId }}"
|
|
102
|
-
>
|
|
103
|
-
<div id="{{ instructionsId }}" class="ons-u-vh">{{ instructions }}</div>
|
|
104
|
-
<div data-highcharts-chart class="ons-chart__chart"></div>
|
|
105
|
-
</div>
|
|
106
|
-
{% else %}
|
|
107
|
-
<p data-invalid-chart-type data-unsupported-chart-text>
|
|
108
|
-
<b>{{ '"' + params.chartType + '" - ' + (params.unsupportedChartText or 'chart type is not supported') }}</b>
|
|
109
|
-
</p>
|
|
110
|
-
{% endif %}
|
|
90
|
+
<p data-invalid-chart-type data-unsupported-chart-text>
|
|
91
|
+
<b>{{ '"' + params.chartType + '" - ' + (params.unsupportedChartText or 'chart type is not supported') }}</b>
|
|
92
|
+
</p>
|
|
111
93
|
{% endif %}
|
|
112
94
|
|
|
113
95
|
{% if params.fallbackImageUrl %}
|
|
@@ -125,7 +107,7 @@
|
|
|
125
107
|
Footnotes for the annotations at mobile
|
|
126
108
|
Hidden from screen readers because the full text will be read out where they appear in the chart
|
|
127
109
|
#}
|
|
128
|
-
{% if (params.annotations or params.rangeAnnotations or params.referenceLineAnnotations)
|
|
110
|
+
{% if (params.annotations or params.rangeAnnotations or params.referenceLineAnnotations) %}
|
|
129
111
|
<ul class="ons-chart__annotations-footnotes" aria-hidden="true" data-annotations-footnotes>
|
|
130
112
|
{% for annotation in params.annotations %}
|
|
131
113
|
<li class="ons-chart__annotations-footnotes_item">
|
|
@@ -152,7 +134,7 @@
|
|
|
152
134
|
</div>
|
|
153
135
|
{% endcall %}
|
|
154
136
|
|
|
155
|
-
{% if (params.chartType in supportedChartTypes)
|
|
137
|
+
{% if (params.chartType in supportedChartTypes) %}
|
|
156
138
|
{% set series = [] %}
|
|
157
139
|
{% set lineSeriesCount = 0 %}
|
|
158
140
|
{% for item in params.series %}
|
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
EXAMPLE_LINE_CHART_WITH_RANGE_ANNOTATION_WITH_LABEL_INSIDE_PARAMS,
|
|
26
26
|
EXAMPLE_LINE_CHART_WITH_REFERENCE_LINE_ANNOTATIONS_PARAMS,
|
|
27
27
|
EXAMPLE_LINE_CHART_WITH_MIXED_ANNOTATION_TYPES_PARAMS,
|
|
28
|
-
EXAMPLE_IFRAME_CHART_PARAMS,
|
|
29
28
|
} from './_test-examples';
|
|
30
29
|
|
|
31
30
|
describe('Macro: Chart', () => {
|
|
@@ -2104,243 +2103,4 @@ describe('Macro: Chart', () => {
|
|
|
2104
2103
|
});
|
|
2105
2104
|
});
|
|
2106
2105
|
});
|
|
2107
|
-
|
|
2108
|
-
describe('FOR: Iframe Chart', () => {
|
|
2109
|
-
describe('GIVEN: Params: required', () => {
|
|
2110
|
-
describe('WHEN: iframeUrl param is provided', () => {
|
|
2111
|
-
const $ = cheerio.load(renderComponent('chart', EXAMPLE_IFRAME_CHART_PARAMS));
|
|
2112
|
-
|
|
2113
|
-
test('THEN: it passes jest-axe checks', async () => {
|
|
2114
|
-
const results = await axe($.html());
|
|
2115
|
-
expect(results).toHaveNoViolations();
|
|
2116
|
-
});
|
|
2117
|
-
|
|
2118
|
-
test('THEN: it renders the iframe', () => {
|
|
2119
|
-
expect($('.ons-chart__iframe-wrapper').length).toBe(1);
|
|
2120
|
-
});
|
|
2121
|
-
|
|
2122
|
-
test('THEN: the Highcharts config is not included', () => {
|
|
2123
|
-
const configScript = $(`script[data-highcharts-config--iframe-chart-123]`).html();
|
|
2124
|
-
expect(configScript).toBeNull();
|
|
2125
|
-
});
|
|
2126
|
-
});
|
|
2127
|
-
});
|
|
2128
|
-
|
|
2129
|
-
describe('GIVEN: Params: theme', () => {
|
|
2130
|
-
describe('WHEN: theme is provided', () => {
|
|
2131
|
-
const $ = cheerio.load(
|
|
2132
|
-
renderComponent('chart', {
|
|
2133
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2134
|
-
theme: 'secondary',
|
|
2135
|
-
}),
|
|
2136
|
-
);
|
|
2137
|
-
|
|
2138
|
-
test('THEN: the theme parameter is ignored', () => {
|
|
2139
|
-
expect($('[data-highcharts-theme]').length).toBe(0);
|
|
2140
|
-
});
|
|
2141
|
-
});
|
|
2142
|
-
});
|
|
2143
|
-
|
|
2144
|
-
describe('GIVEN: Params: percentageHeightDesktop', () => {
|
|
2145
|
-
describe('WHEN: percentageHeightDesktop is provided', () => {
|
|
2146
|
-
const $ = cheerio.load(
|
|
2147
|
-
renderComponent('chart', {
|
|
2148
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2149
|
-
percentageHeightDesktop: 50,
|
|
2150
|
-
}),
|
|
2151
|
-
);
|
|
2152
|
-
|
|
2153
|
-
test('THEN: the percentageHeightDesktop parameter is ignored', () => {
|
|
2154
|
-
expect($('[data-highcharts-percentage-height-desktop]').length).toBe(0);
|
|
2155
|
-
});
|
|
2156
|
-
});
|
|
2157
|
-
});
|
|
2158
|
-
|
|
2159
|
-
describe('GIVEN: Params: percentageHeightMobile', () => {
|
|
2160
|
-
describe('WHEN: percentageHeightMobile is provided', () => {
|
|
2161
|
-
const $ = cheerio.load(
|
|
2162
|
-
renderComponent('chart', {
|
|
2163
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2164
|
-
percentageHeightMobile: 10,
|
|
2165
|
-
}),
|
|
2166
|
-
);
|
|
2167
|
-
|
|
2168
|
-
test('THEN: the percentageHeightMobile parameter is ignored', () => {
|
|
2169
|
-
expect($('[data-highcharts-percentage-height-mobile]').length).toBe(0);
|
|
2170
|
-
});
|
|
2171
|
-
});
|
|
2172
|
-
});
|
|
2173
|
-
|
|
2174
|
-
describe('GIVEN: Params: tickInterval', () => {
|
|
2175
|
-
describe('WHEN: tickIntervalDesktop and tickIntervalMobile are provided', () => {
|
|
2176
|
-
const $ = cheerio.load(
|
|
2177
|
-
renderComponent('chart', {
|
|
2178
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2179
|
-
xAxis: { tickIntervalDesktop: 10, tickIntervalMobile: 5 },
|
|
2180
|
-
yAxis: { tickIntervalDesktop: 10, tickIntervalMobile: 5 },
|
|
2181
|
-
}),
|
|
2182
|
-
);
|
|
2183
|
-
|
|
2184
|
-
test('THEN: the tickIntervalDesktop and tickIntervalMobile parameters are ignored', () => {
|
|
2185
|
-
expect($('[data-highcharts-x-axis-tick-interval-desktop]').length).toBe(0);
|
|
2186
|
-
expect($('[data-highcharts-x-axis-tick-interval-mobile]').length).toBe(0);
|
|
2187
|
-
expect($('[data-highcharts-y-axis-tick-interval-desktop]').length).toBe(0);
|
|
2188
|
-
expect($('[data-highcharts-y-axis-tick-interval-mobile]').length).toBe(0);
|
|
2189
|
-
});
|
|
2190
|
-
});
|
|
2191
|
-
});
|
|
2192
|
-
|
|
2193
|
-
describe('GIVEN: Params: estimateLineLabel', () => {
|
|
2194
|
-
describe('WHEN: estimateLineLabel is provided', () => {
|
|
2195
|
-
const $ = cheerio.load(
|
|
2196
|
-
renderComponent('chart', {
|
|
2197
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2198
|
-
estimateLineLabel: 'Estimated value',
|
|
2199
|
-
}),
|
|
2200
|
-
);
|
|
2201
|
-
|
|
2202
|
-
test('THEN: the estimateLineLabel parameter is ignored', () => {
|
|
2203
|
-
expect($('[data-highcharts-estimate-line-label]').length).toBe(0);
|
|
2204
|
-
});
|
|
2205
|
-
});
|
|
2206
|
-
});
|
|
2207
|
-
|
|
2208
|
-
describe('GIVEN: Params: uncertaintyRangeLabel', () => {
|
|
2209
|
-
describe('WHEN: uncertaintyRangeLabel is provided', () => {
|
|
2210
|
-
const $ = cheerio.load(
|
|
2211
|
-
renderComponent('chart', {
|
|
2212
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2213
|
-
uncertaintyRangeLabel: '95% Confidence Interval',
|
|
2214
|
-
}),
|
|
2215
|
-
);
|
|
2216
|
-
|
|
2217
|
-
test('THEN: the uncertaintyRangeLabel parameter is ignored', () => {
|
|
2218
|
-
expect($('[data-highcharts-uncertainty-range-label]').length).toBe(0);
|
|
2219
|
-
});
|
|
2220
|
-
});
|
|
2221
|
-
});
|
|
2222
|
-
|
|
2223
|
-
describe('GIVEN: Params: customReferenceLineValue', () => {
|
|
2224
|
-
describe('WHEN: customReferenceLineValue is provided', () => {
|
|
2225
|
-
const $ = cheerio.load(
|
|
2226
|
-
renderComponent('chart', {
|
|
2227
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2228
|
-
yAxis: { customReferenceLineValue: 10 },
|
|
2229
|
-
}),
|
|
2230
|
-
);
|
|
2231
|
-
|
|
2232
|
-
test('THEN: the customReferenceLineValue parameter is ignored', () => {
|
|
2233
|
-
expect($('[data-highcharts-custom-reference-line-value]').length).toBe(0);
|
|
2234
|
-
});
|
|
2235
|
-
});
|
|
2236
|
-
});
|
|
2237
|
-
|
|
2238
|
-
describe('GIVEN: Params: chartType', () => {
|
|
2239
|
-
describe('WHEN: chartType is boxplot and legend params are provided', () => {
|
|
2240
|
-
const $ = cheerio.load(
|
|
2241
|
-
renderComponent('chart', {
|
|
2242
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2243
|
-
chartType: 'boxplot',
|
|
2244
|
-
legend: true,
|
|
2245
|
-
estimateLineLabel: 'Estimated value',
|
|
2246
|
-
uncertaintyRangeLabel: '95% Confidence Interval',
|
|
2247
|
-
}),
|
|
2248
|
-
);
|
|
2249
|
-
|
|
2250
|
-
test('THEN: the boxplot legend is not rendered', () => {
|
|
2251
|
-
expect($('.ons-chart__boxplot-legend').length).toBe(0);
|
|
2252
|
-
});
|
|
2253
|
-
});
|
|
2254
|
-
});
|
|
2255
|
-
|
|
2256
|
-
describe('GIVEN: Params: invalidChartType', () => {
|
|
2257
|
-
describe('WHEN: an invalid chart type is provided', () => {
|
|
2258
|
-
const $ = cheerio.load(
|
|
2259
|
-
renderComponent('chart', {
|
|
2260
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2261
|
-
chartType: 'foobar',
|
|
2262
|
-
}),
|
|
2263
|
-
);
|
|
2264
|
-
|
|
2265
|
-
test('THEN: the invalid chart type is ignored', () => {
|
|
2266
|
-
expect($('[data-invalid-chart-type]').length).toBe(0);
|
|
2267
|
-
});
|
|
2268
|
-
});
|
|
2269
|
-
});
|
|
2270
|
-
|
|
2271
|
-
describe('GIVEN: Params: annotations', () => {
|
|
2272
|
-
describe('WHEN: annotations, rangeAnnotations and referenceLineAnnotations are provided', () => {
|
|
2273
|
-
const $ = cheerio.load(
|
|
2274
|
-
renderComponent('chart', {
|
|
2275
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2276
|
-
annotations: [{ text: 'A test point annotation', point: { x: 2, y: 3 } }],
|
|
2277
|
-
rangeAnnotations: [{ text: 'Range annotation', range: { axisValue1: 10, axisValue2: 15 }, axis: 'x' }],
|
|
2278
|
-
referenceLineAnnotations: [{ text: 'Reference line', value: 34, axis: 'x' }],
|
|
2279
|
-
}),
|
|
2280
|
-
);
|
|
2281
|
-
|
|
2282
|
-
test('THEN: annotations footnotes are not rendered', () => {
|
|
2283
|
-
expect($('[data-annotations-footnotes]').length).toBe(0);
|
|
2284
|
-
});
|
|
2285
|
-
|
|
2286
|
-
test('THEN: annotation scripts are not rendered', () => {
|
|
2287
|
-
expect($('[data-highcharts-annotations--iframe-chart-123]').length).toBe(0);
|
|
2288
|
-
expect($('[data-highcharts-range-annotations--iframe-chart-123]').length).toBe(0);
|
|
2289
|
-
expect($('[data-highcharts-reference-line-annotations--iframe-chart-123]').length).toBe(0);
|
|
2290
|
-
});
|
|
2291
|
-
});
|
|
2292
|
-
});
|
|
2293
|
-
|
|
2294
|
-
describe('GIVEN: Params: iframeAspectRatio', () => {
|
|
2295
|
-
describe('WHEN: iframeAspectRatio is not set', () => {
|
|
2296
|
-
const $ = cheerio.load(renderComponent('chart', EXAMPLE_IFRAME_CHART_PARAMS));
|
|
2297
|
-
|
|
2298
|
-
test('THEN: it defaults to 16-9', () => {
|
|
2299
|
-
expect($('.ons-chart__iframe').hasClass('ons-chart__iframe--16-9')).toBe(true);
|
|
2300
|
-
});
|
|
2301
|
-
});
|
|
2302
|
-
|
|
2303
|
-
describe('WHEN: iframeAspectRatio is unsupported', () => {
|
|
2304
|
-
const $ = cheerio.load(
|
|
2305
|
-
renderComponent('chart', {
|
|
2306
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2307
|
-
iframeAspectRatio: '16-10',
|
|
2308
|
-
}),
|
|
2309
|
-
);
|
|
2310
|
-
|
|
2311
|
-
test('THEN: it defaults to 16-9', () => {
|
|
2312
|
-
expect($('.ons-chart__iframe').hasClass('ons-chart__iframe--16-9')).toBe(true);
|
|
2313
|
-
});
|
|
2314
|
-
});
|
|
2315
|
-
|
|
2316
|
-
describe('WHEN: iframeAspectRatio is supported', () => {
|
|
2317
|
-
const aspectRatio = '21-9';
|
|
2318
|
-
const $ = cheerio.load(
|
|
2319
|
-
renderComponent('chart', {
|
|
2320
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2321
|
-
iframeAspectRatio: aspectRatio,
|
|
2322
|
-
}),
|
|
2323
|
-
);
|
|
2324
|
-
|
|
2325
|
-
test('THEN: it applies the aspect ratio class', () => {
|
|
2326
|
-
expect($('.ons-chart__iframe').hasClass(`ons-chart__iframe--${aspectRatio}`)).toBe(true);
|
|
2327
|
-
});
|
|
2328
|
-
});
|
|
2329
|
-
});
|
|
2330
|
-
|
|
2331
|
-
describe('GIVEN: Params: fallbackImageUrl', () => {
|
|
2332
|
-
describe('WHEN: fallbackImageUrl is provided', () => {
|
|
2333
|
-
const $ = cheerio.load(
|
|
2334
|
-
renderComponent('chart', {
|
|
2335
|
-
...EXAMPLE_IFRAME_CHART_PARAMS,
|
|
2336
|
-
fallbackImageUrl: '/img/small/line-chart-screenshot.png',
|
|
2337
|
-
}),
|
|
2338
|
-
);
|
|
2339
|
-
|
|
2340
|
-
test('THEN: the iframe wrapper is hidden when JavaScript is disabled', () => {
|
|
2341
|
-
expect($('.ons-chart__iframe-wrapper').attr('class')).toContain('ons-chart__non-js-hide');
|
|
2342
|
-
});
|
|
2343
|
-
});
|
|
2344
|
-
});
|
|
2345
|
-
});
|
|
2346
2106
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import Highcharts from 'highcharts';
|
|
2
|
+
|
|
1
3
|
import ChartConstants from './chart-constants';
|
|
2
4
|
|
|
3
5
|
class BarChart {
|
|
@@ -19,7 +21,10 @@ class BarChart {
|
|
|
19
21
|
};
|
|
20
22
|
if (dataLabelDecimalPoints !== undefined) {
|
|
21
23
|
dataLabels.formatter = function () {
|
|
22
|
-
|
|
24
|
+
if (this.y === null || this.y === undefined) {
|
|
25
|
+
return '';
|
|
26
|
+
}
|
|
27
|
+
return Highcharts.numberFormat(this.y, dataLabelDecimalPoints);
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
30
|
return {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<section
|
|
45
45
|
class="ons-cookies-banner"
|
|
46
46
|
aria-label="{{ params.ariaLabel | default(ariaLabel) }}"
|
|
47
|
-
{% if params.
|
|
47
|
+
{% if params.cookieDomain is defined %}data-ons-cookie-domain="{{ params.cookieDomain if params.cookieDomain else '' }}"{% endif %}
|
|
48
48
|
>
|
|
49
49
|
<div
|
|
50
50
|
class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }} ons-cookies-banner__primary"
|
|
@@ -39,10 +39,22 @@ describe('macro: cookies-banner', () => {
|
|
|
39
39
|
expect($('.ons-cookies-banner').attr('aria-label')).toBe('Cookies banner override');
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it('sets cookie domain
|
|
43
|
-
const $ = cheerio.load(renderComponent('cookies-banner', { ...EXAMPLE_COOKIES_BANNER_PARAMS,
|
|
42
|
+
it('sets cookie domain data attribute when `cookieDomain` is provided', () => {
|
|
43
|
+
const $ = cheerio.load(renderComponent('cookies-banner', { ...EXAMPLE_COOKIES_BANNER_PARAMS, cookieDomain: 'census.gov.uk' }));
|
|
44
44
|
|
|
45
|
-
expect($('.ons-cookies-banner').attr('data-ons-cookie-domain
|
|
45
|
+
expect($('.ons-cookies-banner').attr('data-ons-cookie-domain')).toBe('census.gov.uk');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('renders an empty domain attribute when `cookieDomain` is false', () => {
|
|
49
|
+
const $ = cheerio.load(renderComponent('cookies-banner', { cookieDomain: false }));
|
|
50
|
+
|
|
51
|
+
expect($('.ons-cookies-banner').attr('data-ons-cookie-domain')).toBe('');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('omits the domain attribute when `cookieDomain` is not provided', () => {
|
|
55
|
+
const $ = cheerio.load(renderComponent('cookies-banner'));
|
|
56
|
+
|
|
57
|
+
expect($('.ons-cookies-banner').attr('data-ons-cookie-domain')).toBeUndefined();
|
|
46
58
|
});
|
|
47
59
|
|
|
48
60
|
describe('initial banner', () => {
|
|
@@ -175,6 +175,10 @@
|
|
|
175
175
|
{% elif params.serviceLinks.itemsList | length > 1 %}
|
|
176
176
|
{% set breakpoint = 'm' %}
|
|
177
177
|
{% set controlVisibility = true %}
|
|
178
|
+
{% if params.mastheadLogo.multipleLogos | length > 2 %}
|
|
179
|
+
{# Increase breakpoint if there are 3 logos to avoid stacking#}
|
|
180
|
+
{% set breakpoint = 'l' %}
|
|
181
|
+
{% endif %}
|
|
178
182
|
{% else %}
|
|
179
183
|
{% set controlVisibility = false %}
|
|
180
184
|
{% endif %}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@use 'sass:math';
|
|
2
2
|
|
|
3
3
|
.ons-message {
|
|
4
|
-
border-radius: math.div($grid-
|
|
4
|
+
border-radius: math.div($grid-gutter-standard, 2);
|
|
5
5
|
margin-bottom: 2rem;
|
|
6
6
|
outline: 1px solid transparent; // Add transparent outline because Windows High Contrast Mode doesn't show background
|
|
7
7
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
&__head {
|
|
25
25
|
border-bottom: 1px solid var(--ons-color-borders);
|
|
26
|
-
padding: $grid-
|
|
26
|
+
padding: $grid-gutter-standard;
|
|
27
27
|
position: relative;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
&__body {
|
|
53
|
-
padding: $grid-
|
|
53
|
+
padding: $grid-gutter-standard;
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
{% if group.title %}
|
|
25
25
|
{% set openingHeadingTag = "<h" ~ headingLevel %}
|
|
26
26
|
{% set closingHeadingTag = "</h" ~ headingLevel ~ ">" %}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
<div class="ons-summary__group-title-wrapper">
|
|
28
|
+
{{ openingHeadingTag | safe }} class="ons-summary__group-title">{{ group.title }}{{ closingHeadingTag | safe }}
|
|
29
|
+
</div>
|
|
29
30
|
{% endif %}
|
|
30
31
|
{% if group.rows %}
|
|
31
32
|
<dl class="ons-summary__items">
|
|
@@ -217,9 +217,14 @@ $hub-row-spacing: 1.3rem;
|
|
|
217
217
|
border-bottom: 1px solid var(--ons-color-borders-light);
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
.ons-summary__group-title {
|
|
220
|
+
.ons-summary__group-title-wrapper {
|
|
221
221
|
background-color: var(--ons-color-grey-5);
|
|
222
222
|
padding: 1rem 1.25rem;
|
|
223
|
+
margin-bottom: 1rem;
|
|
224
|
+
|
|
225
|
+
.ons-summary__group-title {
|
|
226
|
+
margin: 0;
|
|
227
|
+
}
|
|
223
228
|
}
|
|
224
229
|
.ons-summary__link {
|
|
225
230
|
padding: 0 1.25rem;
|