@ons/design-system 64.0.0 → 65.0.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/access-code/_macro.njk +2 -2
- package/components/access-code/_macro.spec.js +2 -2
- package/components/access-code/access-code.dom.js +11 -0
- package/components/access-code/{uac.js → access-code.js} +1 -1
- package/components/access-code/{uac.scss → access-code.scss} +1 -1
- package/components/access-code/example-access-code-error.njk +6 -6
- package/components/access-code/example-access-code.njk +4 -4
- package/components/accordion/_macro.njk +2 -2
- package/components/accordion/_macro.spec.js +3 -3
- package/components/accordion/accordion.dom.js +1 -1
- package/components/accordion/accordion.js +1 -1
- package/components/breadcrumbs/_breadcrumbs.scss +6 -6
- package/components/breadcrumbs/_macro.njk +4 -4
- package/components/breadcrumbs/_macro.spec.js +13 -13
- package/components/button/_button.scss +27 -27
- package/components/button/_macro.spec.js +2 -2
- package/components/call-to-action/_macro.njk +1 -1
- package/components/date-input/_macro.njk +3 -3
- package/components/date-input/_macro.spec.js +118 -0
- package/components/date-input/example-date-input-error-for-single-field.njk +63 -0
- package/components/details/_details.scss +1 -1
- package/components/external-link/_external-link.scss +3 -3
- package/components/external-link/_macro.njk +1 -1
- package/components/footer/_footer.scss +2 -2
- package/components/footer/example-footer-with-alternative-organisation.njk +5 -5
- package/components/header/_header.scss +8 -8
- package/components/icon/_icon.scss +1 -1
- package/components/icon/_macro.njk +35 -35
- package/components/icon/_macro.spec.js +1 -1
- package/components/image/_image.scss +2 -2
- package/components/image/_macro.njk +4 -6
- package/components/image/_macro.spec.js +10 -10
- package/components/mutually-exclusive/_macro.njk +4 -3
- package/components/pagination/_macro.njk +2 -2
- package/components/pagination/example-pagination-first.njk +0 -2
- package/components/pagination/example-pagination-last.njk +0 -2
- package/components/pagination/example-pagination-with-no-range-indicator.njk +0 -2
- package/components/pagination/example-pagination.njk +0 -2
- package/components/panel/_macro.njk +1 -1
- package/components/panel/_panel.scss +7 -7
- package/components/password/_macro.njk +1 -1
- package/components/password/example-password.njk +1 -2
- package/components/quote/_quote.scss +1 -1
- package/components/radios/_macro.njk +1 -1
- package/components/skip-to-content/_macro.njk +2 -1
- package/components/skip-to-content/_macro.spec.js +17 -3
- package/components/skip-to-content/_skip.scss +1 -1
- package/components/skip-to-content/skip-to-content.dom.js +1 -1
- package/components/skip-to-content/skip-to-content.spec.js +3 -3
- package/components/summary/_summary.scss +1 -1
- package/components/table/_table.scss +6 -6
- package/components/table/sortable-table.js +1 -1
- package/components/timeline/_macro.njk +18 -22
- package/components/timeline/_macro.spec.js +18 -0
- package/components/video/example-video.njk +1 -1
- package/components/video/video.js +10 -1
- package/components/video/video.spec.js +33 -0
- package/css/main.css +3 -3
- package/css/print.css +1 -1
- package/js/main.js +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +1 -1
- package/scss/main.scss +1 -1
- package/scss/objects/_spacing.scss +3 -3
- package/scss/overrides/hcm.scss +6 -6
- package/scss/overrides/rtl.scss +2 -2
- package/scss/print.scss +1 -1
- package/components/access-code/uac.dom.js +0 -11
- /package/components/access-code/{uac.spec.js → access-code.spec.js} +0 -0
|
@@ -69,42 +69,42 @@
|
|
|
69
69
|
margin-bottom: 0;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
&.ons-
|
|
72
|
+
&.ons-icon-margin--xxxl {
|
|
73
73
|
padding-left: 2.7rem !important;
|
|
74
74
|
|
|
75
75
|
@include mq(m) {
|
|
76
76
|
padding-left: 3.5rem !important;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
&.ons-
|
|
79
|
+
&.ons-icon-margin--xxl {
|
|
80
80
|
padding-left: 2.45rem !important;
|
|
81
81
|
|
|
82
82
|
@include mq(m) {
|
|
83
83
|
padding-left: 2.9rem !important;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
&.ons-
|
|
86
|
+
&.ons-icon-margin--xl {
|
|
87
87
|
padding-left: 2.35rem !important;
|
|
88
88
|
|
|
89
89
|
@include mq(m) {
|
|
90
90
|
padding-left: 2.55rem !important;
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
&.ons-
|
|
93
|
+
&.ons-icon-margin--l {
|
|
94
94
|
padding-left: 2.25rem !important;
|
|
95
95
|
|
|
96
96
|
@include mq(m) {
|
|
97
97
|
padding-left: 2.35rem !important;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
&.ons-
|
|
100
|
+
&.ons-icon-margin--m {
|
|
101
101
|
padding-left: 2.05rem !important;
|
|
102
102
|
|
|
103
103
|
@include mq(m) {
|
|
104
104
|
padding-left: 2.2rem !important;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
|
-
&.ons-
|
|
107
|
+
&.ons-icon-margin--s {
|
|
108
108
|
padding-left: 1.7rem !important;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -216,7 +216,7 @@
|
|
|
216
216
|
&__icon {
|
|
217
217
|
left: 0;
|
|
218
218
|
padding-left: 1rem;
|
|
219
|
-
.ons-
|
|
219
|
+
.ons-icon {
|
|
220
220
|
fill: var(--ons-color-success) !important;
|
|
221
221
|
margin-top: -15% !important;
|
|
222
222
|
}
|
|
@@ -26,7 +26,7 @@ describe('macro: skip-to-content', () => {
|
|
|
26
26
|
}),
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
expect($('.ons-skip-
|
|
29
|
+
expect($('.ons-skip-to-content')[0].tagName).toBe('a');
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
it('has skip link with the provided `url`', async () => {
|
|
@@ -37,7 +37,7 @@ describe('macro: skip-to-content', () => {
|
|
|
37
37
|
}),
|
|
38
38
|
);
|
|
39
39
|
|
|
40
|
-
expect($('.ons-skip-
|
|
40
|
+
expect($('.ons-skip-to-content').attr('href')).toBe('#example-anchor');
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it('has skip link with the provided `text`', async () => {
|
|
@@ -49,9 +49,23 @@ describe('macro: skip-to-content', () => {
|
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
expect(
|
|
52
|
-
$('.ons-skip-
|
|
52
|
+
$('.ons-skip-to-content')
|
|
53
53
|
.text()
|
|
54
54
|
.trim(),
|
|
55
55
|
).toBe('Skip to the content');
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
it('has skip link with the default text if no text provided`', async () => {
|
|
59
|
+
const $ = cheerio.load(
|
|
60
|
+
renderComponent('skip-to-content', {
|
|
61
|
+
url: '#example-anchor',
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
expect(
|
|
66
|
+
$('.ons-skip-to-content')
|
|
67
|
+
.text()
|
|
68
|
+
.trim(),
|
|
69
|
+
).toBe('Skip to content');
|
|
70
|
+
});
|
|
57
71
|
});
|
|
@@ -2,7 +2,7 @@ import domready from '../../js/domready';
|
|
|
2
2
|
import skipToMain from './skip-to-content';
|
|
3
3
|
|
|
4
4
|
async function initaliseSkipToLink() {
|
|
5
|
-
const links = [...document.querySelectorAll('.ons-skip-
|
|
5
|
+
const links = [...document.querySelectorAll('.ons-skip-to-content')];
|
|
6
6
|
if (links.length) {
|
|
7
7
|
links.forEach(link => {
|
|
8
8
|
skipToMain(link);
|
|
@@ -15,7 +15,7 @@ describe('script: skip-to-content', () => {
|
|
|
15
15
|
it('sets `tabIndex` of target element to -1', async () => {
|
|
16
16
|
await setTestPage('/test', EXAMPLE_SKIP_TO_LINK_TEMPLATE);
|
|
17
17
|
|
|
18
|
-
await page.focus('.ons-skip-
|
|
18
|
+
await page.focus('.ons-skip-to-content');
|
|
19
19
|
await page.keyboard.press('Enter');
|
|
20
20
|
|
|
21
21
|
const targetTabIndex = await page.$eval('#target-element', el => el.tabIndex);
|
|
@@ -25,7 +25,7 @@ describe('script: skip-to-content', () => {
|
|
|
25
25
|
it('removes outline from target element on navigate', async () => {
|
|
26
26
|
await setTestPage('/test', EXAMPLE_SKIP_TO_LINK_TEMPLATE);
|
|
27
27
|
|
|
28
|
-
await page.focus('.ons-skip-
|
|
28
|
+
await page.focus('.ons-skip-to-content');
|
|
29
29
|
await page.keyboard.press('Enter');
|
|
30
30
|
|
|
31
31
|
const targetOutline = await page.$eval('#target-element', el => el.style.outline);
|
|
@@ -35,7 +35,7 @@ describe('script: skip-to-content', () => {
|
|
|
35
35
|
it('focuses target element on navigate', async () => {
|
|
36
36
|
await setTestPage('/test', EXAMPLE_SKIP_TO_LINK_TEMPLATE);
|
|
37
37
|
|
|
38
|
-
await page.focus('.ons-skip-
|
|
38
|
+
await page.focus('.ons-skip-to-content');
|
|
39
39
|
await page.keyboard.press('Enter');
|
|
40
40
|
|
|
41
41
|
const focusedElementId = await page.evaluate(() => document.activeElement.id);
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
|
|
156
156
|
&--sortable {
|
|
157
157
|
[aria-sort='descending'].ons-table__header {
|
|
158
|
-
.ons-
|
|
158
|
+
.ons-icon {
|
|
159
159
|
.ons-topTriangle {
|
|
160
160
|
fill: var(--ons-color-grey-15);
|
|
161
161
|
}
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
.ons-table__sort-button:focus {
|
|
167
|
-
.ons-
|
|
167
|
+
.ons-icon {
|
|
168
168
|
.ons-topTriangle {
|
|
169
169
|
fill: #e3ba02;
|
|
170
170
|
}
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
[aria-sort='ascending'].ons-table__header {
|
|
176
|
-
.ons-
|
|
176
|
+
.ons-icon {
|
|
177
177
|
.ons-topTriangle {
|
|
178
178
|
fill: var(--ons-color-text);
|
|
179
179
|
}
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
.ons-table__sort-button:focus {
|
|
185
|
-
.ons-
|
|
185
|
+
.ons-icon {
|
|
186
186
|
.ons-bottomTriangle {
|
|
187
187
|
fill: #e3ba02;
|
|
188
188
|
}
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
text-underline-position: under;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
.ons-
|
|
213
|
+
.ons-icon {
|
|
214
214
|
fill: var(--ons-color-grey-75);
|
|
215
215
|
height: 16px;
|
|
216
216
|
margin-left: 0.2rem;
|
|
@@ -220,7 +220,7 @@
|
|
|
220
220
|
|
|
221
221
|
&:focus {
|
|
222
222
|
@extend %a-focus;
|
|
223
|
-
.ons-
|
|
223
|
+
.ons-icon {
|
|
224
224
|
fill: var(--ons-color-black);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -29,7 +29,7 @@ export default class TableSort {
|
|
|
29
29
|
createHeadingButtons(heading, i) {
|
|
30
30
|
const text = heading.textContent.trim();
|
|
31
31
|
heading.querySelector('.ons-table__header-text').remove();
|
|
32
|
-
heading.querySelector('.ons-
|
|
32
|
+
heading.querySelector('.ons-icon').classList.remove('ons-u-d-no');
|
|
33
33
|
const button = document.createElement('button');
|
|
34
34
|
button.setAttribute('aria-label', this.table.getAttribute('data-aria-sort') + ' ' + text);
|
|
35
35
|
button.setAttribute('type', 'button');
|
|
@@ -3,30 +3,26 @@
|
|
|
3
3
|
{% from "components/list/_macro.njk" import onsList %}
|
|
4
4
|
|
|
5
5
|
<div class="ons-timeline{{ ' ' + params.classes if params.classes else '' }}">
|
|
6
|
-
|
|
6
|
+
{% set titleTag = params.titleTag | default("h2") %}
|
|
7
7
|
{% for item in params.items %}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
{% endif %}
|
|
26
|
-
|
|
27
|
-
</div>
|
|
8
|
+
<div class="ons-timeline__item">
|
|
9
|
+
<{{ titleTag }} class="ons-timeline__heading">{{ item.heading }}</{{ titleTag }}>
|
|
10
|
+
{% if item.itemsList %}
|
|
11
|
+
<div class="ons-timeline__content">
|
|
12
|
+
{{
|
|
13
|
+
onsList({
|
|
14
|
+
"variants": 'bare',
|
|
15
|
+
"itemsList": item.itemsList
|
|
16
|
+
})
|
|
17
|
+
}}
|
|
18
|
+
</div>
|
|
19
|
+
{% elif item.content %}
|
|
20
|
+
<div class="ons-timeline__content">
|
|
21
|
+
{{ item.content | safe }}
|
|
22
|
+
</div>
|
|
23
|
+
{% endif %}
|
|
24
|
+
</div>
|
|
28
25
|
{% endfor %}
|
|
29
|
-
|
|
30
26
|
</div>
|
|
31
27
|
|
|
32
28
|
{% endmacro %}
|
|
@@ -63,6 +63,24 @@ describe('macro: timeline', () => {
|
|
|
63
63
|
expect($secondItem.text()).toContain('Timeline entry 2');
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
it('renders a heading based upon titleTag parameter', () => {
|
|
67
|
+
const EXAMPLE_TIMELINE_WITH_TITLE_TAG = {
|
|
68
|
+
...EXAMPLE_TIMELINE,
|
|
69
|
+
titleTag: 'h3',
|
|
70
|
+
};
|
|
71
|
+
const $ = cheerio.load(renderComponent('timeline', EXAMPLE_TIMELINE_WITH_TITLE_TAG));
|
|
72
|
+
const $firstItem = $('.ons-timeline__item:nth-child(1)');
|
|
73
|
+
expect($firstItem.html().includes('h3')).toBe(true);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('has a provided ons-timeline__content class, wrapping the content', () => {
|
|
77
|
+
const $ = cheerio.load(renderComponent('timeline', EXAMPLE_TIMELINE));
|
|
78
|
+
|
|
79
|
+
const $content = $('.ons-timeline__content');
|
|
80
|
+
|
|
81
|
+
expect($content.length).toBe(3);
|
|
82
|
+
});
|
|
83
|
+
|
|
66
84
|
it('has the provided inner item list', () => {
|
|
67
85
|
const faker = templateFaker();
|
|
68
86
|
const listSpy = faker.spy('list');
|
|
@@ -22,10 +22,19 @@ export default class Video {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
showIframe() {
|
|
25
|
-
const src = this.
|
|
25
|
+
const src = this.addDNTtoVimeoVideos();
|
|
26
26
|
this.iframe.src = src;
|
|
27
27
|
this.iframe.classList.remove('ons-u-d-no');
|
|
28
28
|
this.component.classList.add('ons-video--hasIframe');
|
|
29
29
|
this.placeholder.classList.add('ons-u-d-no');
|
|
30
30
|
}
|
|
31
|
+
addDNTtoVimeoVideos() {
|
|
32
|
+
let src = this.iframe.getAttribute('data-src');
|
|
33
|
+
if (src.includes('player.vimeo.com/video') && src.includes('?dnt=1') === false) {
|
|
34
|
+
src += '?dnt=1';
|
|
35
|
+
return src;
|
|
36
|
+
} else {
|
|
37
|
+
return src;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
31
40
|
}
|
|
@@ -5,6 +5,11 @@ const EXAMPLE_VIDEO_YOUTUBE = {
|
|
|
5
5
|
title: 'Census 2021 promotional TV advert',
|
|
6
6
|
linkText: 'Example link text',
|
|
7
7
|
};
|
|
8
|
+
const EXAMPLE_VIDEO_VIMEO = {
|
|
9
|
+
videoEmbedUrl: 'https://player.vimeo.com/video/838454524?h=24551a3754',
|
|
10
|
+
title: 'Vimeo Video',
|
|
11
|
+
linkText: 'Example link text',
|
|
12
|
+
};
|
|
8
13
|
|
|
9
14
|
const EXAMPLE_APPROVED_COOKIE = JSON.stringify({ campaigns: true }).replace(/"/g, "'");
|
|
10
15
|
|
|
@@ -52,6 +57,18 @@ describe('script: video', () => {
|
|
|
52
57
|
const hasClass = await page.$eval('.ons-js-video', node => node.classList.contains('ons-video--hasIframe'));
|
|
53
58
|
expect(hasClass).toBe(true);
|
|
54
59
|
}, 10000);
|
|
60
|
+
|
|
61
|
+
it('should not add dnt to YouTube videos', async () => {
|
|
62
|
+
const src = await page.$eval('.ons-js-video-iframe', node => node.getAttribute('src'));
|
|
63
|
+
expect(src.includes('?dnt=1')).toBe(false);
|
|
64
|
+
}, 10000);
|
|
65
|
+
|
|
66
|
+
it('should add dnt to Vimeo videos', async () => {
|
|
67
|
+
await setTestPage('/test', renderComponent('video', EXAMPLE_VIDEO_VIMEO));
|
|
68
|
+
|
|
69
|
+
const src = await page.$eval('.ons-js-video-iframe', node => node.getAttribute('src'));
|
|
70
|
+
expect(src.includes('?dnt=1')).toBe(true);
|
|
71
|
+
}, 10000);
|
|
55
72
|
});
|
|
56
73
|
|
|
57
74
|
describe('when cookies are accepted via banner', () => {
|
|
@@ -78,5 +95,21 @@ describe('script: video', () => {
|
|
|
78
95
|
const hasClass = await page.$eval('.ons-js-video', node => node.classList.contains('ons-video--hasIframe'));
|
|
79
96
|
expect(hasClass).toBe(true);
|
|
80
97
|
}, 10000);
|
|
98
|
+
it('should not add dnt to YouTube videos', async () => {
|
|
99
|
+
const src = await page.$eval('.ons-js-video-iframe', node => node.getAttribute('src'));
|
|
100
|
+
expect(src.includes('?dnt=1')).toBe(false);
|
|
101
|
+
}, 10000);
|
|
102
|
+
|
|
103
|
+
it('should add dnt to Vimeo videos', async () => {
|
|
104
|
+
await setTestPage(
|
|
105
|
+
'/test',
|
|
106
|
+
`${renderComponent('video', EXAMPLE_VIDEO_VIMEO)}
|
|
107
|
+
<div class="ons-cookies-banner ons-u-db"><button class="ons-js-accept-cookies">Accept</button></div>`,
|
|
108
|
+
);
|
|
109
|
+
await page.click('.ons-js-accept-cookies');
|
|
110
|
+
|
|
111
|
+
const src = await page.$eval('.ons-js-video-iframe', node => node.getAttribute('src'));
|
|
112
|
+
expect(src.includes('?dnt=1')).toBe(true);
|
|
113
|
+
}, 10000);
|
|
81
114
|
});
|
|
82
115
|
});
|