@ons/design-system 72.6.0 → 72.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/breadcrumbs/_breadcrumbs.scss +1 -0
- package/components/chart/_chart.scss +5 -0
- package/components/chart/_macro.njk +16 -2
- package/components/chart/_macro.spec.js +32 -0
- package/components/chart/bar-chart.js +9 -0
- package/components/chart/chart.js +9 -2
- package/components/chart/common-chart-options.js +8 -2
- package/components/chart/example-clustered-column-chart.njk +2 -1
- package/components/chart/example-column-chart-with-annotations.njk +2 -1
- package/components/chart/example-column-chart.njk +2 -1
- package/components/chart/example-column-with-line-chart.njk +2 -1
- package/components/chart/example-line-chart.njk +3 -1
- package/components/details/details.js +5 -0
- package/components/details-panel/_details-panel.scss +107 -0
- package/components/details-panel/_macro.njk +41 -0
- package/components/details-panel/_macro.spec.js +54 -0
- package/components/details-panel/example-details-panel-open.njk +29 -0
- package/components/details-panel/example-details-panel.njk +28 -0
- package/components/hero/_hero.scss +87 -60
- package/components/hero/_macro.njk +1 -1
- package/components/hero/example-hero-dark.njk +1 -1
- package/components/pagination/_macro.njk +1 -1
- package/components/pagination/_pagination.scss +7 -7
- package/components/summary/_macro.njk +2 -2
- package/components/summary/_macro.spec.js +37 -21
- package/components/summary/_summary.scss +5 -1
- package/components/summary/example-summary-grouped.njk +0 -12
- package/css/main.css +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/main.scss +1 -0
- package/scss/vars/_colors.scss +1 -0
|
@@ -29,6 +29,18 @@
|
|
|
29
29
|
{% if params.percentageHeightMobile and params.chartType != 'bar' %}
|
|
30
30
|
data-highcharts-percentage-height-mobile="{{ params.percentageHeightMobile }}"
|
|
31
31
|
{% endif %}
|
|
32
|
+
{% if params.xAxis.tickIntervalMobile %}
|
|
33
|
+
data-highcharts-x-axis-tick-interval-mobile="{{ params.xAxis.tickIntervalMobile }}"
|
|
34
|
+
{% endif %}
|
|
35
|
+
{% if params.xAxis.tickIntervalDesktop %}
|
|
36
|
+
data-highcharts-x-axis-tick-interval-desktop="{{ params.xAxis.tickIntervalDesktop }}"
|
|
37
|
+
{% endif %}
|
|
38
|
+
{% if params.yAxis.tickIntervalMobile %}
|
|
39
|
+
data-highcharts-y-axis-tick-interval-mobile="{{ params.yAxis.tickIntervalMobile }}"
|
|
40
|
+
{% endif %}
|
|
41
|
+
{% if params.yAxis.tickIntervalDesktop %}
|
|
42
|
+
data-highcharts-y-axis-tick-interval-desktop="{{ params.yAxis.tickIntervalDesktop }}"
|
|
43
|
+
{% endif %}
|
|
32
44
|
>
|
|
33
45
|
{% if params.chartType in supportedChartTypes %}
|
|
34
46
|
<figure class="ons-chart">
|
|
@@ -70,7 +82,7 @@
|
|
|
70
82
|
{% set series = [] %}
|
|
71
83
|
{% for item in params.series %}
|
|
72
84
|
{%
|
|
73
|
-
set
|
|
85
|
+
set seriesItem = {
|
|
74
86
|
"name": item.name if item.name else '',
|
|
75
87
|
"data": item.data if item.data else [],
|
|
76
88
|
"marker": {
|
|
@@ -80,8 +92,10 @@
|
|
|
80
92
|
"enabled": item.dataLabels if item.dataLabels else false
|
|
81
93
|
},
|
|
82
94
|
"type": item.type if item.type and item.type == 'line' else params.chartType
|
|
83
|
-
}
|
|
95
|
+
}
|
|
84
96
|
%}
|
|
97
|
+
{# Use `set` tag to avoid printing the return value of extend #}
|
|
98
|
+
{% set _ = extend(series, seriesItem) %}
|
|
85
99
|
{% endfor %}
|
|
86
100
|
{%
|
|
87
101
|
set config = {
|
|
@@ -96,6 +96,38 @@ describe('Macro: Chart', () => {
|
|
|
96
96
|
});
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
+
describe('GIVEN: Params: Tick Interval', () => {
|
|
100
|
+
describe('WHEN: tick interval is provided', () => {
|
|
101
|
+
const $ = cheerio.load(
|
|
102
|
+
renderComponent('chart', {
|
|
103
|
+
...EXAMPLE_LINE_CHART_REQUIRED_PARAMS,
|
|
104
|
+
xAxis: {
|
|
105
|
+
...EXAMPLE_LINE_CHART_REQUIRED_PARAMS.xAxis,
|
|
106
|
+
tickIntervalMobile: 2,
|
|
107
|
+
tickIntervalDesktop: 5,
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
test('THEN: it includes the tick interval in the config', () => {
|
|
112
|
+
expect($('[data-highcharts-base-chart]').attr('data-highcharts-x-axis-tick-interval-mobile')).toBe('2');
|
|
113
|
+
expect($('[data-highcharts-base-chart]').attr('data-highcharts-x-axis-tick-interval-desktop')).toBe('5');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
describe('WHEN: tick interval is not provided', () => {
|
|
117
|
+
const $ = cheerio.load(
|
|
118
|
+
renderComponent('chart', {
|
|
119
|
+
...EXAMPLE_LINE_CHART_REQUIRED_PARAMS,
|
|
120
|
+
}),
|
|
121
|
+
);
|
|
122
|
+
test('THEN: it does not include the tick interval in the config', () => {
|
|
123
|
+
expect($('[data-highcharts-base-chart]').attr('data-highcharts-x-axis-tick-interval-mobile')).toBe(undefined);
|
|
124
|
+
expect($('[data-highcharts-base-chart]').attr('data-highcharts-x-axis-tick-interval-desktop')).toBe(undefined);
|
|
125
|
+
expect($('[data-highcharts-base-chart]').attr('data-highcharts-y-axis-tick-interval-desktop')).toBe(undefined);
|
|
126
|
+
expect($('[data-highcharts-base-chart]').attr('data-highcharts-y-axis-tick-interval-mobile')).toBe(undefined);
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
99
131
|
describe('GIVEN: Params: Config', () => {
|
|
100
132
|
describe('WHEN: config params are provided', () => {
|
|
101
133
|
const $ = cheerio.load(renderComponent('chart', EXAMPLE_LINE_CHART_WITH_CONFIG_PARAMS));
|
|
@@ -40,6 +40,7 @@ class BarChart {
|
|
|
40
40
|
style: {
|
|
41
41
|
color: this.constants.categoryLabelColor,
|
|
42
42
|
},
|
|
43
|
+
useHTML: false,
|
|
43
44
|
},
|
|
44
45
|
// remove the tick marks for bar charts
|
|
45
46
|
tickWidth: 0,
|
|
@@ -48,6 +49,14 @@ class BarChart {
|
|
|
48
49
|
title: { align: 'high', textAlign: 'middle', reserveSpace: false, rotation: 0, y: -25, useHTML: true },
|
|
49
50
|
},
|
|
50
51
|
yAxis: {
|
|
52
|
+
labels: {
|
|
53
|
+
rotation: 0,
|
|
54
|
+
useHTML: true,
|
|
55
|
+
style: {
|
|
56
|
+
whiteSpace: 'nowrap',
|
|
57
|
+
color: this.constants.categoryLabelColor,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
51
60
|
title: {
|
|
52
61
|
// Override the y Axis title settings for bar charts where the y axis is horizontal
|
|
53
62
|
textAlign: 'right',
|
|
@@ -28,7 +28,11 @@ class HighchartsBaseChart {
|
|
|
28
28
|
}
|
|
29
29
|
this.percentageHeightDesktop = this.node.dataset.highchartsPercentageHeightDesktop;
|
|
30
30
|
this.percentageHeightMobile = this.node.dataset.highchartsPercentageHeightMobile;
|
|
31
|
-
this.
|
|
31
|
+
this.xAxisTickIntervalMobile = parseInt(this.node.dataset.highchartsXAxisTickIntervalMobile);
|
|
32
|
+
this.xAxisTickIntervalDesktop = parseInt(this.node.dataset.highchartsXAxisTickIntervalDesktop);
|
|
33
|
+
this.yAxisTickIntervalMobile = parseInt(this.node.dataset.highchartsYAxisTickIntervalMobile);
|
|
34
|
+
this.yAxisTickIntervalDesktop = parseInt(this.node.dataset.highchartsYAxisTickIntervalDesktop);
|
|
35
|
+
this.commonChartOptions = new CommonChartOptions(this.xAxisTickIntervalDesktop, this.yAxisTickIntervalDesktop);
|
|
32
36
|
this.specificChartOptions = new SpecificChartOptions(this.theme, this.chartType, this.config);
|
|
33
37
|
this.lineChart = new LineChart();
|
|
34
38
|
this.barChart = new BarChart();
|
|
@@ -138,7 +142,10 @@ class HighchartsBaseChart {
|
|
|
138
142
|
// Note this is not the same as the viewport width
|
|
139
143
|
// All responsive rules should be defined here to avoid overriding existing rules
|
|
140
144
|
setResponsiveOptions = () => {
|
|
141
|
-
const mobileCommonChartOptions = this.commonChartOptions.getMobileOptions(
|
|
145
|
+
const mobileCommonChartOptions = this.commonChartOptions.getMobileOptions(
|
|
146
|
+
this.xAxisTickIntervalMobile,
|
|
147
|
+
this.yAxisTickIntervalMobile,
|
|
148
|
+
);
|
|
142
149
|
if (!this.config.responsive) {
|
|
143
150
|
this.config.responsive = {};
|
|
144
151
|
}
|
|
@@ -2,7 +2,7 @@ import ChartConstants from './chart-constants';
|
|
|
2
2
|
|
|
3
3
|
// Options that are common to all chart types - these are set once in the Highcharts.setOptions() method
|
|
4
4
|
class CommonChartOptions {
|
|
5
|
-
constructor() {
|
|
5
|
+
constructor(xAxisTickInterval, yAxisTickInterval) {
|
|
6
6
|
this.constants = ChartConstants.constants();
|
|
7
7
|
|
|
8
8
|
this.options = {
|
|
@@ -96,9 +96,12 @@ class CommonChartOptions {
|
|
|
96
96
|
tickWidth: 1,
|
|
97
97
|
tickLength: 6,
|
|
98
98
|
tickColor: this.constants.gridLineColor,
|
|
99
|
+
tickInterval: yAxisTickInterval,
|
|
99
100
|
},
|
|
100
101
|
xAxis: {
|
|
101
102
|
labels: {
|
|
103
|
+
useHTML: true,
|
|
104
|
+
rotation: 0,
|
|
102
105
|
style: {
|
|
103
106
|
color: this.constants.axisLabelColor,
|
|
104
107
|
fontSize: this.constants.desktopFontSize,
|
|
@@ -117,6 +120,7 @@ class CommonChartOptions {
|
|
|
117
120
|
tickWidth: 1,
|
|
118
121
|
tickLength: 6,
|
|
119
122
|
tickColor: this.constants.gridLineColor,
|
|
123
|
+
tickInterval: xAxisTickInterval,
|
|
120
124
|
},
|
|
121
125
|
plotOptions: {
|
|
122
126
|
series: {
|
|
@@ -141,7 +145,7 @@ class CommonChartOptions {
|
|
|
141
145
|
|
|
142
146
|
getOptions = () => this.options;
|
|
143
147
|
|
|
144
|
-
getMobileOptions = () => {
|
|
148
|
+
getMobileOptions = (xAxisTickInterval, yAxisTickInterval) => {
|
|
145
149
|
return {
|
|
146
150
|
legend: {
|
|
147
151
|
itemStyle: {
|
|
@@ -159,6 +163,7 @@ class CommonChartOptions {
|
|
|
159
163
|
fontSize: this.constants.mobileFontSize,
|
|
160
164
|
},
|
|
161
165
|
},
|
|
166
|
+
tickInterval: xAxisTickInterval,
|
|
162
167
|
},
|
|
163
168
|
yAxis: {
|
|
164
169
|
labels: {
|
|
@@ -171,6 +176,7 @@ class CommonChartOptions {
|
|
|
171
176
|
fontSize: this.constants.mobileFontSize,
|
|
172
177
|
},
|
|
173
178
|
},
|
|
179
|
+
tickInterval: yAxisTickInterval,
|
|
174
180
|
},
|
|
175
181
|
};
|
|
176
182
|
};
|
|
@@ -8,6 +8,7 @@ export default class Details {
|
|
|
8
8
|
this.details = detailsElement;
|
|
9
9
|
this.detailsHeader = this.details.querySelector('.ons-js-details-heading');
|
|
10
10
|
this.content = this.details.querySelector('.ons-js-details-content');
|
|
11
|
+
this.detailsTitle = this.details.querySelector('.ons-js-corrections-details-title');
|
|
11
12
|
|
|
12
13
|
// Initialise
|
|
13
14
|
const detailsId = detailsElement.getAttribute('id');
|
|
@@ -38,6 +39,7 @@ export default class Details {
|
|
|
38
39
|
const action = open ? 'Open' : 'Close';
|
|
39
40
|
const cls = open ? 'add' : 'remove';
|
|
40
41
|
const openAttribute = open ? 'set' : 'remove';
|
|
42
|
+
const setText = open ? 'Close detail' : 'Show detail';
|
|
41
43
|
|
|
42
44
|
this.isOpen = open;
|
|
43
45
|
this.details[`${openAttribute}Attribute`]('open', '');
|
|
@@ -45,6 +47,9 @@ export default class Details {
|
|
|
45
47
|
this.detailsHeader.setAttribute('aria-expanded', open);
|
|
46
48
|
this.content.setAttribute('aria-hidden', !open);
|
|
47
49
|
this.detailsHeader.setAttribute('data-ga-action', `${action} panel`);
|
|
50
|
+
if (this.detailsTitle) {
|
|
51
|
+
this.detailsTitle.textContent = setText;
|
|
52
|
+
}
|
|
48
53
|
|
|
49
54
|
if (this.onOpen && this.onClose) {
|
|
50
55
|
if (open) {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
.ons-details-panel {
|
|
2
|
+
$root: &;
|
|
3
|
+
|
|
4
|
+
background-color: var(--ons-color-info-tint);
|
|
5
|
+
|
|
6
|
+
&__info-icon {
|
|
7
|
+
background: var(--ons-color-white);
|
|
8
|
+
border-radius: 50%;
|
|
9
|
+
color: var(--ons-color-ocean-blue);
|
|
10
|
+
font-size: 1.5rem;
|
|
11
|
+
font-weight: 700;
|
|
12
|
+
line-height: 2rem;
|
|
13
|
+
height: 2rem;
|
|
14
|
+
width: 2rem;
|
|
15
|
+
text-align: center;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&__banner {
|
|
19
|
+
list-style: none;
|
|
20
|
+
background-color: var(--ons-color-ocean-blue);
|
|
21
|
+
color: var(--ons-color-white);
|
|
22
|
+
border: 1px solid var(--ons-color-ocean-blue);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__banner-contents {
|
|
26
|
+
display: flex;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&__banner-detail {
|
|
30
|
+
width: fit-content;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
|
|
33
|
+
&:focus {
|
|
34
|
+
background: var(--ons-color-focus);
|
|
35
|
+
box-shadow: 0 ems($button-shadow-size) 0 var(--ons-color-text-link-focus);
|
|
36
|
+
color: var(--ons-color-text-link-focus);
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&__banner-detail-title {
|
|
42
|
+
text-decoration: underline var(--ons-color-white) 2px;
|
|
43
|
+
text-underline-position: under;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&__banner-detail:focus &__banner-detail-title {
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&__banner-detail-icon {
|
|
51
|
+
.ons-icon {
|
|
52
|
+
width: 1rem;
|
|
53
|
+
height: 1rem;
|
|
54
|
+
transform: rotate(90deg);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#{$root}[open] & {
|
|
58
|
+
.ons-icon {
|
|
59
|
+
transform: rotate(270deg);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&__content {
|
|
65
|
+
#{$root}[open] & {
|
|
66
|
+
display: block;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ons-details--initialised & {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__item {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
border-bottom: 1px solid var(--ons-color-borders);
|
|
78
|
+
@extend .ons-u-pb-xl;
|
|
79
|
+
@extend .ons-u-mb-l;
|
|
80
|
+
@extend .ons-u-ml-2xs;
|
|
81
|
+
|
|
82
|
+
@include mq('m') {
|
|
83
|
+
flex-direction: row;
|
|
84
|
+
column-gap: 2.5rem;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&:last-child {
|
|
88
|
+
border-bottom: 0;
|
|
89
|
+
@extend .ons-u-mb-no;
|
|
90
|
+
@extend .ons-u-pb-no;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&__content-meta {
|
|
95
|
+
@extend .ons-u-mb-no;
|
|
96
|
+
@include mq('m') {
|
|
97
|
+
flex-basis: 25%;
|
|
98
|
+
min-width: 16.5rem;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&__content-heading {
|
|
103
|
+
color: var(--ons-color-black);
|
|
104
|
+
@extend .ons-u-fs-r--b;
|
|
105
|
+
@extend .ons-u-mb-no;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{% macro onsDetailsPanel(params) %}
|
|
2
|
+
<div class="ons-details-panel ons-js-details" {% if params.open %}{{ ' ' }}data-open="true"{% endif %}>
|
|
3
|
+
<div class="ons-details-panel__banner ons-u-pt-s ons-u-pb-s">
|
|
4
|
+
<div class="ons-container ons-details-panel__banner-contents">
|
|
5
|
+
<span class="ons-details-panel__info-icon ons-u-mr-2xs" aria-hidden="true">i</span>
|
|
6
|
+
<div class="ons-details-panel__banner-body">
|
|
7
|
+
<h3 class="ons-details-panel__banner-title ons-u-mb-2xs">{{ params.title }}</h3>
|
|
8
|
+
<div class="ons-details-panel__banner-detail ons-js-details-heading">
|
|
9
|
+
<span class="ons-details-panel__banner-detail-title ons-js-corrections-details-title ons-u-mr-3xs"
|
|
10
|
+
>Show detail</span
|
|
11
|
+
>
|
|
12
|
+
<span class="ons-details-panel__banner-detail-icon">
|
|
13
|
+
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
14
|
+
{{
|
|
15
|
+
onsIcon({
|
|
16
|
+
"iconType": "chevron"
|
|
17
|
+
})
|
|
18
|
+
}}
|
|
19
|
+
</span>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="ons-container ons-details-panel__content ons-js-details-content ons-u-pt-xl ons-u-pb-3xl">
|
|
25
|
+
{% for item in params.detailsItems %}
|
|
26
|
+
<div class="ons-details-panel__item">
|
|
27
|
+
<div class="ons-details-panel__content-meta ons-u-mb-l@2xs@m">
|
|
28
|
+
<h3 class="ons-details-panel__content-heading">{{ item.text }}</h3>
|
|
29
|
+
<time class="ons-details-panel__content-date" datetime="{{ item.date.iso }}">{{ item.date.short }}</time>
|
|
30
|
+
</div>
|
|
31
|
+
<div class="ons-details-panel__content-description">
|
|
32
|
+
<div class="ons-details-panel__content-text ons-u-mb-s">{{ item.description | safe }}</div>
|
|
33
|
+
{% if item.url or item.text == 'Content' %}
|
|
34
|
+
<a class="ons-details-panel__content-url" href="{{ item.url }}"> View superseded version</a>
|
|
35
|
+
{% endif %}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
{% endfor %}
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
{% endmacro %}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** @jest-environment jsdom */
|
|
2
|
+
import * as cheerio from 'cheerio';
|
|
3
|
+
import axe from '../../tests/helpers/axe';
|
|
4
|
+
import { renderComponent } from '../../tests/helpers/rendering';
|
|
5
|
+
import { EXAMPLE_DETAILS_PANEL } from './_test-examples';
|
|
6
|
+
|
|
7
|
+
describe('FOR: Macro: Details Panel', () => {
|
|
8
|
+
describe('GIVEN: Params: title', () => {
|
|
9
|
+
describe('WHEN: title param is provided', () => {
|
|
10
|
+
const $ = cheerio.load(renderComponent('details-panel', EXAMPLE_DETAILS_PANEL));
|
|
11
|
+
test('THEN: banner has the correct title', () => {
|
|
12
|
+
const contentTitle = $('.ons-details-panel__banner-title').text().replace(/\s+/g, ' ').trim();
|
|
13
|
+
expect(contentTitle).toBe('Correction and Notice');
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
describe('GIVEN: Params: detailsItems', () => {
|
|
19
|
+
describe('WHEN: detailsItems is provided', () => {
|
|
20
|
+
const $ = cheerio.load(renderComponent('details-panel', EXAMPLE_DETAILS_PANEL));
|
|
21
|
+
test('THEN: jest-axe tests pass', async () => {
|
|
22
|
+
const results = await axe($.html());
|
|
23
|
+
expect(results).toHaveNoViolations();
|
|
24
|
+
});
|
|
25
|
+
test('THEN: items have correct titles', () => {
|
|
26
|
+
const contentTitle0 = $('.ons-details-panel__content-heading').eq(0).text().trim();
|
|
27
|
+
const contentTitle1 = $('.ons-details-panel__content-heading').eq(1).text().trim();
|
|
28
|
+
expect(contentTitle0).toBe('Correction');
|
|
29
|
+
expect(contentTitle1).toBe('Notice');
|
|
30
|
+
});
|
|
31
|
+
test('THEN: items have correct dates', () => {
|
|
32
|
+
const dateText0 = $('.ons-details-panel__content-date').eq(0).text().trim();
|
|
33
|
+
const dateText1 = $('.ons-details-panel__content-date').eq(1).text().trim();
|
|
34
|
+
|
|
35
|
+
expect(dateText0).toBe('22nd January 2025, 4:30PM');
|
|
36
|
+
expect(dateText1).toBe('22nd January 2025');
|
|
37
|
+
});
|
|
38
|
+
test('THEN: items have correct description text', () => {
|
|
39
|
+
const contentdescriptionText0 = $('.ons-details-panel__content-text').eq(0).text().trim();
|
|
40
|
+
const contentdescriptionText1 = $('.ons-details-panel__content-text').eq(1).text().trim();
|
|
41
|
+
|
|
42
|
+
expect(contentdescriptionText0).toBe('description1');
|
|
43
|
+
expect(contentdescriptionText1).toBe('description2');
|
|
44
|
+
});
|
|
45
|
+
test('THEN: correction item has a valid link and text', () => {
|
|
46
|
+
const correctionLinkText = $('.ons-details-panel__content-url').eq(0).text().trim();
|
|
47
|
+
const correctionLinkUrl = $('.ons-details-panel__content-url').eq(0).attr('href');
|
|
48
|
+
|
|
49
|
+
expect(correctionLinkText).toBe('View superseded version');
|
|
50
|
+
expect(correctionLinkUrl).toBe('#0');
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{% from "components/details-panel/_macro.njk" import onsDetailsPanel %}
|
|
2
|
+
|
|
3
|
+
{{
|
|
4
|
+
onsDetailsPanel({
|
|
5
|
+
"open": true,
|
|
6
|
+
"title": "Correction and Notice",
|
|
7
|
+
"detailsItems": [
|
|
8
|
+
{
|
|
9
|
+
"text": 'Correction',
|
|
10
|
+
"date": {
|
|
11
|
+
"iso": '2025-01-22T16:30Z',
|
|
12
|
+
"short": '22nd January 2025, 4:30PM'
|
|
13
|
+
},
|
|
14
|
+
"description": '<p>The Non-Financial Business Economy publication uses estimates from the Annual Business Survey (ABS). A weighting error means these data have now been revised, with the overall impact being minimal.</p>
|
|
15
|
+
<p>ONS apologises for any inconvenience caused.</p>',
|
|
16
|
+
"url": '#0'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"text": 'Notice',
|
|
20
|
+
"date": {
|
|
21
|
+
"iso": '2025-01-22T16:30Z',
|
|
22
|
+
"short": '22nd January 2025, 4:30PM'
|
|
23
|
+
},
|
|
24
|
+
"description": '<p>To improve the timeliness of our publications, we have discontinued the previously published <a href="#0">Non-financial business economy<a>, <a href="#0">UK and regional (Annual Business Survey)</a>.
|
|
25
|
+
We will now deliver the UK and regional elements separately, in our <a href="#0">Non-financial business economy</a>, <a href="#0">UK (Annual Business Survey)</a> and <a href="#0">Non-financial business economy</a>, <a href="#0">regional (Annual Business Survey) bulletins</a>.</p>'
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{% from "components/details-panel/_macro.njk" import onsDetailsPanel %}
|
|
2
|
+
|
|
3
|
+
{{
|
|
4
|
+
onsDetailsPanel({
|
|
5
|
+
"title": "Correction and Notice",
|
|
6
|
+
"detailsItems": [
|
|
7
|
+
{
|
|
8
|
+
"text": 'Correction',
|
|
9
|
+
"date": {
|
|
10
|
+
"iso": '2025-01-22T16:30Z',
|
|
11
|
+
"short": '22nd January 2025, 4:30PM'
|
|
12
|
+
},
|
|
13
|
+
"description": '<p>The Non-Financial Business Economy publication uses estimates from the Annual Business Survey (ABS). A weighting error means these data have now been revised, with the overall impact being minimal.</p>
|
|
14
|
+
<p>ONS apologises for any inconvenience caused.</p>',
|
|
15
|
+
"url": '#0'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"text": 'Notice',
|
|
19
|
+
"date": {
|
|
20
|
+
"iso": '2025-01-22T16:30Z',
|
|
21
|
+
"short": '22nd January 2025, 4:30PM'
|
|
22
|
+
},
|
|
23
|
+
"description": '<p>To improve the timeliness of our publications, we have discontinued the previously published <a href="#0">Non-financial business economy<a>, <a href="#0">UK and regional (Annual Business Survey)</a>.
|
|
24
|
+
We will now deliver the UK and regional elements separately, in our <a href="#0">Non-financial business economy</a>, <a href="#0">UK (Annual Business Survey)</a> and <a href="#0">Non-financial business economy</a>, <a href="#0">regional (Annual Business Survey) bulletins</a>.</p>'
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
})
|
|
28
|
+
}}
|