@ons/design-system 63.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/char-check-limit/_macro.njk +1 -1
- package/components/char-check-limit/_macro.spec.js +1 -1
- package/components/char-check-limit/character-check.spec.js +16 -16
- package/components/checkboxes/_macro.njk +3 -1
- package/components/checkboxes/example-checkboxes-with-descriptions.njk +1 -0
- package/components/cookies-banner/_macro.njk +2 -2
- package/components/cookies-banner/_macro.spec.js +2 -2
- 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/input/_input.scss +6 -0
- package/components/input/_macro.njk +20 -13
- package/components/input/_macro.spec.js +2 -22
- package/components/{search/example-search-with-character-check.njk → input/example-input-search-with-character-check.njk} +1 -2
- package/components/{search/example-search-with-placeholder.njk → input/example-input-search-with-placeholder.njk} +1 -2
- package/components/{search/example-search.njk → input/example-input-search.njk} +1 -2
- package/components/mutually-exclusive/_macro.njk +4 -3
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +1 -1
- 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/select/_macro.njk +1 -2
- 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/_macro.njk +1 -2
- package/components/summary/_macro.spec.js +7 -22
- package/components/summary/_summary.scss +1 -1
- package/components/summary/example-summary-grouped-total.njk +0 -2
- package/components/summary/example-summary-grouped-with-errors.njk +0 -4
- package/components/summary/example-summary-grouped.njk +0 -19
- package/components/summary/example-summary-household.njk +0 -5
- package/components/summary/example-summary-hub.njk +0 -8
- package/components/summary/example-summary-multiple.njk +0 -4
- package/components/summary/example-summary.njk +0 -4
- package/components/table/_macro.njk +1 -1
- package/components/table/_macro.spec.js +16 -0
- package/components/table/_table.scss +6 -6
- package/components/table/example-table-numeric.njk +6 -3
- package/components/table/sortable-table.js +1 -1
- package/components/tabs/_macro.njk +4 -3
- package/components/tabs/_macro.spec.js +23 -0
- package/components/tabs/_tabs.scss +11 -15
- package/components/tabs/example-tabs.njk +6 -6
- package/components/tabs/tabs.js +24 -8
- package/components/tabs/tabs.spec.js +40 -2
- package/components/textarea/_macro.njk +2 -2
- package/components/textarea/_macro.spec.js +2 -2
- package/components/textarea/textarea.spec.js +6 -10
- 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 -2
- 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/search/_macro.njk +0 -30
- package/components/search/_macro.spec.js +0 -69
- package/components/search/_search.scss +0 -9
- /package/components/access-code/{uac.spec.js → access-code.spec.js} +0 -0
|
@@ -59,12 +59,12 @@ describe('script: character-check', () => {
|
|
|
59
59
|
|
|
60
60
|
describe('Given that the char check helper has initialised correctly', () => {
|
|
61
61
|
it('the char check readout should be invisible', async () => {
|
|
62
|
-
const hasClass = await page.$eval('#search-field-check
|
|
62
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
63
63
|
expect(hasClass).toBe(true);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
66
|
it('then the character limit readout should reflect the number of characters remaining', async () => {
|
|
67
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
67
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
68
68
|
expect(innerHtml.trim()).toBe('You have 11 characters remaining');
|
|
69
69
|
});
|
|
70
70
|
});
|
|
@@ -76,17 +76,17 @@ describe('script: character-check', () => {
|
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
79
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
79
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
80
80
|
expect(innerHtml.trim()).toBe('You have 10 characters remaining');
|
|
81
81
|
});
|
|
82
82
|
|
|
83
83
|
it('the char check readout should be visible', async () => {
|
|
84
|
-
const hasClass = await page.$eval('#search-field-check
|
|
84
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
85
85
|
expect(hasClass).toBe(false);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
it('then aria-live should be set to polite', async () => {
|
|
89
|
-
const ariaLiveAttribute = await page.$eval('#search-field-check
|
|
89
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check', element => element.getAttribute('aria-live'));
|
|
90
90
|
expect(ariaLiveAttribute).toBe('polite');
|
|
91
91
|
});
|
|
92
92
|
});
|
|
@@ -97,7 +97,7 @@ describe('script: character-check', () => {
|
|
|
97
97
|
});
|
|
98
98
|
|
|
99
99
|
it('the char check readout should be invisible', async () => {
|
|
100
|
-
const hasClass = await page.$eval('#search-field-check
|
|
100
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
101
101
|
expect(hasClass).toBe(true);
|
|
102
102
|
});
|
|
103
103
|
});
|
|
@@ -108,7 +108,7 @@ describe('script: character-check', () => {
|
|
|
108
108
|
});
|
|
109
109
|
|
|
110
110
|
it('then the characters remaining readout reflect the number of characters remaining', async () => {
|
|
111
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
111
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
112
112
|
expect(innerHtml.trim()).toBe('You have 1 character remaining');
|
|
113
113
|
});
|
|
114
114
|
});
|
|
@@ -120,24 +120,24 @@ describe('script: character-check', () => {
|
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
it('the char check readout should be visible', async () => {
|
|
123
|
-
const hasClass = await page.$eval('#search-field-check
|
|
123
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
124
124
|
expect(hasClass).toBe(false);
|
|
125
125
|
});
|
|
126
126
|
|
|
127
127
|
it('then the characters remaining readout reflect the number of characters exceeded', async () => {
|
|
128
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
128
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
129
129
|
expect(innerHtml.trim()).toBe('1 number too many');
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
it('then aria-live should be set to assertive', async () => {
|
|
133
|
-
const ariaLiveAttribute = await page.$eval('#search-field-check
|
|
133
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check', element => element.getAttribute('aria-live'));
|
|
134
134
|
expect(ariaLiveAttribute).toBe('assertive');
|
|
135
135
|
});
|
|
136
136
|
|
|
137
137
|
it('then the input and readout should be given limit reached classes', async () => {
|
|
138
138
|
const hasClassOnSearchInput = await page.$eval('#search-field', element => element.classList.contains('ons-input--limit-reached'));
|
|
139
139
|
expect(hasClassOnSearchInput).toBe(true);
|
|
140
|
-
const hasClassOnLimitReadout = await page.$eval('#search-field-check
|
|
140
|
+
const hasClassOnLimitReadout = await page.$eval('#search-field-check', element =>
|
|
141
141
|
element.classList.contains('ons-input__limit--reached'),
|
|
142
142
|
);
|
|
143
143
|
expect(hasClassOnLimitReadout).toBe(true);
|
|
@@ -150,24 +150,24 @@ describe('script: character-check', () => {
|
|
|
150
150
|
});
|
|
151
151
|
|
|
152
152
|
it('the char check readout should be visible', async () => {
|
|
153
|
-
const hasClass = await page.$eval('#search-field-check
|
|
153
|
+
const hasClass = await page.$eval('#search-field-check', element => element.classList.contains('ons-u-d-no'));
|
|
154
154
|
expect(hasClass).toBe(false);
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
it('then the characters remaining readout reflect the number of characters exceeded', async () => {
|
|
158
|
-
const innerHtml = await page.$eval('#search-field-check
|
|
158
|
+
const innerHtml = await page.$eval('#search-field-check', element => element.innerHTML);
|
|
159
159
|
expect(innerHtml.trim()).toBe('2 numbers too many');
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
it('then aria-live should be set to assertive', async () => {
|
|
163
|
-
const ariaLiveAttribute = await page.$eval('#search-field-check
|
|
163
|
+
const ariaLiveAttribute = await page.$eval('#search-field-check', element => element.getAttribute('aria-live'));
|
|
164
164
|
expect(ariaLiveAttribute).toBe('assertive');
|
|
165
165
|
});
|
|
166
166
|
|
|
167
167
|
it('then the input and readout should be given limit reached classes', async () => {
|
|
168
168
|
const hasClassOnSearchInput = await page.$eval('#search-field', element => element.classList.contains('ons-input--limit-reached'));
|
|
169
169
|
expect(hasClassOnSearchInput).toBe(true);
|
|
170
|
-
const hasClassOnLimitReadout = await page.$eval('#search-field-check
|
|
170
|
+
const hasClassOnLimitReadout = await page.$eval('#search-field-check', element =>
|
|
171
171
|
element.classList.contains('ons-input__limit--reached'),
|
|
172
172
|
);
|
|
173
173
|
expect(hasClassOnLimitReadout).toBe(true);
|
|
@@ -188,7 +188,7 @@ describe('script: character-check', () => {
|
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
it('then aria-live attribute should removed', async () => {
|
|
191
|
-
const hasAriaLiveAttribute = await page.$eval('#feedback-lim
|
|
191
|
+
const hasAriaLiveAttribute = await page.$eval('#feedback-lim', element => element.hasAttribute('aria-live'));
|
|
192
192
|
expect(hasAriaLiveAttribute).toBe(false);
|
|
193
193
|
});
|
|
194
194
|
});
|
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
6
6
|
|
|
7
7
|
{% set fields %}
|
|
8
|
+
{% if params.checkboxesLabel is defined %}
|
|
8
9
|
<p class="ons-checkboxes__label{{ " " + params.checkboxesLabelClasses if params.checkboxesLabelClasses }}">{{ params.checkboxesLabel }}</p>
|
|
10
|
+
{% endif %}
|
|
9
11
|
{% set hasOther = false %}
|
|
10
12
|
{% for checkbox in params.checkboxes %}
|
|
11
13
|
{% if checkbox.other %}
|
|
@@ -15,7 +17,7 @@
|
|
|
15
17
|
{% if hasOther == false and params.autoSelect and params.autoSelect.selectAllText %}
|
|
16
18
|
{% set btnClasses = ['small', 'secondary'] %}
|
|
17
19
|
{% if params.borderlessParent == false %}
|
|
18
|
-
{% set btnClasses = ['small', 'secondary', 'ghost-dark'] %}
|
|
20
|
+
{% set btnClasses = ['small', 'secondary', 'ghost', 'ghost-dark'] %}
|
|
19
21
|
{% endif %}
|
|
20
22
|
{{
|
|
21
23
|
onsButton({
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{% set rejectedText = 'You have rejected all additional cookies.' %}
|
|
27
27
|
{% set preferencesText = 'You can <a href="' + settingsLinkURL + '">change your cookie preferences</a> at any time.' %}
|
|
28
28
|
{% set confirmationButtonText = 'Hide' %}
|
|
29
|
-
{% set
|
|
29
|
+
{% set contextSuffix = 'this message' %}
|
|
30
30
|
{% endif %}
|
|
31
31
|
|
|
32
32
|
<div class="ons-cookies-banner" role="region" aria-label="{{ params.ariaLabel | default(ariaLabel)}}">
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
onsButton({
|
|
79
79
|
"type": 'button',
|
|
80
80
|
"text": params.confirmationButtonText | default(confirmationButtonText),
|
|
81
|
-
"buttonContext": params.
|
|
81
|
+
"buttonContext": params.contextSuffix | default(contextSuffix),
|
|
82
82
|
"classes": 'ons-btn--secondary ons-btn--small ons-js-hide-button'
|
|
83
83
|
})
|
|
84
84
|
}}
|
|
@@ -16,7 +16,7 @@ const EXAMPLE_COOKIES_BANNER_PARAMS = {
|
|
|
16
16
|
rejectButtonText: 'Reject additional cookies override',
|
|
17
17
|
preferencesText: 'Text override',
|
|
18
18
|
confirmationButtonText: 'Hide override',
|
|
19
|
-
|
|
19
|
+
contextSuffix: 'the cookie message override',
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
describe('macro: cookies-banner', () => {
|
|
@@ -112,7 +112,7 @@ describe('macro: cookies-banner', () => {
|
|
|
112
112
|
expect(buttonSpy.occurrences[2].text).toBe('Hide override');
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
it('has the correct `
|
|
115
|
+
it('has the correct `contextSuffix` for `buttonContext`', () => {
|
|
116
116
|
const faker = templateFaker();
|
|
117
117
|
const buttonSpy = faker.spy('button');
|
|
118
118
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"id": params.id + "-day",
|
|
27
27
|
"type": "number",
|
|
28
28
|
"name": params.day.name,
|
|
29
|
-
"classes": (" ons-input--error" if params.error else "") + exclusiveClass | default(""),
|
|
29
|
+
"classes": (" ons-input--error" if (params.error and params.day.error) or (params.error and not params.day.error and not params.month.error and not params.year.error) else "") + exclusiveClass | default(""),
|
|
30
30
|
"width": "2",
|
|
31
31
|
"min": 1,
|
|
32
32
|
"max": 31,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"id": params.id + "-month",
|
|
47
47
|
"type": "number",
|
|
48
48
|
"name": params.month.name,
|
|
49
|
-
"classes": (" ons-input--error" if params.error else "") + exclusiveClass | default(""),
|
|
49
|
+
"classes": (" ons-input--error" if (params.error and params.month.error) or (params.error and not params.day.error and not params.month.error and not params.year.error) else "") + exclusiveClass | default(""),
|
|
50
50
|
"width": "2",
|
|
51
51
|
"min": 1,
|
|
52
52
|
"max": 12,
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"id": params.id + "-year",
|
|
67
67
|
"type": "number",
|
|
68
68
|
"name": params.year.name,
|
|
69
|
-
"classes": (" ons-input--error" if params.error else "") + exclusiveClass | default(""),
|
|
69
|
+
"classes": (" ons-input--error" if (params.error and params.year.error) or (params.error and not params.day.error and not params.month.error and not params.year.error) else "") + exclusiveClass | default(""),
|
|
70
70
|
"width": "4",
|
|
71
71
|
"min": 1000,
|
|
72
72
|
"max": 3000,
|
|
@@ -11,6 +11,15 @@ const EXAMPLE_DATE_INPUT_BASE = {
|
|
|
11
11
|
description: 'For example, 31 3 1980',
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
const EXAMPLE_DATE_INPUT_BASE_WITH_ERROR = {
|
|
15
|
+
id: 'date',
|
|
16
|
+
legendOrLabel: 'Date of birth',
|
|
17
|
+
description: 'For example, 31 3 1980',
|
|
18
|
+
error: {
|
|
19
|
+
text: 'Enter a date that is after 1 January 2019',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
14
23
|
const EXAMPLE_DAY_FIELD = {
|
|
15
24
|
day: {
|
|
16
25
|
label: {
|
|
@@ -53,6 +62,66 @@ const EXAMPLE_YEAR_FIELD = {
|
|
|
53
62
|
},
|
|
54
63
|
};
|
|
55
64
|
|
|
65
|
+
const EXAMPLE_DAY_FIELD_WITH_ERROR = {
|
|
66
|
+
day: {
|
|
67
|
+
label: {
|
|
68
|
+
text: 'Day',
|
|
69
|
+
description: 'The day',
|
|
70
|
+
},
|
|
71
|
+
value: 'Day',
|
|
72
|
+
error: true,
|
|
73
|
+
name: 'day',
|
|
74
|
+
attributes: {
|
|
75
|
+
autocomplete: 'bday-day',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const EXAMPLE_MONTH_FIELD_WITH_ERROR = {
|
|
81
|
+
month: {
|
|
82
|
+
label: {
|
|
83
|
+
text: 'Month',
|
|
84
|
+
description: 'The month',
|
|
85
|
+
},
|
|
86
|
+
value: 'Month',
|
|
87
|
+
error: true,
|
|
88
|
+
name: 'month',
|
|
89
|
+
attributes: {
|
|
90
|
+
autocomplete: 'bday-month',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const EXAMPLE_YEAR_FIELD_WITH_ERROR = {
|
|
96
|
+
year: {
|
|
97
|
+
label: {
|
|
98
|
+
text: 'Year',
|
|
99
|
+
description: 'The year',
|
|
100
|
+
},
|
|
101
|
+
value: 'Year',
|
|
102
|
+
error: true,
|
|
103
|
+
name: 'year',
|
|
104
|
+
attributes: {
|
|
105
|
+
autocomplete: 'bday-year',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const EXAMPLE_YEAR_FIELD_WITH_NO_ERROR = {
|
|
111
|
+
year: {
|
|
112
|
+
label: {
|
|
113
|
+
text: 'Year',
|
|
114
|
+
description: 'The year',
|
|
115
|
+
},
|
|
116
|
+
value: 'Year',
|
|
117
|
+
name: 'year',
|
|
118
|
+
error: false,
|
|
119
|
+
attributes: {
|
|
120
|
+
autocomplete: 'bday-year',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
|
|
56
125
|
const EXAMPLE_DATE_SINGLE_FIELD = {
|
|
57
126
|
...EXAMPLE_DATE_INPUT_BASE,
|
|
58
127
|
...EXAMPLE_YEAR_FIELD,
|
|
@@ -65,6 +134,25 @@ const EXAMPLE_DATE_MULTIPLE_FIELDS = {
|
|
|
65
134
|
...EXAMPLE_YEAR_FIELD,
|
|
66
135
|
};
|
|
67
136
|
|
|
137
|
+
const EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_SINGLE_ERROR = {
|
|
138
|
+
...EXAMPLE_DATE_INPUT_BASE_WITH_ERROR,
|
|
139
|
+
...EXAMPLE_DAY_FIELD,
|
|
140
|
+
...EXAMPLE_MONTH_FIELD,
|
|
141
|
+
...EXAMPLE_YEAR_FIELD_WITH_ERROR,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_ERROR = {
|
|
145
|
+
...EXAMPLE_DATE_INPUT_BASE_WITH_ERROR,
|
|
146
|
+
...EXAMPLE_DAY_FIELD_WITH_ERROR,
|
|
147
|
+
...EXAMPLE_MONTH_FIELD_WITH_ERROR,
|
|
148
|
+
...EXAMPLE_YEAR_FIELD_WITH_ERROR,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_NO_ERROR = {
|
|
152
|
+
...EXAMPLE_DATE_INPUT_BASE,
|
|
153
|
+
...EXAMPLE_YEAR_FIELD_WITH_NO_ERROR,
|
|
154
|
+
};
|
|
155
|
+
|
|
68
156
|
describe('macro: date input', () => {
|
|
69
157
|
describe('mode: multiple fields', () => {
|
|
70
158
|
it('passes jest-axe checks', async () => {
|
|
@@ -282,4 +370,34 @@ describe('macro: date input', () => {
|
|
|
282
370
|
});
|
|
283
371
|
});
|
|
284
372
|
});
|
|
373
|
+
|
|
374
|
+
describe('mode: multiple fields with single field error', () => {
|
|
375
|
+
it('passes jest-axe checks', async () => {
|
|
376
|
+
const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
|
|
377
|
+
|
|
378
|
+
const results = await axe($.html());
|
|
379
|
+
expect(results).toHaveNoViolations();
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it('has the provided error class on one input', async () => {
|
|
383
|
+
const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_SINGLE_ERROR));
|
|
384
|
+
const $errorContent = $('.ons-input--error');
|
|
385
|
+
|
|
386
|
+
expect($errorContent.length).toBe(1);
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
it('has the provided error class on multiple inputs', async () => {
|
|
390
|
+
const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_ERROR));
|
|
391
|
+
const $errorContent = $('.ons-input--error');
|
|
392
|
+
|
|
393
|
+
expect($errorContent.length).toBe(3);
|
|
394
|
+
});
|
|
395
|
+
|
|
396
|
+
it('does not provide error class when error parameter set to false', async () => {
|
|
397
|
+
const $ = cheerio.load(renderComponent('date-input', EXAMPLE_DATE_MULTIPLE_FIELDS_WITH_NO_ERROR));
|
|
398
|
+
const $errorContent = $('.ons-input--error');
|
|
399
|
+
|
|
400
|
+
expect($errorContent.length).toBe(0);
|
|
401
|
+
});
|
|
402
|
+
});
|
|
285
403
|
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
{% from "components/date-input/_macro.njk" import onsDateInput %}
|
|
3
|
+
{{
|
|
4
|
+
onsDateInput({
|
|
5
|
+
"id": "period-from-date",
|
|
6
|
+
"legendOrLabel": "Period from:",
|
|
7
|
+
"description": "For example, 31 3 2019",
|
|
8
|
+
"day": {
|
|
9
|
+
"label": {
|
|
10
|
+
"text": "Day"
|
|
11
|
+
},
|
|
12
|
+
"name": "day",
|
|
13
|
+
"value": "1"
|
|
14
|
+
},
|
|
15
|
+
"month": {
|
|
16
|
+
"label": {
|
|
17
|
+
"text": "Month"
|
|
18
|
+
},
|
|
19
|
+
"name": "month",
|
|
20
|
+
"value": "1"
|
|
21
|
+
},
|
|
22
|
+
"year": {
|
|
23
|
+
"label": {
|
|
24
|
+
"text": "Year"
|
|
25
|
+
},
|
|
26
|
+
"name": "year",
|
|
27
|
+
"value": "2019"
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
}}
|
|
31
|
+
|
|
32
|
+
{{
|
|
33
|
+
onsDateInput({
|
|
34
|
+
"id": "period-to-date",
|
|
35
|
+
"legendOrLabel": "Period to:",
|
|
36
|
+
"description": "For example, 31 3 2020",
|
|
37
|
+
"day": {
|
|
38
|
+
"label": {
|
|
39
|
+
"text": "Day"
|
|
40
|
+
},
|
|
41
|
+
"name": "day",
|
|
42
|
+
"value": "31"
|
|
43
|
+
},
|
|
44
|
+
"month": {
|
|
45
|
+
"label": {
|
|
46
|
+
"text": "Month"
|
|
47
|
+
},
|
|
48
|
+
"name": "month",
|
|
49
|
+
"value": "12"
|
|
50
|
+
},
|
|
51
|
+
"year": {
|
|
52
|
+
"label": {
|
|
53
|
+
"text": "Year"
|
|
54
|
+
},
|
|
55
|
+
"name": "year",
|
|
56
|
+
"value": "2018",
|
|
57
|
+
"error": true
|
|
58
|
+
},
|
|
59
|
+
"error": {
|
|
60
|
+
"text": "Enter a date that is after 1 January 2019"
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
}}
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
visibility: hidden;
|
|
4
4
|
white-space: nowrap;
|
|
5
5
|
}
|
|
6
|
-
.ons-
|
|
6
|
+
.ons-icon {
|
|
7
7
|
fill: var(--ons-color-grey-100);
|
|
8
8
|
margin: 0 0 0 0.25rem;
|
|
9
9
|
padding-bottom: 0.1rem;
|
|
10
10
|
visibility: visible;
|
|
11
11
|
}
|
|
12
12
|
&:focus {
|
|
13
|
-
.ons-
|
|
13
|
+
.ons-icon {
|
|
14
14
|
fill: var(--ons-color-black);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
&:hover {
|
|
18
|
-
.ons-
|
|
18
|
+
.ons-icon {
|
|
19
19
|
fill: var(--ons-color-text-link-hover);
|
|
20
20
|
.ons-footer & {
|
|
21
21
|
fill: var(--ons-color-black);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<a href="{{ params.url }}" class="ons-external-link{% if params.classes %} {{ params.classes }}{% endif %}" target="_blank" rel="noopener">
|
|
4
4
|
<span class="ons-external-link__text">
|
|
5
5
|
{{- params.linkText | safe -}}
|
|
6
|
-
</span><span class="ons-external-link__icon"> <svg class="ons-
|
|
6
|
+
</span><span class="ons-external-link__icon"> <svg class="ons-icon" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" focusable="false" aria-hidden="true">
|
|
7
7
|
<path d="M13.5,9H13a.5.5,0,0,0-.5.5v3h-9v-9h3A.5.5,0,0,0,7,3V2.5A.5.5,0,0,0,6.5,2h-4a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5h11a.5.5,0,0,0,.5-.5v-4A.5.5,0,0,0,13.5,9Z" transform="translate(-2 -1.99)"/>
|
|
8
8
|
<path d="M8.83,7.88a.51.51,0,0,0,.71,0l2.31-2.32,1.28,1.28A.51.51,0,0,0,14,6.49v-4a.52.52,0,0,0-.5-.5h-4A.51.51,0,0,0,9,2.52a.58.58,0,0,0,.14.33l1.28,1.28L8.12,6.46a.51.51,0,0,0,0,.71Z" transform="translate(-2 -1.99)"/>
|
|
9
9
|
</svg></span><span class="ons-external-link__new-window-description ons-u-vh"> ({{- params.newWindowDescription | default("opens in a new tab") -}})</span></a>
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
{% from "components/footer/_macro.njk" import onsFooter %}
|
|
5
5
|
{{
|
|
6
6
|
onsFooter({
|
|
7
|
-
"poweredBy": '<svg class="ons-
|
|
7
|
+
"poweredBy": '<svg class="ons-icon--logo ons-icon--logo--nisra" xmlns="http://www.w3.org/2000/svg" width="170" height="56" viewBox="0 1 170 54" aria-labelledby="poweredby-alt">
|
|
8
8
|
<title id="poweredby-alt">NISRA - Northern Ireland Statistics and Research Agency</title>
|
|
9
|
-
<g class="ons-
|
|
9
|
+
<g class="ons-icon--logo__group" fill="#3d7cc9">
|
|
10
10
|
<path d="M0,39.3c2.7,4.7,6.1,8.1,10.8,10.8c4.6,2.7,9.7,4,14.7,4c7,0,13.8-2.5,19.2-7.1c0.3-0.3,0.6-0.5,0.9-0.8 c2.1-2,3.9-4.2,5.5-6.9l-15.2-8.8l-1.2-0.7l-8.6-4.9l-0.6-0.4L25,24.8L6.4,35.6l-1.1,0.6L0,39.3L0,39.3z"></path>
|
|
11
11
|
</g>
|
|
12
|
-
<g class="ons-
|
|
12
|
+
<g class="ons-icon--logo__group" fill="#cddb00">
|
|
13
13
|
<path d="M36.4,7.2c-0.4-0.1-0.8-0.3-1.2-0.4c-2.9-0.9-5.9-1.4-9.1-1.4v18.1l9.1,5.3l1.2,0.7l15.2,8.8l1,0.6l-0.6,1 c-1.5,2.6-3.3,4.9-5.4,6.9l5,2.9c2.7-4.7,3.9-9.3,3.9-14.7C55.6,22.2,47.6,11.4,36.4,7.2L36.4,7.2z"></path>
|
|
14
14
|
</g>
|
|
15
|
-
<g class="ons-
|
|
15
|
+
<g class="ons-icon--logo__group" fill="#00205c">
|
|
16
16
|
<path d="M6.2,34.4L25,23.5V4.2h1.2c3.1,0,6.2,0.5,9.1,1.4V0c-5.4,0-10,1.2-14.7,4C9.5,10.3,4.2,22.6,6.2,34.4z"></path>
|
|
17
17
|
</g>
|
|
18
|
-
<g class="ons-
|
|
18
|
+
<g class="ons-icon--logo__group ons-icon--logo__group--text" fill="#00205c">
|
|
19
19
|
<path d="M94.5,48.4l-1-0.2c-0.4-0.1-0.7-0.2-0.7-0.5s0.3-0.5,0.8-0.5c0.7,0,0.8,0.4,0.8,0.5l0.9-0.2c-0.3-0.9-1.2-1.1-1.8-1.1 c-1.5,0-1.7,1-1.7,1.5c0,1.1,1,1.3,1.4,1.3l0.8,0.2c0.2,0,0.5,0.2,0.5,0.5c0,0.5-0.7,0.6-1,0.6c-0.7,0-0.9-0.3-1-0.6l-0.8,0.2 c0.2,0.7,0.9,1.1,1.9,1.1c0.6,0,2-0.2,2-1.5C95.6,49,95.2,48.5,94.5,48.4z M91.2,49c0-1.3-0.6-2.5-2.1-2.5c-1.3,0-2.1,1-2.1,2.4 c0,1.1,0.6,2.4,2.1,2.4c0.9,0,1.7-0.4,2-1.4l-0.9-0.2c-0.1,0.2-0.3,0.7-1,0.7c-0.4,0-0.7-0.1-0.9-0.4c-0.3-0.4-0.2-0.7-0.2-1H91.2z M88.3,47.7c0.2-0.3,0.5-0.4,0.8-0.4c0.4,0,0.6,0.2,0.8,0.4c0.2,0.3,0.2,0.5,0.2,0.7h-2C88.1,48.2,88.2,48,88.3,47.7z M148.6,49.6l-1.1-3h-1.1l1.6,4.3l0.1,0.3c0,0.1-0.1,0.5-0.3,0.7c-0.2,0.2-0.4,0.1-1,0.1v0.8h0.6c0.4,0,0.9-0.1,1.2-1l1.8-5.2
|
|
20
20
|
h-0.8L148.6,49.6z M100.4,49c0-1.3-0.6-2.5-2.1-2.5c-1.3,0-2.1,1-2.1,2.4c0,1.1,0.6,2.4,2.1,2.4c0.9,0,1.7-0.4,2-1.4l-0.9-0.2
|
|
21
21
|
c-0.1,0.2-0.3,0.7-1,0.7c-0.4,0-0.7-0.1-0.9-0.4c-0.3-0.4-0.2-0.7-0.2-1H100.4z M97.5,47.7c0.2-0.3,0.5-0.4,0.8-0.4
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
&--neutral & {
|
|
80
80
|
&__top {
|
|
81
81
|
background: var(--ons-color-header-masthead-internal);
|
|
82
|
-
.ons-
|
|
82
|
+
.ons-icon--logo {
|
|
83
83
|
display: block;
|
|
84
|
-
.ons-
|
|
85
|
-
.ons-
|
|
84
|
+
.ons-icon--logo__group--text,
|
|
85
|
+
.ons-icon--logo__group--primary {
|
|
86
86
|
fill: var(--ons-color-white);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
background-color: transparent;
|
|
92
92
|
box-shadow: none;
|
|
93
93
|
outline: 3px solid var(--ons-color-focus);
|
|
94
|
-
.ons-
|
|
94
|
+
.ons-icon--logo {
|
|
95
95
|
fill: var(--ons-color-text-link-focus);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
.ons-
|
|
143
|
+
.ons-icon--logo {
|
|
144
144
|
display: block;
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -155,9 +155,9 @@
|
|
|
155
155
|
|
|
156
156
|
&__org-logo-link {
|
|
157
157
|
&:focus {
|
|
158
|
-
.ons-
|
|
158
|
+
.ons-icon--logo {
|
|
159
159
|
fill: var(--ons-color-black) !important;
|
|
160
|
-
.ons-
|
|
160
|
+
.ons-icon--logo__group {
|
|
161
161
|
fill: var(--ons-color-black) !important;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
&:first-child {
|
|
208
208
|
margin-left: 0;
|
|
209
209
|
}
|
|
210
|
-
.ons-
|
|
210
|
+
.ons-icon {
|
|
211
211
|
clip-path: circle(9px at center);
|
|
212
212
|
margin-right: 0.5rem;
|
|
213
213
|
}
|