@ons/design-system 67.2.0 → 69.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/README.md +5 -0
- package/components/access-code/_macro.njk +1 -1
- package/components/access-code/_macro.spec.js +2 -10
- package/components/access-code/access-code.dom.js +1 -1
- package/components/access-code/access-code.spec.js +2 -2
- package/components/access-code/example-access-code-error.njk +9 -14
- package/components/access-code/example-access-code.njk +3 -5
- package/components/accordion/accordion.js +4 -4
- package/components/address-input/_macro.spec.js +3 -15
- package/components/address-input/autosuggest.address.dom.js +1 -1
- package/components/address-input/autosuggest.address.js +3 -2
- package/components/address-input/autosuggest.address.setter.js +3 -3
- package/components/address-input/autosuggest.address.spec.js +66 -69
- package/components/address-output/_macro.spec.js +6 -30
- package/components/autosuggest/autosuggest.dom.js +1 -1
- package/components/autosuggest/autosuggest.helpers.js +1 -1
- package/components/back-to-top/_back-to-top.scss +34 -0
- package/components/back-to-top/_macro.njk +17 -0
- package/components/back-to-top/_macro.spec.js +60 -0
- package/components/back-to-top/back-to-top.dom.js +12 -0
- package/components/back-to-top/back-to-top.js +58 -0
- package/components/back-to-top/back-to-top.spec.js +117 -0
- package/components/back-to-top/example-back-to-top.njk +37 -0
- package/components/back-to-top/example-full-page-back-to-top.njk +192 -0
- package/components/browser-banner/_macro.spec.js +4 -12
- package/components/button/_macro.njk +6 -6
- package/components/button/_macro.spec.js +1 -5
- package/components/button/button.js +7 -8
- package/components/button/button.spec.js +17 -39
- package/components/call-to-action/_macro.spec.js +2 -6
- package/components/card/_macro.njk +25 -25
- package/components/card/_macro.spec.js +6 -30
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/char-check-limit/_macro.spec.js +3 -7
- package/components/char-check-limit/character-check.spec.js +24 -20
- package/components/checkboxes/_checkbox-macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +0 -3
- package/components/checkboxes/_macro.spec.js +1 -5
- package/components/checkboxes/checkbox-with-autoselect.js +3 -3
- package/components/checkboxes/checkbox-with-fieldset.js +2 -2
- package/components/checkboxes/checkboxes-with-reveal.js +4 -2
- package/components/checkboxes/checkboxes.dom.js +2 -2
- package/components/checkboxes/checkboxes.spec.js +13 -13
- package/components/content-pagination/_macro.spec.js +2 -2
- package/components/cookies-banner/cookies-banner.dom.js +1 -1
- package/components/cookies-banner/cookies-banner.js +1 -1
- package/components/cookies-banner/cookies-banner.spec.js +7 -7
- package/components/details/details.spec.js +12 -12
- package/components/details/example-details-with-warning.njk +5 -7
- package/components/document-list/_macro.spec.js +9 -27
- package/components/document-list/document-list.scss +1 -1
- package/components/document-list/example-document-list-downloads.njk +3 -3
- package/components/document-list/example-document-list-search-result-featured.njk +1 -1
- package/components/document-list/example-document-list-search-results.njk +3 -3
- package/components/download-resources/download-resources.js +54 -54
- package/components/download-resources/download-resources.spec.js +3 -1
- package/components/error/_macro.njk +1 -1
- package/components/error/_macro.spec.js +2 -6
- package/components/feedback/_macro.spec.js +4 -20
- package/components/field/_macro.spec.js +1 -3
- package/components/fieldset/_fieldset.scss +1 -2
- package/components/fieldset/_macro.spec.js +3 -9
- package/components/footer/_footer.scss +8 -0
- package/components/footer/_macro.njk +8 -7
- package/components/footer/_macro.spec.js +14 -2
- package/components/helpers/grid.njk +15 -15
- package/components/icon/_macro.njk +7 -3
- package/components/icon/_macro.spec.js +4 -12
- package/components/image/_macro.spec.js +1 -5
- package/components/input/_macro.njk +22 -23
- package/components/input/_macro.spec.js +1 -1
- package/components/input/character-check.dom.js +1 -1
- package/components/input/input.spec.js +1 -4
- package/components/label/_label.scss +1 -0
- package/components/label/_macro.njk +2 -2
- package/components/label/_macro.spec.js +4 -13
- package/components/list/_macro.spec.js +4 -12
- package/components/message/_macro.njk +17 -17
- package/components/message/_macro.spec.js +9 -33
- package/components/message-list/_macro.spec.js +7 -39
- package/components/modal/_macro.spec.js +3 -9
- package/components/modal/modal.dom.js +1 -1
- package/components/modal/modal.spec.js +5 -5
- package/components/mutually-exclusive/_macro.spec.js +2 -10
- package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +26 -26
- package/components/mutually-exclusive/mutually-exclusive.date.spec.js +9 -9
- package/components/mutually-exclusive/mutually-exclusive.dom.js +1 -1
- package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +8 -8
- package/components/mutually-exclusive/mutually-exclusive.email.spec.js +7 -7
- package/components/mutually-exclusive/mutually-exclusive.js +13 -13
- package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +29 -29
- package/components/mutually-exclusive/mutually-exclusive.number.spec.js +7 -7
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +8 -8
- package/components/navigation/navigation.spec.js +0 -2
- package/components/pagination/_macro.spec.js +11 -53
- package/components/panel/_macro.njk +17 -17
- package/components/panel/_macro.spec.js +25 -25
- package/components/panel/_panel.scss +10 -9
- package/components/panel/example-panel-bare.njk +3 -4
- package/components/panel/example-panel-with-announcement.njk +6 -10
- package/components/panel/example-panel-with-error-summary.njk +2 -2
- package/components/panel/example-panel-with-information.njk +0 -1
- package/components/panel/example-panel-with-success-message.njk +1 -1
- package/components/panel/example-panel-with-warning.njk +2 -3
- package/components/password/password.dom.js +1 -1
- package/components/phase-banner/_macro.spec.js +3 -9
- package/components/question/_macro.njk +1 -1
- package/components/question/_macro.spec.js +5 -19
- package/components/question/_question.scss +1 -4
- package/components/question/example-question-interviewer-note.njk +1 -1
- package/components/quote/_macro.spec.js +2 -10
- package/components/radios/clear-radios.js +3 -3
- package/components/radios/radio-with-fieldset.js +4 -4
- package/components/radios/radios.dom.js +1 -1
- package/components/radios/radios.spec.js +26 -26
- package/components/related-content/_macro.spec.js +2 -4
- package/components/related-content/_section-macro.spec.js +2 -8
- package/components/relationships/example-relationships-error.njk +16 -18
- package/components/relationships/relationships.dom.js +1 -1
- package/components/relationships/relationships.js +2 -2
- package/components/reply/_macro.spec.js +3 -3
- package/components/reply/reply.dom.js +1 -1
- package/components/reply/reply.spec.js +3 -3
- package/components/section-navigation/_macro.spec.js +13 -21
- package/components/select/_macro.spec.js +6 -6
- package/components/share-page/_macro.spec.js +6 -14
- package/components/skip-to-content/_macro.spec.js +3 -11
- package/components/skip-to-content/skip-to-content.dom.js +1 -1
- package/components/skip-to-content/skip-to-content.js +1 -1
- package/components/skip-to-content/skip-to-content.spec.js +2 -2
- package/components/status/_macro.njk +2 -2
- package/components/status/_macro.spec.js +5 -9
- package/components/status/example-status-dead.njk +1 -1
- package/components/status/example-status-error.njk +1 -1
- package/components/status/example-status-pending.njk +1 -1
- package/components/status/example-status-small.njk +1 -1
- package/components/status/example-status-success.njk +1 -1
- package/components/summary/_macro.njk +4 -5
- package/components/summary/_macro.spec.js +27 -9
- package/components/table/_macro.spec.js +6 -10
- package/components/table/scrollable-table.dom.js +1 -1
- package/components/table/scrollable-table.js +1 -1
- package/components/table/sortable-table.js +4 -4
- package/components/table/table.spec.js +21 -17
- package/components/table-of-contents/_macro.njk +31 -31
- package/components/table-of-contents/_macro.spec.js +3 -11
- package/components/table-of-contents/toc.dom.js +1 -1
- package/components/table-of-contents/toc.spec.js +36 -32
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/tabs/tabs.dom.js +1 -1
- package/components/tabs/tabs.js +8 -8
- package/components/text-indent/_macro.spec.js +2 -6
- package/components/textarea/textarea.dom.js +1 -1
- package/components/textarea/textarea.spec.js +8 -8
- package/components/timeout-modal/_macro.spec.js +1 -3
- package/components/timeout-modal/timeout-modal.dom.js +1 -1
- package/components/timeout-modal/timeout-modal.spec.js +10 -10
- package/components/timeout-panel/_macro.njk +16 -17
- package/components/timeout-panel/_macro.spec.js +1 -1
- package/components/timeout-panel/timeout-panel.dom.js +1 -1
- package/components/timeout-panel/timeout-panel.spec.js +8 -8
- package/components/video/_macro.spec.js +1 -5
- package/components/video/video.dom.js +1 -1
- package/components/video/video.spec.js +16 -12
- package/css/main.css +1 -1
- package/favicons/safari-pinned-tab.svg +23 -23
- package/js/analytics.js +15 -14
- package/js/cookies-settings.dom.js +1 -1
- package/js/cookies-settings.spec.js +19 -19
- package/js/domready.js +1 -1
- package/js/fetch.js +1 -1
- package/js/inpagelink.js +3 -3
- package/js/main.js +1 -0
- package/js/print-button.js +1 -1
- package/js/timeout.js +1 -1
- package/package.json +2 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_typography.scss +8 -2
- package/scss/main.scss +1 -0
- package/scss/overrides/hcm.scss +8 -1
- package/scss/vars/_colors.scss +2 -1
|
@@ -53,19 +53,19 @@ describe('script: mutually-exclusive', () => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it('then the mutually exclusive option should be checked', async () => {
|
|
56
|
-
const isChecked = await page.$eval('#currency-exclusive-option', node => node.checked);
|
|
56
|
+
const isChecked = await page.$eval('#currency-exclusive-option', (node) => node.checked);
|
|
57
57
|
expect(isChecked).toBe(true);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
it('then the number input should be cleared', async () => {
|
|
61
|
-
const inputValue = await page.$eval('#currency', node => node.value);
|
|
61
|
+
const inputValue = await page.$eval('#currency', (node) => node.value);
|
|
62
62
|
expect(inputValue).toBe('');
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('then the aria alert should tell the user that the number input has been cleared', async () => {
|
|
66
66
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
67
67
|
|
|
68
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
68
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
69
69
|
expect(alertText).toBe('Gross annual income cleared.');
|
|
70
70
|
});
|
|
71
71
|
});
|
|
@@ -82,14 +82,14 @@ describe('script: mutually-exclusive', () => {
|
|
|
82
82
|
});
|
|
83
83
|
|
|
84
84
|
it('then the exclusive option should be unchecked', async () => {
|
|
85
|
-
const isChecked = await page.$eval('#currency-exclusive-option', node => node.checked);
|
|
85
|
+
const isChecked = await page.$eval('#currency-exclusive-option', (node) => node.checked);
|
|
86
86
|
expect(isChecked).toBe(false);
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
90
90
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
91
91
|
|
|
92
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
92
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
93
93
|
expect(alertText).toBe('I prefer not to say deselected.');
|
|
94
94
|
});
|
|
95
95
|
});
|
|
@@ -104,7 +104,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
104
104
|
it('then the aria alert shouldnt say anything', async () => {
|
|
105
105
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
106
106
|
|
|
107
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
107
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
108
108
|
expect(alertText).toBe('');
|
|
109
109
|
});
|
|
110
110
|
});
|
|
@@ -117,7 +117,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
117
117
|
it('then the aria alert shouldnt say anything', async () => {
|
|
118
118
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
119
119
|
|
|
120
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
120
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
121
121
|
expect(alertText).toBe('');
|
|
122
122
|
});
|
|
123
123
|
});
|
|
@@ -53,24 +53,24 @@ describe('script: mutually-exclusive', () => {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
it('then the mutually exclusive option should be checked', async () => {
|
|
56
|
-
const isChecked = await page.$eval('#feedback-exclusive-option', node => node.checked);
|
|
56
|
+
const isChecked = await page.$eval('#feedback-exclusive-option', (node) => node.checked);
|
|
57
57
|
expect(isChecked).toBe(true);
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
it('then the textarea should be cleared', async () => {
|
|
61
|
-
const textareaValue = await page.$eval('#feedback', node => node.value);
|
|
61
|
+
const textareaValue = await page.$eval('#feedback', (node) => node.value);
|
|
62
62
|
expect(textareaValue).toBe('');
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
it('then the characters remaining readout should be reset', async () => {
|
|
66
|
-
const limitText = await page.$eval('#feedback-lim', node => node.textContent);
|
|
66
|
+
const limitText = await page.$eval('#feedback-lim', (node) => node.textContent);
|
|
67
67
|
expect(limitText).toBe('You have 200 characters remaining');
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
it('then the aria alert should tell the user that the textarea has been cleared', async () => {
|
|
71
71
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
72
72
|
|
|
73
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
73
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
74
74
|
expect(alertText).toBe('Enter your feedback cleared.');
|
|
75
75
|
});
|
|
76
76
|
});
|
|
@@ -87,14 +87,14 @@ describe('script: mutually-exclusive', () => {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
it('then the exclusive option should be unchecked', async () => {
|
|
90
|
-
const isChecked = await page.$eval('#feedback-exclusive-option', node => node.checked);
|
|
90
|
+
const isChecked = await page.$eval('#feedback-exclusive-option', (node) => node.checked);
|
|
91
91
|
expect(isChecked).toBe(false);
|
|
92
92
|
});
|
|
93
93
|
|
|
94
94
|
it('then the aria alert should tell the user that the exclusive option has been unchecked', async () => {
|
|
95
95
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
96
96
|
|
|
97
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
97
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
98
98
|
expect(alertText).toBe('I dont want to provide feedback deselected.');
|
|
99
99
|
});
|
|
100
100
|
});
|
|
@@ -109,7 +109,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
109
109
|
it('then the aria alert shouldnt say anything', async () => {
|
|
110
110
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
111
111
|
|
|
112
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
112
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
113
113
|
expect(alertText).toBe('');
|
|
114
114
|
});
|
|
115
115
|
});
|
|
@@ -122,7 +122,7 @@ describe('script: mutually-exclusive', () => {
|
|
|
122
122
|
it('then the aria alert shouldnt say anything', async () => {
|
|
123
123
|
await page.waitForTimeout(SCREEN_READER_TIMEOUT_DELAY);
|
|
124
124
|
|
|
125
|
-
const alertText = await page.$eval('.ons-js-exclusive-alert', node => node.textContent);
|
|
125
|
+
const alertText = await page.$eval('.ons-js-exclusive-alert', (node) => node.textContent);
|
|
126
126
|
expect(alertText).toBe('');
|
|
127
127
|
});
|
|
128
128
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import * as cheerio from 'cheerio';
|
|
4
4
|
|
|
5
5
|
import axe from '../../tests/helpers/axe';
|
|
6
|
-
import { renderComponent
|
|
6
|
+
import { renderComponent } from '../../tests/helpers/rendering';
|
|
7
7
|
|
|
8
8
|
const PAGINATION_PREV_NEXT_LABELS = {
|
|
9
9
|
previous: 'Previous page',
|
|
@@ -70,11 +70,7 @@ describe('macro: pagination', () => {
|
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it('renders element indicating position within pagination', () => {
|
|
73
|
-
expect(
|
|
74
|
-
$('.ons-pagination__position')
|
|
75
|
-
.text()
|
|
76
|
-
.trim(),
|
|
77
|
-
).toBe('Page 1 of 1');
|
|
73
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 1 of 1');
|
|
78
74
|
});
|
|
79
75
|
|
|
80
76
|
it('has a single list item', () => {
|
|
@@ -102,11 +98,7 @@ describe('macro: pagination', () => {
|
|
|
102
98
|
});
|
|
103
99
|
|
|
104
100
|
it('renders element indicating position within pagination', () => {
|
|
105
|
-
expect(
|
|
106
|
-
$('.ons-pagination__position')
|
|
107
|
-
.text()
|
|
108
|
-
.trim(),
|
|
109
|
-
).toBe('Page 1 of 2');
|
|
101
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 1 of 2');
|
|
110
102
|
});
|
|
111
103
|
|
|
112
104
|
it('has a 3 list items ("1", "2", "Next page")', () => {
|
|
@@ -136,11 +128,7 @@ describe('macro: pagination', () => {
|
|
|
136
128
|
});
|
|
137
129
|
|
|
138
130
|
it('renders element indicating position within pagination', () => {
|
|
139
|
-
expect(
|
|
140
|
-
$('.ons-pagination__position')
|
|
141
|
-
.text()
|
|
142
|
-
.trim(),
|
|
143
|
-
).toBe('Page 2 of 2');
|
|
131
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 2 of 2');
|
|
144
132
|
});
|
|
145
133
|
|
|
146
134
|
it('has a 3 list items ("Previous page", "1", "2")', () => {
|
|
@@ -170,11 +158,7 @@ describe('macro: pagination', () => {
|
|
|
170
158
|
});
|
|
171
159
|
|
|
172
160
|
it('renders element indicating position within pagination', () => {
|
|
173
|
-
expect(
|
|
174
|
-
$('.ons-pagination__position')
|
|
175
|
-
.text()
|
|
176
|
-
.trim(),
|
|
177
|
-
).toBe('Page 2 of 3');
|
|
161
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 2 of 3');
|
|
178
162
|
});
|
|
179
163
|
|
|
180
164
|
it('has a 5 list items ("Previous page", "1", "2", "3", "Next page")', () => {
|
|
@@ -206,11 +190,7 @@ describe('macro: pagination', () => {
|
|
|
206
190
|
});
|
|
207
191
|
|
|
208
192
|
it('renders element indicating position within pagination', () => {
|
|
209
|
-
expect(
|
|
210
|
-
$('.ons-pagination__position')
|
|
211
|
-
.text()
|
|
212
|
-
.trim(),
|
|
213
|
-
).toBe('Page 2 of 5');
|
|
193
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 2 of 5');
|
|
214
194
|
});
|
|
215
195
|
|
|
216
196
|
it('has a 7 list items ("Previous page", "1", "2", "3", "4", "5", "Next page")', () => {
|
|
@@ -244,11 +224,7 @@ describe('macro: pagination', () => {
|
|
|
244
224
|
});
|
|
245
225
|
|
|
246
226
|
it('renders element indicating position within pagination', () => {
|
|
247
|
-
expect(
|
|
248
|
-
$('.ons-pagination__position')
|
|
249
|
-
.text()
|
|
250
|
-
.trim(),
|
|
251
|
-
).toBe('Page 2 of 6');
|
|
227
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 2 of 6');
|
|
252
228
|
});
|
|
253
229
|
|
|
254
230
|
it('has 7 list items ("Previous page", "1", "2", "3", "...", "6", "Next page")', () => {
|
|
@@ -294,11 +270,7 @@ describe('macro: pagination', () => {
|
|
|
294
270
|
});
|
|
295
271
|
|
|
296
272
|
it('renders element indicating position within pagination', () => {
|
|
297
|
-
expect(
|
|
298
|
-
$('.ons-pagination__position')
|
|
299
|
-
.text()
|
|
300
|
-
.trim(),
|
|
301
|
-
).toBe('Page 5 of 11');
|
|
273
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 5 of 11');
|
|
302
274
|
});
|
|
303
275
|
|
|
304
276
|
it('has a 9 list items ("Previous page", "1", "...", "4", "5", "6", "...", "11", "Next page")', () => {
|
|
@@ -346,11 +318,7 @@ describe('macro: pagination', () => {
|
|
|
346
318
|
});
|
|
347
319
|
|
|
348
320
|
it('renders element indicating position within pagination', () => {
|
|
349
|
-
expect(
|
|
350
|
-
$('.ons-pagination__position')
|
|
351
|
-
.text()
|
|
352
|
-
.trim(),
|
|
353
|
-
).toBe('Page 10 of 11');
|
|
321
|
+
expect($('.ons-pagination__position').text().trim()).toBe('Page 10 of 11');
|
|
354
322
|
});
|
|
355
323
|
|
|
356
324
|
it('has a 7 list items ("Previous page", "1", "...", "9", "10", "11", "Next page")', () => {
|
|
@@ -371,12 +339,7 @@ function assertIsCurrentPage(pageItem, url, label, text) {
|
|
|
371
339
|
expect(pageItem.find('.ons-pagination__link').attr('href')).toBe(url);
|
|
372
340
|
expect(pageItem.find('.ons-pagination__link').attr('aria-current')).toBe('true');
|
|
373
341
|
expect(pageItem.find('.ons-pagination__link').attr('aria-label')).toBe(label);
|
|
374
|
-
expect(
|
|
375
|
-
pageItem
|
|
376
|
-
.find('.ons-pagination__link')
|
|
377
|
-
.text()
|
|
378
|
-
.trim(),
|
|
379
|
-
).toBe(text);
|
|
342
|
+
expect(pageItem.find('.ons-pagination__link').text().trim()).toBe(text);
|
|
380
343
|
}
|
|
381
344
|
|
|
382
345
|
function assertIsOtherPage(pageItem, url, label, text) {
|
|
@@ -384,12 +347,7 @@ function assertIsOtherPage(pageItem, url, label, text) {
|
|
|
384
347
|
expect(pageItem.find('.ons-pagination__link').attr('href')).toBe(url);
|
|
385
348
|
expect(pageItem.find('.ons-pagination__link').attr('aria-current')).toBeUndefined();
|
|
386
349
|
expect(pageItem.find('.ons-pagination__link').attr('aria-label')).toBe(label);
|
|
387
|
-
expect(
|
|
388
|
-
pageItem
|
|
389
|
-
.find('.ons-pagination__link')
|
|
390
|
-
.text()
|
|
391
|
-
.trim(),
|
|
392
|
-
).toBe(text);
|
|
350
|
+
expect(pageItem.find('.ons-pagination__link').text().trim()).toBe(text);
|
|
393
351
|
}
|
|
394
352
|
|
|
395
353
|
function assertIsPreviousPage(pageItem, url, label, text) {
|
|
@@ -4,21 +4,21 @@
|
|
|
4
4
|
{% set classes = ' ' + params.classes %}
|
|
5
5
|
{% endif %}
|
|
6
6
|
|
|
7
|
-
{% if params
|
|
7
|
+
{% if params.title is not defined and params.variant != "bare" %}
|
|
8
8
|
{% set noTitleClass = ' ons-panel--no-title' %}
|
|
9
9
|
{% endif %}
|
|
10
10
|
|
|
11
|
-
{% if params.
|
|
12
|
-
{% set
|
|
11
|
+
{% if params.variant %}
|
|
12
|
+
{% set variantClass = ' ons-panel--' + params.variant %}
|
|
13
13
|
{% else %}
|
|
14
|
-
{% set
|
|
14
|
+
{% set variantClass = ' ons-panel--info' %}
|
|
15
15
|
{% endif %}
|
|
16
16
|
|
|
17
|
-
{% if params.
|
|
17
|
+
{% if params.variant == "warn-branded" %}
|
|
18
18
|
{% set containerClass = 'ons-branded-warning' %}
|
|
19
19
|
{% endif %}
|
|
20
20
|
|
|
21
|
-
{% if params.
|
|
21
|
+
{% if params.variant == "announcement" %}
|
|
22
22
|
{% set containerClass = 'ons-announcement' %}
|
|
23
23
|
{% endif %}
|
|
24
24
|
|
|
@@ -26,19 +26,19 @@
|
|
|
26
26
|
{% set spaciousClass = ' ons-panel--spacious' %}
|
|
27
27
|
{% endif %}
|
|
28
28
|
|
|
29
|
-
{% if params.
|
|
29
|
+
{% if params.variant == "warn-branded" or params.variant == "announcement" %}
|
|
30
30
|
<div class="{{containerClass}}">
|
|
31
31
|
<div class="ons-container">
|
|
32
32
|
{% endif %}
|
|
33
33
|
|
|
34
|
-
<div {% if (params.
|
|
34
|
+
<div {% if (params.variant == 'error' and params.title) or params.variant == 'success' %}aria-labelledby="alert" role="alert" tabindex="-1" {% if not isDesignSystemExample %}autofocus="autofocus" {% endif %}{% endif %}class="ons-panel{{ variantClass }}{{ iconClass }}{{ noTitleClass }}{{ spaciousClass }}{{ classes }}"{% if params and params.attributes %}{% for attribute, value in (params.attributes.items() if params and params.attributes is mapping and params.attributes.items else params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}{% if params and params.id %} id="{{params.id}}"{% endif %}>
|
|
35
35
|
|
|
36
|
-
{% if params.
|
|
36
|
+
{% if params.variant == "warn" or params.variant == "warn-branded" %}
|
|
37
37
|
<span class="ons-panel__icon" aria-hidden="true">!</span>
|
|
38
38
|
<span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Warning: ") }}</span>
|
|
39
39
|
{% endif %}
|
|
40
40
|
|
|
41
|
-
{% if params.
|
|
41
|
+
{% if params.variant == "announcement" %}
|
|
42
42
|
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
43
43
|
<span class="ons-panel__icon" aria-hidden="true">
|
|
44
44
|
{{-
|
|
@@ -51,21 +51,21 @@
|
|
|
51
51
|
{% endif %}
|
|
52
52
|
|
|
53
53
|
{% if params.title %}
|
|
54
|
-
{% if params.
|
|
54
|
+
{% if params.variant == 'error' %}
|
|
55
55
|
{% set defaultTitleTag = "h2" %}
|
|
56
56
|
{% else %}
|
|
57
57
|
{% set defaultTitleTag = "div" %}
|
|
58
58
|
{% endif %}
|
|
59
59
|
{% set titleTag = params.titleTag | default(defaultTitleTag) %}
|
|
60
60
|
<div class="ons-panel__header">
|
|
61
|
-
<{{ titleTag }} id="alert"{% if params.
|
|
61
|
+
<{{ titleTag }} id="alert"{% if params.variant %} data-qa="{{ params.variant }}-header"{% endif %} class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}</{{ titleTag }}>
|
|
62
62
|
</div>
|
|
63
63
|
{% else %}
|
|
64
|
-
{% if not params.
|
|
64
|
+
{% if not params.variant or params.variant == "branded" or params.variant == "info" or params.variant == "bare" %}
|
|
65
65
|
<span class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default("Important information: ") }}</span>
|
|
66
|
-
{% elif params.
|
|
67
|
-
{% set defaultText = "Completed" if params.
|
|
68
|
-
<span{% if params.
|
|
66
|
+
{% elif params.variant == 'error' or params.variant == 'success' %}
|
|
67
|
+
{% set defaultText = "Completed" if params.variant == "success" else "Error" %}
|
|
68
|
+
<span{% if params.variant == "success" %} id="alert"{% endif %} class="ons-panel__assistive-text ons-u-vh">{{ params.assistiveTextPrefix | default(defaultText ~ ": ") }}</span>
|
|
69
69
|
{% endif %}
|
|
70
70
|
{% endif %}
|
|
71
71
|
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
88
|
|
|
89
|
-
{% if params.
|
|
89
|
+
{% if params.variant == "warn-branded" or params.variant == "announcement" %}
|
|
90
90
|
</div>
|
|
91
91
|
</div>
|
|
92
92
|
{% endif %}
|
|
@@ -20,12 +20,12 @@ describe('macro: panel', () => {
|
|
|
20
20
|
['branded', 'Important information:'],
|
|
21
21
|
['success', 'Completed:'],
|
|
22
22
|
['announcement', 'Announcement:'],
|
|
23
|
-
])('mode: %s', (
|
|
23
|
+
])('mode: %s', (panelVariant, accessibleText) => {
|
|
24
24
|
it('passes jest-axe checks', async () => {
|
|
25
25
|
const $ = cheerio.load(
|
|
26
26
|
renderComponent('panel', {
|
|
27
27
|
...EXAMPLE_PANEL_BASIC,
|
|
28
|
-
|
|
28
|
+
variant: panelVariant,
|
|
29
29
|
}),
|
|
30
30
|
);
|
|
31
31
|
const results = await axe($.html());
|
|
@@ -36,18 +36,18 @@ describe('macro: panel', () => {
|
|
|
36
36
|
const $ = cheerio.load(
|
|
37
37
|
renderComponent('panel', {
|
|
38
38
|
...EXAMPLE_PANEL_BASIC,
|
|
39
|
-
|
|
39
|
+
variant: panelVariant,
|
|
40
40
|
}),
|
|
41
41
|
);
|
|
42
42
|
|
|
43
|
-
expect($('.ons-panel').hasClass(`ons-panel--${
|
|
43
|
+
expect($('.ons-panel').hasClass(`ons-panel--${panelVariant}`)).toBe(true);
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
it('has the provided `body` text', () => {
|
|
47
47
|
const $ = cheerio.load(
|
|
48
48
|
renderComponent('panel', {
|
|
49
49
|
...EXAMPLE_PANEL_BASIC,
|
|
50
|
-
|
|
50
|
+
variant: panelVariant,
|
|
51
51
|
}),
|
|
52
52
|
);
|
|
53
53
|
|
|
@@ -55,7 +55,7 @@ describe('macro: panel', () => {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
it('calls with content', () => {
|
|
58
|
-
const $ = cheerio.load(renderComponent('panel', { EXAMPLE_PANEL_BASIC,
|
|
58
|
+
const $ = cheerio.load(renderComponent('panel', { EXAMPLE_PANEL_BASIC, variant: panelVariant }, 'Example content...'));
|
|
59
59
|
|
|
60
60
|
const content = $('.ons-panel__body').text().trim();
|
|
61
61
|
expect(content).toBe('Example content...');
|
|
@@ -65,7 +65,7 @@ describe('macro: panel', () => {
|
|
|
65
65
|
const $ = cheerio.load(
|
|
66
66
|
renderComponent('panel', {
|
|
67
67
|
...EXAMPLE_PANEL_BASIC,
|
|
68
|
-
|
|
68
|
+
variant: panelVariant,
|
|
69
69
|
}),
|
|
70
70
|
);
|
|
71
71
|
|
|
@@ -76,7 +76,7 @@ describe('macro: panel', () => {
|
|
|
76
76
|
const $ = cheerio.load(
|
|
77
77
|
renderComponent('panel', {
|
|
78
78
|
...EXAMPLE_PANEL_BASIC,
|
|
79
|
-
|
|
79
|
+
variant: panelVariant,
|
|
80
80
|
classes: 'ons-custom-class',
|
|
81
81
|
}),
|
|
82
82
|
);
|
|
@@ -88,7 +88,7 @@ describe('macro: panel', () => {
|
|
|
88
88
|
const $ = cheerio.load(
|
|
89
89
|
renderComponent('panel', {
|
|
90
90
|
...EXAMPLE_PANEL_BASIC,
|
|
91
|
-
|
|
91
|
+
variant: panelVariant,
|
|
92
92
|
attributes: {
|
|
93
93
|
a: '123',
|
|
94
94
|
b: '456',
|
|
@@ -103,7 +103,7 @@ describe('macro: panel', () => {
|
|
|
103
103
|
const $ = cheerio.load(
|
|
104
104
|
renderComponent('panel', {
|
|
105
105
|
...EXAMPLE_PANEL_BASIC,
|
|
106
|
-
|
|
106
|
+
variant: panelVariant,
|
|
107
107
|
}),
|
|
108
108
|
);
|
|
109
109
|
|
|
@@ -114,7 +114,7 @@ describe('macro: panel', () => {
|
|
|
114
114
|
const $ = cheerio.load(
|
|
115
115
|
renderComponent('panel', {
|
|
116
116
|
...EXAMPLE_PANEL_BASIC,
|
|
117
|
-
|
|
117
|
+
variant: panelVariant,
|
|
118
118
|
}),
|
|
119
119
|
);
|
|
120
120
|
|
|
@@ -125,7 +125,7 @@ describe('macro: panel', () => {
|
|
|
125
125
|
const $ = cheerio.load(
|
|
126
126
|
renderComponent('panel', {
|
|
127
127
|
...EXAMPLE_PANEL_BASIC,
|
|
128
|
-
|
|
128
|
+
variant: panelVariant,
|
|
129
129
|
assistiveTextPrefix: 'Some helpful text:',
|
|
130
130
|
}),
|
|
131
131
|
);
|
|
@@ -176,13 +176,13 @@ describe('macro: panel', () => {
|
|
|
176
176
|
describe.each([
|
|
177
177
|
['error', 'h2'],
|
|
178
178
|
['success', 'div'],
|
|
179
|
-
])('mode: %s', (
|
|
179
|
+
])('mode: %s', (panelVariant, tagEl) => {
|
|
180
180
|
it('has the default id set', () => {
|
|
181
181
|
const $ = cheerio.load(
|
|
182
182
|
renderComponent('panel', {
|
|
183
183
|
...EXAMPLE_PANEL_BASIC,
|
|
184
184
|
title: 'Title',
|
|
185
|
-
|
|
185
|
+
variant: panelVariant,
|
|
186
186
|
}),
|
|
187
187
|
);
|
|
188
188
|
|
|
@@ -194,7 +194,7 @@ describe('macro: panel', () => {
|
|
|
194
194
|
renderComponent('panel', {
|
|
195
195
|
...EXAMPLE_PANEL_BASIC,
|
|
196
196
|
title: 'Title',
|
|
197
|
-
|
|
197
|
+
variant: panelVariant,
|
|
198
198
|
}),
|
|
199
199
|
);
|
|
200
200
|
|
|
@@ -207,7 +207,7 @@ describe('macro: panel', () => {
|
|
|
207
207
|
renderComponent('panel', {
|
|
208
208
|
...EXAMPLE_PANEL_BASIC,
|
|
209
209
|
title: 'Title',
|
|
210
|
-
|
|
210
|
+
variant: panelVariant,
|
|
211
211
|
}),
|
|
212
212
|
);
|
|
213
213
|
|
|
@@ -219,7 +219,7 @@ describe('macro: panel', () => {
|
|
|
219
219
|
renderComponent('panel', {
|
|
220
220
|
...EXAMPLE_PANEL_BASIC,
|
|
221
221
|
title: 'Title',
|
|
222
|
-
|
|
222
|
+
variant: panelVariant,
|
|
223
223
|
}),
|
|
224
224
|
);
|
|
225
225
|
|
|
@@ -231,7 +231,7 @@ describe('macro: panel', () => {
|
|
|
231
231
|
renderComponent('panel', {
|
|
232
232
|
...EXAMPLE_PANEL_BASIC,
|
|
233
233
|
title: 'Title',
|
|
234
|
-
|
|
234
|
+
variant: panelVariant,
|
|
235
235
|
}),
|
|
236
236
|
);
|
|
237
237
|
|
|
@@ -243,7 +243,7 @@ describe('macro: panel', () => {
|
|
|
243
243
|
renderComponent('panel', {
|
|
244
244
|
...EXAMPLE_PANEL_BASIC,
|
|
245
245
|
title: 'Title',
|
|
246
|
-
|
|
246
|
+
variant: panelVariant,
|
|
247
247
|
}),
|
|
248
248
|
);
|
|
249
249
|
|
|
@@ -259,7 +259,7 @@ describe('macro: panel', () => {
|
|
|
259
259
|
{
|
|
260
260
|
...EXAMPLE_PANEL_BASIC,
|
|
261
261
|
title: 'Title',
|
|
262
|
-
|
|
262
|
+
variant: panelVariant,
|
|
263
263
|
},
|
|
264
264
|
null,
|
|
265
265
|
null,
|
|
@@ -289,7 +289,7 @@ describe('macro: panel', () => {
|
|
|
289
289
|
const $ = cheerio.load(
|
|
290
290
|
renderComponent('panel', {
|
|
291
291
|
...EXAMPLE_PANEL_BASIC,
|
|
292
|
-
|
|
292
|
+
variant: 'announcement',
|
|
293
293
|
}),
|
|
294
294
|
);
|
|
295
295
|
|
|
@@ -303,7 +303,7 @@ describe('macro: panel', () => {
|
|
|
303
303
|
|
|
304
304
|
faker.renderComponent('panel', {
|
|
305
305
|
...EXAMPLE_PANEL_BASIC,
|
|
306
|
-
|
|
306
|
+
variant: 'announcement',
|
|
307
307
|
});
|
|
308
308
|
|
|
309
309
|
expect(iconsSpy.occurrences[0].iconType).toBe('arrow-forward');
|
|
@@ -315,7 +315,7 @@ describe('macro: panel', () => {
|
|
|
315
315
|
const $ = cheerio.load(
|
|
316
316
|
renderComponent('panel', {
|
|
317
317
|
...EXAMPLE_PANEL_BASIC,
|
|
318
|
-
|
|
318
|
+
variant: 'warn',
|
|
319
319
|
}),
|
|
320
320
|
);
|
|
321
321
|
|
|
@@ -328,7 +328,7 @@ describe('macro: panel', () => {
|
|
|
328
328
|
const $ = cheerio.load(
|
|
329
329
|
renderComponent('panel', {
|
|
330
330
|
...EXAMPLE_PANEL_BASIC,
|
|
331
|
-
|
|
331
|
+
variant: 'warn-branded',
|
|
332
332
|
}),
|
|
333
333
|
);
|
|
334
334
|
|
|
@@ -340,7 +340,7 @@ describe('macro: panel', () => {
|
|
|
340
340
|
const $ = cheerio.load(
|
|
341
341
|
renderComponent('panel', {
|
|
342
342
|
...EXAMPLE_PANEL_BASIC,
|
|
343
|
-
|
|
343
|
+
variant: 'warn-branded',
|
|
344
344
|
}),
|
|
345
345
|
);
|
|
346
346
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@mixin panel-
|
|
1
|
+
@mixin panel-variant($name, $color, $color-bg) {
|
|
2
2
|
.ons-panel {
|
|
3
3
|
&--#{$name} {
|
|
4
4
|
background: $color-bg;
|
|
@@ -144,7 +144,8 @@
|
|
|
144
144
|
|
|
145
145
|
&--announcement {
|
|
146
146
|
a:focus {
|
|
147
|
-
box-shadow: 0 -2px var(--ons-color-focus),
|
|
147
|
+
box-shadow: 0 -2px var(--ons-color-focus),
|
|
148
|
+
0 4px (--ons-color-text-inverse-link) !important; // Override focus style because the black border is not visible on a black background
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
|
|
@@ -249,10 +250,10 @@
|
|
|
249
250
|
}
|
|
250
251
|
}
|
|
251
252
|
|
|
252
|
-
@include panel-
|
|
253
|
-
@include panel-
|
|
254
|
-
@include panel-
|
|
255
|
-
@include panel-
|
|
256
|
-
@include panel-
|
|
257
|
-
@include panel-
|
|
258
|
-
@include panel-
|
|
253
|
+
@include panel-variant(error, var(--ons-color-errors), var(--ons-color-errors-tint));
|
|
254
|
+
@include panel-variant(success, var(--ons-color-success), var(--ons-color-success-tint));
|
|
255
|
+
@include panel-variant(info, var(--ons-color-info), var(--ons-color-info-tint));
|
|
256
|
+
@include panel-variant(branded, var(--ons-color-branded), var(--ons-color-branded-tint));
|
|
257
|
+
@include panel-variant(warn, transparent, transparent);
|
|
258
|
+
@include panel-variant(warn-branded, var(--ons-color-branded-tertiary), var(--ons-color-branded-tertiary));
|
|
259
|
+
@include panel-variant(announcement, var(--ons-color-black), var(--ons-color-black));
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
2
|
"fullWidth": true
|
|
4
3
|
---
|
|
5
4
|
{% from "components/panel/_macro.njk" import onsPanel %}
|
|
6
5
|
|
|
7
6
|
{% call onsPanel({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<p class="ons-u-mb-no">National lockdown: stay at home</p>
|
|
13
|
-
|
|
14
|
-
<div class="ons-u-fs-r">
|
|
15
|
-
<p>Coronavirus (COVID-19) remains a serious threat across the country. <a href="#0">Find out more</a></p>
|
|
16
|
-
</div>
|
|
7
|
+
"variant": 'announcement'
|
|
8
|
+
}) %}
|
|
9
|
+
<p class="ons-u-mb-no">National lockdown: stay at home</p>
|
|
17
10
|
|
|
11
|
+
<div class="ons-u-fs-r">
|
|
12
|
+
<p>Coronavirus (COVID-19) remains a serious threat across the country. <a href="#0">Find out more</a></p>
|
|
13
|
+
</div>
|
|
18
14
|
{% endcall %}
|