@ons/design-system 70.0.16 → 72.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 +10 -1
- package/components/access-code/_macro.njk +4 -4
- package/components/access-code/_macro.spec.js +10 -10
- package/components/access-code/example-access-code-error.njk +2 -2
- package/components/access-code/example-access-code.njk +2 -2
- package/components/accordion/_macro.njk +1 -1
- package/components/accordion/_macro.spec.js +162 -91
- package/components/accordion/_test_examples.js +13 -0
- package/components/address-input/_macro.njk +7 -7
- package/components/address-input/_macro.spec.js +16 -15
- package/components/address-input/autosuggest.address.error.js +1 -1
- package/components/address-input/autosuggest.address.js +25 -25
- package/components/address-input/autosuggest.address.spec.js +6 -5
- package/components/address-input/example-address-input-editable.njk +5 -4
- package/components/address-input/example-address-input.njk +4 -5
- package/components/autosuggest/_autosuggest.scss +8 -8
- package/components/autosuggest/_macro.njk +5 -5
- package/components/autosuggest/autosuggest.spec.js +1 -1
- package/components/back-to-top/_back-to-top.scss +2 -2
- package/components/back-to-top/_macro.spec.js +1 -1
- package/components/back-to-top/example-full-page-back-to-top.njk +6 -6
- package/components/breadcrumbs/_breadcrumbs.scss +1 -1
- package/components/breadcrumbs/_macro.spec.js +121 -115
- package/components/breadcrumbs/_test_examples.js +36 -0
- package/components/browser-banner/_macro.spec.js +1 -1
- package/components/button/_button.scss +24 -16
- package/components/button/_macro.njk +5 -5
- package/components/button/_macro.spec.js +2 -2
- package/components/button/example-button-custom.njk +1 -1
- package/components/card/_card.scss +0 -6
- package/components/card/_macro.njk +9 -9
- package/components/card/_macro.spec.js +57 -24
- package/components/card/example-card-set-with-images.njk +30 -18
- package/components/card/example-card-set-with-lists.njk +57 -45
- package/components/card/example-card-set.njk +27 -15
- package/components/card/example-card.njk +9 -5
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +4 -4
- package/components/checkboxes/_checkboxes.scss +1 -1
- package/components/checkboxes/example-checkboxes-with-hidden-label.njk +4 -4
- package/components/cookies-banner/_cookies-banner.scss +5 -5
- package/components/cookies-banner/_macro.njk +15 -13
- package/components/cookies-banner/_macro.spec.js +1 -1
- package/components/details/_details.scss +5 -6
- package/components/details/_macro.njk +4 -4
- package/components/details/_macro.spec.js +1 -1
- package/components/document-list/_document-list.scss +0 -2
- package/components/document-list/_macro.njk +18 -18
- package/components/document-list/_macro.spec.js +16 -14
- package/components/document-list/example-document-list-article-featured.njk +5 -3
- package/components/document-list/example-document-list-articles.njk +15 -9
- package/components/document-list/example-document-list-downloads.njk +15 -9
- package/components/document-list/example-document-list-search-result-featured.njk +5 -3
- package/components/document-list/example-document-list-search-results.njk +20 -12
- package/components/download-resources/_download-resources.scss +1 -2
- package/components/download-resources/download-resources.spec.js +12 -6
- package/components/external-link/_macro.njk +1 -1
- package/components/external-link/_macro.spec.js +1 -1
- package/components/external-link/example-external-link.njk +1 -1
- package/components/feedback/_macro.njk +1 -1
- package/components/feedback/_macro.spec.js +3 -3
- package/components/feedback/example-feedback-call-to-action.njk +1 -1
- package/components/field/_field-group.scss +0 -2
- package/components/field/_field.scss +1 -2
- package/components/fieldset/_fieldset.scss +2 -2
- package/components/fieldset/_macro.njk +1 -1
- package/components/fieldset/_macro.spec.js +1 -1
- package/components/footer/_footer.scss +12 -7
- package/components/footer/_macro.njk +54 -34
- package/components/footer/_macro.spec.js +90 -28
- package/components/footer/example-footer-cymraeg.njk +1 -1
- package/components/footer/example-footer-transactional.njk +1 -1
- package/components/footer/example-footer-warning.njk +1 -1
- package/components/footer/example-footer-with-alternative-organisation.njk +99 -94
- package/components/footer/example-footer-with-coat-of-arms.njk +1 -1
- package/components/footer/example-footer-with-copyright.njk +1 -1
- package/components/footer/example-footer-with-multiple-logos-and-split-display.njk +173 -0
- package/components/footer/example-footer-with-multiple-logos.njk +172 -0
- package/components/footer/example-footer.njk +1 -1
- package/components/header/_header.scss +7 -14
- package/components/header/_macro.njk +19 -19
- package/components/header/_macro.spec.js +18 -18
- package/components/header/example-header-external-for-surveys.njk +2 -2
- package/components/header/example-header-external-welsh.njk +2 -2
- package/components/header/example-header-external-with-sub-navigation-removed.njk +1 -1
- package/components/header/example-header-external-with-sub-navigation.njk +1 -1
- package/components/header/example-header-multiple-logos.njk +4 -4
- package/components/hero/_hero.scss +6 -8
- package/components/hero/_macro.njk +1 -1
- package/components/icon/_icon.scss +4 -4
- package/components/icon/_macro.njk +4 -4
- package/components/icon/_macro.spec.js +2 -2
- package/components/image/_image.scss +1 -1
- package/components/image/_macro.njk +1 -1
- package/components/image/_macro.spec.js +10 -10
- package/components/image/example-image-for-regular-screens.njk +1 -1
- package/components/input/_input-type.scss +0 -2
- package/components/input/_input.scss +10 -10
- package/components/input/_macro.njk +4 -2
- package/components/input/example-input-search-with-character-check.njk +1 -1
- package/components/input/example-input-search.njk +1 -1
- package/components/label/_label.scss +1 -3
- package/components/language-selector/_macro.njk +3 -3
- package/components/language-selector/_macro.spec.js +7 -7
- package/components/list/_list.scss +1 -5
- package/components/list/_macro.njk +9 -10
- package/components/list/_macro.spec.js +50 -9
- package/components/list/example-inline-list-with-social-icon-prefix.njk +1 -1
- package/components/message/_macro.njk +3 -3
- package/components/message/_macro.spec.js +3 -3
- package/components/message-list/_macro.njk +2 -2
- package/components/message-list/_macro.spec.js +8 -4
- package/components/message-list/_message-list.scss +2 -2
- package/components/navigation/_macro.njk +9 -9
- package/components/navigation/_macro.spec.js +2 -2
- package/components/navigation/_navigation.scss +2 -6
- package/components/navigation/navigation.dom.js +1 -1
- package/components/navigation/navigation.spec.js +4 -4
- package/components/pagination/_macro.njk +2 -2
- package/components/pagination/_pagination.scss +1 -7
- package/components/panel/_macro.njk +5 -4
- package/components/panel/_macro.spec.js +2 -2
- package/components/panel/_panel.scss +12 -8
- package/components/password/_macro.njk +1 -1
- package/components/password/_macro.spec.js +2 -2
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_phase-banner.scss +3 -4
- package/components/phase-banner/example-phase-banner-alpha.njk +1 -1
- package/components/phase-banner/example-phase-banner-beta.njk +1 -1
- package/components/question/_macro.njk +8 -8
- package/components/question/_macro.spec.js +3 -3
- package/components/question/_question.scss +3 -3
- package/components/radios/_macro.njk +1 -1
- package/components/radios/_macro.spec.js +1 -1
- package/components/radios/_radios.scss +1 -1
- package/components/radios/example-radios-with-clear-button-expanded.njk +1 -1
- package/components/radios/example-radios-with-clear-button.njk +1 -1
- package/components/related-content/_macro.spec.js +2 -2
- package/components/related-content/_related-content.scss +1 -1
- package/components/related-content/example-related-content-general.njk +2 -2
- package/components/related-content/example-related-content-social-media.njk +1 -1
- package/components/reply/_macro.njk +3 -1
- package/components/reply/_macro.spec.js +1 -1
- package/components/reply/reply.spec.js +1 -1
- package/components/section-navigation/_macro.njk +10 -10
- package/components/section-navigation/_macro.spec.js +15 -15
- package/components/section-navigation/_section-navigation.scss +3 -8
- package/components/section-navigation/example-section-navigation-single-vertical-with-title.njk +3 -3
- package/components/section-navigation/example-section-navigation-vertical.njk +14 -14
- package/components/section-navigation/example-section-navigation.njk +3 -3
- package/components/select/example-select-with-inline-label.njk +1 -1
- package/components/share-page/_macro.njk +7 -7
- package/components/share-page/_macro.spec.js +2 -2
- package/components/share-page/example-share-page.njk +1 -1
- package/components/status/_status.scss +1 -1
- package/components/summary/_macro.njk +33 -33
- package/components/summary/_macro.spec.js +34 -34
- package/components/summary/_summary.scss +2 -4
- package/components/summary/example-summary-card-grouped.njk +34 -34
- package/components/summary/example-summary-grouped-total.njk +7 -7
- package/components/summary/example-summary-grouped-with-errors.njk +9 -9
- package/components/summary/example-summary-grouped.njk +34 -34
- package/components/summary/example-summary-household.njk +7 -7
- package/components/summary/example-summary-hub-minimal.njk +8 -8
- package/components/summary/example-summary-hub.njk +16 -16
- package/components/summary/example-summary-multiple.njk +7 -7
- package/components/summary/example-summary-no-action.njk +5 -5
- package/components/summary/example-summary.njk +9 -9
- package/components/table/_table.scss +2 -3
- package/components/table-of-contents/_macro.njk +3 -3
- package/components/table-of-contents/_macro.spec.js +3 -3
- package/components/table-of-contents/example-table-of-contents-sticky-full-page.njk +1 -1
- package/components/tabs/_macro.njk +3 -3
- package/components/tabs/_macro.spec.js +3 -3
- package/components/tabs/_tabs.scss +3 -4
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/text-indent/_text-indent.scss +1 -1
- package/components/text-indent/example-text-indent.njk +1 -1
- package/components/timeline/_macro.njk +4 -4
- package/components/timeline/_macro.spec.js +3 -3
- package/components/timeline/_timeline.scss +4 -3
- package/components/timeline/example-timeline.njk +1 -1
- package/components/upload/_upload.scss +2 -2
- package/components/video/_macro.njk +4 -4
- package/components/video/_macro.spec.js +2 -2
- package/components/video/_video.scss +1 -1
- package/components/video/example-video.njk +2 -2
- package/components/video/video.spec.js +2 -2
- package/css/main.css +1 -1
- package/layout/_dsTemplate.njk +1 -1
- package/layout/_template.njk +31 -31
- package/package.json +3 -2
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +2 -0
- package/scss/base/_typography.scss +0 -2
- package/scss/main.scss +0 -1
- package/scss/objects/_container.scss +1 -1
- package/scss/objects/_page.scss +2 -3
- package/scss/overrides/rtl.scss +1 -1
- package/scss/utilities/_grid.scss +103 -96
- package/scss/utilities/_margin.scss +11 -5
- package/scss/utilities/_padding.scss +12 -5
- package/scss/utilities/_typography.scss +2 -1
- package/scss/vars/_forms.scss +8 -10
- package/scss/vars/_grid.scss +4 -4
- package/scss/vars/_typography.scss +26 -19
- package/components/call-to-action/_call-to-action.scss +0 -8
- package/components/call-to-action/_macro.njk +0 -24
- package/components/call-to-action/_macro.spec.js +0 -48
- package/components/call-to-action/example-call-to-action-default.njk +0 -15
- package/components/metadata/_macro.njk +0 -14
|
@@ -9,14 +9,14 @@ const EXAMPLE_WITH_TWO_LANGUAGES = {
|
|
|
9
9
|
languages: [
|
|
10
10
|
{
|
|
11
11
|
url: '/english',
|
|
12
|
-
|
|
12
|
+
isoCode: 'en',
|
|
13
13
|
text: 'English',
|
|
14
14
|
abbrText: 'EN',
|
|
15
15
|
current: true,
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
url: '/cymraeg',
|
|
19
|
-
|
|
19
|
+
isoCode: 'cy',
|
|
20
20
|
text: 'Cymraeg',
|
|
21
21
|
abbrText: 'CY',
|
|
22
22
|
current: false,
|
|
@@ -32,19 +32,19 @@ const EXAMPLE_WITH_THREE_LANGUAGES = {
|
|
|
32
32
|
languages: [
|
|
33
33
|
{
|
|
34
34
|
url: '/english',
|
|
35
|
-
|
|
35
|
+
isoCode: 'en',
|
|
36
36
|
text: 'English',
|
|
37
37
|
current: false,
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
40
|
url: '/cymraeg',
|
|
41
|
-
|
|
41
|
+
isoCode: 'cy',
|
|
42
42
|
text: 'Cymraeg',
|
|
43
43
|
current: true,
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
url: '/polski',
|
|
47
|
-
|
|
47
|
+
isoCode: 'pl',
|
|
48
48
|
text: 'Polski',
|
|
49
49
|
current: false,
|
|
50
50
|
},
|
|
@@ -96,7 +96,7 @@ describe('macro: language-selector', () => {
|
|
|
96
96
|
it('does not have a visibility class applied', () => {
|
|
97
97
|
const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_TWO_LANGUAGES));
|
|
98
98
|
|
|
99
|
-
expect($('.ons-language-links').hasClass('ons-u-d-no@
|
|
99
|
+
expect($('.ons-language-links').hasClass('ons-u-d-no@2xs@m')).toBe(false);
|
|
100
100
|
});
|
|
101
101
|
|
|
102
102
|
it('has the `abbrText` rendered', () => {
|
|
@@ -131,7 +131,7 @@ describe('macro: language-selector', () => {
|
|
|
131
131
|
it('has the visibility class applied', () => {
|
|
132
132
|
const $ = cheerio.load(renderComponent('language-selector', EXAMPLE_WITH_THREE_LANGUAGES));
|
|
133
133
|
|
|
134
|
-
expect($('.ons-language-links').hasClass('ons-u-d-no@
|
|
134
|
+
expect($('.ons-language-links').hasClass('ons-u-d-no@2xs@m')).toBe(true);
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
});
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
&:first-child {
|
|
7
7
|
margin-top: 0.5rem;
|
|
8
8
|
}
|
|
9
|
-
&:last-child {
|
|
10
|
-
margin-bottom: -0.5;
|
|
11
|
-
}
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
&--spacious {
|
|
@@ -80,8 +77,7 @@
|
|
|
80
77
|
&--icons {
|
|
81
78
|
margin-bottom: 0;
|
|
82
79
|
.ons-list__item {
|
|
83
|
-
margin
|
|
84
|
-
margin-bottom: 0.5rem;
|
|
80
|
+
margin: 0 0 0.5rem;
|
|
85
81
|
}
|
|
86
82
|
}
|
|
87
83
|
|
|
@@ -21,17 +21,18 @@
|
|
|
21
21
|
{% set listEl = 'ul' %}
|
|
22
22
|
{% endif %}
|
|
23
23
|
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
{% if listLength < 2 and not params.attributes %}
|
|
25
|
+
{% set attributes = [params.itemsList[0].attributes] %}
|
|
26
|
+
{% elif listLength < 2 and params.attributes and params.itemsList[0].attributes and listEl == 'p' %}
|
|
27
|
+
{% set attributes = [params.attributes, params.itemsList[0].attributes] %}
|
|
27
28
|
{% else %}
|
|
28
|
-
{% set attributes = params.attributes %}
|
|
29
|
+
{% set attributes = [params.attributes] %}
|
|
29
30
|
{% endif %}
|
|
30
31
|
{% set openingTag = "<" + listEl %}
|
|
31
32
|
{% set closingTag = "</" + listEl + ">" %}
|
|
32
33
|
|
|
33
34
|
{{ openingTag | safe }}{% if params.id %}{{ ' ' }}id="{{ params.id }}"{% endif %}
|
|
34
|
-
class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes or params.itemsList[0].attributes %}{% for attribute, value in (
|
|
35
|
+
class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes or params.itemsList[0].attributes %}{% for attributeList in attributes %}{% for attribute, value in (attributeList.items() if attributeList is mapping and attributeList.items else attributeList) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endfor %}{% endif %}>
|
|
35
36
|
{%- for item in params.itemsList -%}
|
|
36
37
|
{% set sublistClasses = item.listClasses if item.listClasses %}
|
|
37
38
|
{%
|
|
@@ -78,15 +79,14 @@
|
|
|
78
79
|
{{
|
|
79
80
|
onsExternalLink({
|
|
80
81
|
"url": item.url,
|
|
81
|
-
"
|
|
82
|
+
"text": itemText
|
|
82
83
|
})
|
|
83
84
|
}}
|
|
84
85
|
{%- else -%}
|
|
85
|
-
{# Remove setting attributes on link in future update #}
|
|
86
86
|
<a
|
|
87
87
|
href="{{ item.url }}"
|
|
88
88
|
class="ons-list__link{{ ' ons-js-inpagelink' if item.variants == 'inPageLink' }}{{ ' ' + item.classes if item.classes else '' }}"
|
|
89
|
-
{% if item.target %}target="{{ item.target }}"{% endif %}
|
|
89
|
+
{% if item.target %}target="{{ item.target }}"{% endif %}
|
|
90
90
|
>
|
|
91
91
|
{%- if item.prefix -%}<span class="ons-u-vh">{{- item.prefix -}}</span>{%- endif -%} {{- itemText | safe -}}
|
|
92
92
|
{%- if item.target == "_blank" -%}
|
|
@@ -124,11 +124,10 @@
|
|
|
124
124
|
{% endset %}
|
|
125
125
|
|
|
126
126
|
{% if listLength > 1 or listEl == 'ul' %}
|
|
127
|
-
{# Remove if not item.url in future update #}
|
|
128
127
|
<li
|
|
129
128
|
class="ons-list__item{{ ' ' + item.listClasses if item.listClasses else '' }}"
|
|
130
129
|
{% if item.current %}aria-current="true"{% endif %}
|
|
131
|
-
{% if
|
|
130
|
+
{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}
|
|
132
131
|
>
|
|
133
132
|
{{- listItem | safe -}}
|
|
134
133
|
</li>
|
|
@@ -178,7 +178,19 @@ describe('macro: list', () => {
|
|
|
178
178
|
const $ = cheerio.load(
|
|
179
179
|
renderComponent('list', {
|
|
180
180
|
element: 'ol',
|
|
181
|
-
|
|
181
|
+
attributes: {
|
|
182
|
+
a: 123,
|
|
183
|
+
b: 456,
|
|
184
|
+
},
|
|
185
|
+
itemsList: [
|
|
186
|
+
{
|
|
187
|
+
text: 'Only item',
|
|
188
|
+
attributes: {
|
|
189
|
+
c: 789,
|
|
190
|
+
d: 123,
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
],
|
|
182
194
|
}),
|
|
183
195
|
);
|
|
184
196
|
|
|
@@ -193,6 +205,16 @@ describe('macro: list', () => {
|
|
|
193
205
|
it('does not output any <li> elements', () => {
|
|
194
206
|
expect($('.ons-list li').length).toBe(0);
|
|
195
207
|
});
|
|
208
|
+
|
|
209
|
+
it('has additionally provided list `attributes`', () => {
|
|
210
|
+
expect($('.ons-list').attr('a')).toBe('123');
|
|
211
|
+
expect($('.ons-list').attr('b')).toBe('456');
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it('has additionally provided list item `attributes`', () => {
|
|
215
|
+
expect($('.ons-list--p').attr('c')).toBe('789');
|
|
216
|
+
expect($('.ons-list--p').attr('d')).toBe('123');
|
|
217
|
+
});
|
|
196
218
|
});
|
|
197
219
|
|
|
198
220
|
it('has additionally provided `attributes`', () => {
|
|
@@ -247,6 +269,25 @@ describe('macro: list', () => {
|
|
|
247
269
|
|
|
248
270
|
expect($('a').length).toBe(0);
|
|
249
271
|
});
|
|
272
|
+
|
|
273
|
+
it('has additionally provided `attributes`', () => {
|
|
274
|
+
const $ = cheerio.load(
|
|
275
|
+
renderComponent('list', {
|
|
276
|
+
itemsList: [
|
|
277
|
+
{
|
|
278
|
+
...item,
|
|
279
|
+
attributes: {
|
|
280
|
+
a: 123,
|
|
281
|
+
b: 456,
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
}),
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
expect($('.ons-list__item').attr('a')).toBe('123');
|
|
289
|
+
expect($('.ons-list__item').attr('b')).toBe('456');
|
|
290
|
+
});
|
|
250
291
|
});
|
|
251
292
|
|
|
252
293
|
describe('content with an internal link', () => {
|
|
@@ -380,7 +421,7 @@ describe('macro: list', () => {
|
|
|
380
421
|
expect($('.ons-list__link .ons-u-vh').text()).toBe(' (opens in a new tab)');
|
|
381
422
|
});
|
|
382
423
|
|
|
383
|
-
it('has additionally provided `attributes`', () => {
|
|
424
|
+
it('list item has additionally provided `attributes`', () => {
|
|
384
425
|
const $ = cheerio.load(
|
|
385
426
|
renderComponent('list', {
|
|
386
427
|
itemsList: [
|
|
@@ -396,8 +437,8 @@ describe('macro: list', () => {
|
|
|
396
437
|
}),
|
|
397
438
|
);
|
|
398
439
|
|
|
399
|
-
expect($('.ons-
|
|
400
|
-
expect($('.ons-
|
|
440
|
+
expect($('.ons-list__item').attr('a')).toBe('123');
|
|
441
|
+
expect($('.ons-list__item').attr('b')).toBe('456');
|
|
401
442
|
});
|
|
402
443
|
|
|
403
444
|
it('renders visually hidden prefix', () => {
|
|
@@ -451,7 +492,7 @@ describe('macro: list', () => {
|
|
|
451
492
|
|
|
452
493
|
expect(externalLinkSpy.occurrences[0]).toEqual({
|
|
453
494
|
url: 'https://example.com/external-link',
|
|
454
|
-
|
|
495
|
+
text: expectedItemText,
|
|
455
496
|
});
|
|
456
497
|
});
|
|
457
498
|
|
|
@@ -603,12 +644,12 @@ describe('macro: list', () => {
|
|
|
603
644
|
itemsList: [{ text: 'First item' }, { text: 'Second item', iconType: 'print' }, { text: 'Third item' }],
|
|
604
645
|
iconPosition,
|
|
605
646
|
iconType: 'check',
|
|
606
|
-
iconSize: '
|
|
647
|
+
iconSize: '2xl',
|
|
607
648
|
});
|
|
608
649
|
|
|
609
|
-
expect(iconsSpy.occurrences[0]).toEqual({ iconType: 'check', iconSize: '
|
|
610
|
-
expect(iconsSpy.occurrences[1]).toEqual({ iconType: 'print', iconSize: '
|
|
611
|
-
expect(iconsSpy.occurrences[2]).toEqual({ iconType: 'check', iconSize: '
|
|
650
|
+
expect(iconsSpy.occurrences[0]).toEqual({ iconType: 'check', iconSize: '2xl' });
|
|
651
|
+
expect(iconsSpy.occurrences[1]).toEqual({ iconType: 'print', iconSize: '2xl' });
|
|
652
|
+
expect(iconsSpy.occurrences[2]).toEqual({ iconType: 'check', iconSize: '2xl' });
|
|
612
653
|
});
|
|
613
654
|
|
|
614
655
|
it('renders the icon before the item text', () => {
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
</dd>
|
|
22
22
|
</div>
|
|
23
23
|
</dl>
|
|
24
|
-
{% if params.
|
|
24
|
+
{% if params.unreadLinkUrl %}
|
|
25
25
|
<a
|
|
26
26
|
class="ons-message__unread-link"
|
|
27
27
|
{% if params.unreadLinkId %}id="{{ params.unreadLinkId }}"{% endif %}
|
|
28
|
-
href="{{ params.
|
|
28
|
+
href="{{ params.unreadLinkUrl }}"
|
|
29
29
|
>{{ params.unreadLinkText }}</a
|
|
30
30
|
>
|
|
31
31
|
{% endif %}
|
|
32
32
|
</div>
|
|
33
|
-
<div class="ons-message__body" {% if params.
|
|
33
|
+
<div class="ons-message__body" {% if params.messageId %}id="{{ params.messageId }}"{% endif %}>{{ caller() }}</div>
|
|
34
34
|
</div>
|
|
35
35
|
{%- endmacro -%}
|
|
@@ -15,13 +15,13 @@ const EXAMPLE_MESSAGE_MINIMAL = {
|
|
|
15
15
|
|
|
16
16
|
const EXAMPLE_MESSAGE = {
|
|
17
17
|
...EXAMPLE_MESSAGE_MINIMAL,
|
|
18
|
-
|
|
18
|
+
unreadLinkUrl: 'https://example.com/message/1',
|
|
19
19
|
unreadLinkText: 'Unread message',
|
|
20
20
|
id: 'message1',
|
|
21
21
|
fromId: 'from1',
|
|
22
22
|
sentId: 'sent1',
|
|
23
23
|
unreadLinkId: 'unreadLink1',
|
|
24
|
-
|
|
24
|
+
messageId: 'messageBody1',
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
describe('macro: message', () => {
|
|
@@ -92,7 +92,7 @@ describe('macro: message', () => {
|
|
|
92
92
|
expect($('.ons-message__timestamp .ons-message__value').attr('id')).toBe('sent1');
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
it('has the provided `
|
|
95
|
+
it('has the provided `unreadLinkUrl`', () => {
|
|
96
96
|
const $ = cheerio.load(renderComponent('message', EXAMPLE_MESSAGE, ['Message content...']));
|
|
97
97
|
|
|
98
98
|
expect($('.ons-message__unread-link').attr('href')).toBe('https://example.com/message/1');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{% for message in params.messages %}
|
|
4
4
|
<li class="ons-message-item" aria-labelledby="{{ message.id }}">
|
|
5
5
|
<h3 class="ons-message-item__subject" id="{{ message.id }}">
|
|
6
|
-
<a href="{{ message.url }}" class="ons-u-fs-r--b">{{ message.subject }}</a>
|
|
6
|
+
<a href="{{ message.subject.url }}" class="ons-u-fs-r--b">{{ message.subject.text }}</a>
|
|
7
7
|
{% if message.unread %}<span class="ons-message-item__unread ons-u-fs-s">({{ params.unreadText }})</span>{% endif %}
|
|
8
8
|
</h3>
|
|
9
9
|
<dl class="ons-message-item__metadata" aria-label="{{ params.ariaLabelMetaData | default("Message metadata") }}">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
{{ message.body | safe }}
|
|
21
21
|
</div>
|
|
22
22
|
<div class="ons-message-item__link ons-u-vh">
|
|
23
|
-
<a href="{{ message.url }}">{{ params.hiddenReadLabel }}: {{ message.subject }}</a>
|
|
23
|
+
<a href="{{ message.subject.url }}">{{ params.hiddenReadLabel }}: {{ message.subject.text }}</a>
|
|
24
24
|
</div>
|
|
25
25
|
</li>
|
|
26
26
|
{% endfor %}
|
|
@@ -14,16 +14,20 @@ const EXAMPLE_MESSAGE_LIST_MINIMAL = {
|
|
|
14
14
|
{
|
|
15
15
|
id: 'message1',
|
|
16
16
|
unread: true,
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
subject: {
|
|
18
|
+
url: 'https://example.com/message/1',
|
|
19
|
+
text: 'Example message subject',
|
|
20
|
+
},
|
|
19
21
|
fromText: 'Example Sender 1',
|
|
20
22
|
dateText: 'Tue 4 Jul 2020 at 7:47',
|
|
21
23
|
body: 'An example message.',
|
|
22
24
|
},
|
|
23
25
|
{
|
|
24
26
|
id: 'message2',
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
subject: {
|
|
28
|
+
url: 'https://example.com/message/2',
|
|
29
|
+
text: 'Another example message subject',
|
|
30
|
+
},
|
|
27
31
|
fromText: 'Example Sender 2',
|
|
28
32
|
dateText: 'Mon 1 Oct 2019 at 9:52',
|
|
29
33
|
body: 'Another example message.',
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
{% from "components/autosuggest/_macro.njk" import onsAutosuggest %}
|
|
4
4
|
<div class="ons-navigation-wrapper{{ ' ons-navigation-wrapper--neutral' if params.variants == 'neutral' }}">
|
|
5
5
|
<div
|
|
6
|
-
class="ons-container ons-container--gutterless@
|
|
6
|
+
class="ons-container ons-container--gutterless@2xs@l{{ ' ons-container--full-width' if params.fullWidth or params.navigation.fullWidth }}{{ ' ons-container--wide' if params.wide or params.navigation.wide }}"
|
|
7
7
|
>
|
|
8
8
|
{% if params.siteSearchAutosuggest %}
|
|
9
9
|
<div class="ons-navigation-search ons-js-navigation-search">
|
|
10
10
|
{% set autosuggestClasses = "ons-input-search ons-input-search--icon" %}
|
|
11
|
-
{% set autosuggestLabelClasses = "ons-u-pl-
|
|
11
|
+
{% set autosuggestLabelClasses = "ons-u-pl-xl" %}
|
|
12
12
|
{% if params.variants == "neutral" %}
|
|
13
13
|
{% set autosuggestClasses = autosuggestClasses + ' ons-input-search--dark' %}
|
|
14
14
|
{% else %}
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
{% if params.navigation.subNavigation %}
|
|
78
78
|
{% if not params.navigation.subNavigation.removeHorizontalSubNav %}
|
|
79
79
|
<nav
|
|
80
|
-
class="ons-navigation ons-navigation--sub ons-u-d-no@
|
|
80
|
+
class="ons-navigation ons-navigation--sub ons-u-d-no@2xs@l{{ ' ' + params.navigation.subNavigation.classes if params.navigation.subNavigation.classes else '' }}"
|
|
81
81
|
id="{{ params.navigation.subNavigation.id }}"
|
|
82
82
|
aria-label="{{ params.navigation.subNavigation.ariaLabel | default('Section menu') }}"
|
|
83
83
|
data-analytics="header-section-navigation"
|
|
84
84
|
>
|
|
85
85
|
<div
|
|
86
|
-
class="ons-container ons-container--gutterless@
|
|
86
|
+
class="ons-container ons-container--gutterless@2xs@l{{ ' ons-container--full-width' if params.fullWidth or params.navigation.fullWidth }}{{ ' ons-container--wide' if params.wide or params.navigation.wide }}"
|
|
87
87
|
>
|
|
88
88
|
<ul class="ons-navigation__list ons-navigation__list">
|
|
89
89
|
{% for item in params.navigation.subNavigation.itemsList %}
|
|
@@ -123,20 +123,20 @@
|
|
|
123
123
|
})
|
|
124
124
|
}}
|
|
125
125
|
<nav
|
|
126
|
-
class="ons-navigation ons-navigation--sub-mobile ons-u-d-no ons-js-secondary-nav ons-u-mt-
|
|
126
|
+
class="ons-navigation ons-navigation--sub-mobile ons-u-d-no ons-js-secondary-nav ons-u-mt-2xs"
|
|
127
127
|
id="{{ params.navigation.subNavigation.id }}--mobile"
|
|
128
128
|
aria-hidden="true"
|
|
129
129
|
aria-label="{{ params.navigation.subNavigation.ariaLabel | default("Section menu") }}"
|
|
130
130
|
data-analytics="header-section-navigation"
|
|
131
131
|
>
|
|
132
132
|
<div
|
|
133
|
-
class="ons-container ons-container--gutterless@
|
|
133
|
+
class="ons-container ons-container--gutterless@2xs@l{{ ' ons-container--full-width' if params.navigation.fullWidth }}{{ ' ons-container--wide' if params.navigation.wide }}"
|
|
134
134
|
>
|
|
135
135
|
<ul class="ons-navigation__list ons-navigation__list--parent">
|
|
136
136
|
<li
|
|
137
|
-
class="ons-navigation__item{{ ' ons-navigation__item--active' if (params.navigation.subNavigation.
|
|
137
|
+
class="ons-navigation__item{{ ' ons-navigation__item--active' if (params.navigation.subNavigation.overviewUrl == params.navigation.subNavigation.currentPath) }}"
|
|
138
138
|
>
|
|
139
|
-
<a class="ons-navigation__link" href="{{ params.navigation.subNavigation.
|
|
139
|
+
<a class="ons-navigation__link" href="{{ params.navigation.subNavigation.overviewUrl }}"
|
|
140
140
|
>{{ params.navigation.subNavigation.overviewText | default('Overview') }}</a
|
|
141
141
|
>
|
|
142
142
|
</li>
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
<h3 class="ons-navigation__list-header">{{ section.sectionTitle }}</h3>
|
|
163
163
|
{% endif %}
|
|
164
164
|
<ul
|
|
165
|
-
class="ons-navigation__list ons-navigation__list--child ons-list--dashed ons-u-ml-s ons-u-mt-
|
|
165
|
+
class="ons-navigation__list ons-navigation__list--child ons-list--dashed ons-u-ml-s ons-u-mt-2xs"
|
|
166
166
|
>
|
|
167
167
|
{% for child in section.children %}
|
|
168
168
|
<li
|
|
@@ -29,7 +29,7 @@ const PARAMS = {
|
|
|
29
29
|
],
|
|
30
30
|
subNavigation: {
|
|
31
31
|
id: 'sub-nav',
|
|
32
|
-
|
|
32
|
+
overviewUrl: '#overview',
|
|
33
33
|
overviewText: 'Overview',
|
|
34
34
|
ariaLabel: 'Section menu',
|
|
35
35
|
itemsList: [
|
|
@@ -138,7 +138,7 @@ describe('macro: navigation', () => {
|
|
|
138
138
|
classes: 'ons-input-search ons-input-search--icon',
|
|
139
139
|
label: {
|
|
140
140
|
id: 'ons-site-search-label',
|
|
141
|
-
classes: 'ons-u-pl-
|
|
141
|
+
classes: 'ons-u-pl-xl ons-label--white',
|
|
142
142
|
},
|
|
143
143
|
},
|
|
144
144
|
});
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
&-wrapper {
|
|
5
5
|
background: var(--ons-color-header);
|
|
6
|
-
margin-top: -0.03rem;
|
|
7
6
|
|
|
8
7
|
&--neutral {
|
|
9
8
|
background: var(--ons-color-header-neutral);
|
|
@@ -42,8 +41,7 @@
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
&-header {
|
|
45
|
-
|
|
46
|
-
margin: 0.75rem 0 0.6rem;
|
|
44
|
+
margin: 0.75rem 0 0.5rem;
|
|
47
45
|
padding: 0 0 0 1rem;
|
|
48
46
|
}
|
|
49
47
|
}
|
|
@@ -51,7 +49,6 @@
|
|
|
51
49
|
&__item {
|
|
52
50
|
border-left: 4px solid transparent;
|
|
53
51
|
display: block;
|
|
54
|
-
margin: 0 0 0.2rem;
|
|
55
52
|
&--active,
|
|
56
53
|
&:hover {
|
|
57
54
|
border-color: var(--ons-color-white);
|
|
@@ -72,7 +69,7 @@
|
|
|
72
69
|
border-left: 0;
|
|
73
70
|
display: inline-block;
|
|
74
71
|
margin: 0 0 0 1rem;
|
|
75
|
-
padding: 0 0 0.
|
|
72
|
+
padding: 0 0 0.25rem;
|
|
76
73
|
position: relative;
|
|
77
74
|
text-align: center;
|
|
78
75
|
|
|
@@ -123,7 +120,6 @@
|
|
|
123
120
|
|
|
124
121
|
@include mq(l) {
|
|
125
122
|
display: inline-block;
|
|
126
|
-
font-size: 1rem;
|
|
127
123
|
margin: 0;
|
|
128
124
|
padding: 0;
|
|
129
125
|
}
|
|
@@ -3,7 +3,7 @@ import domready from '../../js/domready';
|
|
|
3
3
|
domready(async () => {
|
|
4
4
|
const toggleNavigationBtn = document.querySelector('.ons-js-navigation-button');
|
|
5
5
|
const navigationEl = document.querySelector('.ons-js-navigation');
|
|
6
|
-
const navigationHideClass = 'ons-u-d-no@
|
|
6
|
+
const navigationHideClass = 'ons-u-d-no@2xs@l';
|
|
7
7
|
const toggleSubNavigationBtn = document.querySelector('.ons-js-sub-navigation-button');
|
|
8
8
|
const subNavigationEl = document.querySelector('.ons-js-secondary-nav');
|
|
9
9
|
const subNavigationHideClass = 'ons-u-d-no';
|
|
@@ -49,7 +49,7 @@ const EXAMPLE_NAVIGATION_WITH_SUBNAVIGATION = {
|
|
|
49
49
|
],
|
|
50
50
|
subNavigation: {
|
|
51
51
|
id: 'sub-nav',
|
|
52
|
-
|
|
52
|
+
overviewUrl: '#overview',
|
|
53
53
|
overviewText: 'Overview',
|
|
54
54
|
ariaLabel: 'Section menu',
|
|
55
55
|
currentPath: '#1',
|
|
@@ -108,7 +108,7 @@ const EXAMPLE_NAVIGATION_WITH_SUBNAVIGATION_REMOVED = {
|
|
|
108
108
|
],
|
|
109
109
|
subNavigation: {
|
|
110
110
|
id: 'sub-nav-hidden',
|
|
111
|
-
|
|
111
|
+
overviewUrl: '#overview',
|
|
112
112
|
overviewText: 'Overview',
|
|
113
113
|
ariaLabel: 'Section menu',
|
|
114
114
|
currentPath: '#1',
|
|
@@ -212,7 +212,7 @@ describe('script: navigation', () => {
|
|
|
212
212
|
|
|
213
213
|
it('has the hide class removed from the navigation list', async () => {
|
|
214
214
|
const hasClass = await page.$eval(navEl, (node) =>
|
|
215
|
-
node.classList.contains('ons-u-d-no@
|
|
215
|
+
node.classList.contains('ons-u-d-no@2xs@l' || 'ons-u-d-no' || 'ons-u-d-no@xs@l'),
|
|
216
216
|
);
|
|
217
217
|
expect(hasClass).toBe(false);
|
|
218
218
|
});
|
|
@@ -284,7 +284,7 @@ describe('script: navigation', () => {
|
|
|
284
284
|
|
|
285
285
|
it('has the hide class removed from the navigation list', async () => {
|
|
286
286
|
const hasClass = await page.$eval(navEl, (node) =>
|
|
287
|
-
node.classList.contains('ons-u-d-no@
|
|
287
|
+
node.classList.contains('ons-u-d-no@2xs@l' || 'ons-u-d-no' || 'ons-u-d-no@xs@l'),
|
|
288
288
|
);
|
|
289
289
|
expect(hasClass).toBe(false);
|
|
290
290
|
});
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{{-
|
|
27
27
|
onsIcon({
|
|
28
28
|
"iconType": 'arrow-previous',
|
|
29
|
-
"classes": 'ons-u-mr-
|
|
29
|
+
"classes": 'ons-u-mr-2xs',
|
|
30
30
|
"iconSize": 'm'
|
|
31
31
|
})
|
|
32
32
|
-}}
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
{{-
|
|
94
94
|
onsIcon({
|
|
95
95
|
"iconType": 'arrow-next',
|
|
96
|
-
"classes": 'ons-u-ml-
|
|
96
|
+
"classes": 'ons-u-ml-2xs',
|
|
97
97
|
"iconSize": 'm'
|
|
98
98
|
})
|
|
99
99
|
-}}
|
|
@@ -3,7 +3,7 @@ $pagination-item-width: 2.5rem;
|
|
|
3
3
|
|
|
4
4
|
.ons-pagination {
|
|
5
5
|
&__position {
|
|
6
|
-
margin: 0 0 0.
|
|
6
|
+
margin: 0 0 0.5rem;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
&__items {
|
|
@@ -27,12 +27,6 @@ $pagination-item-width: 2.5rem;
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
&__items > & {
|
|
31
|
-
&__item--current {
|
|
32
|
-
margin: 0 0 0 $pagination-item-padding;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
30
|
&__item,
|
|
37
31
|
&__link {
|
|
38
32
|
height: $pagination-item-width;
|
|
@@ -52,13 +52,14 @@
|
|
|
52
52
|
|
|
53
53
|
{% if params.title %}
|
|
54
54
|
{% if params.variant == 'error' %}
|
|
55
|
-
{% set defaultTitleTag = "
|
|
55
|
+
{% set defaultTitleTag = "h" ~ 2 %}
|
|
56
56
|
{% else %}
|
|
57
57
|
{% set defaultTitleTag = "div" %}
|
|
58
58
|
{% endif %}
|
|
59
|
-
{% set
|
|
60
|
-
{% set
|
|
61
|
-
{% set
|
|
59
|
+
{% set headingLevel = "h" ~ params.headingLevel if params.headingLevel else undefined %}
|
|
60
|
+
{% set titleTag = headingLevel | default(defaultTitleTag) %}
|
|
61
|
+
{% set openingTag = "<" ~ titleTag %}
|
|
62
|
+
{% set closingTag = "</" ~ titleTag ~ ">" %}
|
|
62
63
|
<div class="ons-panel__header">
|
|
63
64
|
{{ openingTag | safe }} id="alert"{% if params.variant %}data-qa="{{ params.variant }}-header"{% endif %}
|
|
64
65
|
class="ons-panel__title ons-u-fs-r--b">{{ params.title | safe }}{{ closingTag | safe }}
|
|
@@ -147,12 +147,12 @@ describe('macro: panel', () => {
|
|
|
147
147
|
expect(titleTag).toBe('div');
|
|
148
148
|
});
|
|
149
149
|
|
|
150
|
-
it('has the provided `
|
|
150
|
+
it('has the provided `headingLevel`', () => {
|
|
151
151
|
const $ = cheerio.load(
|
|
152
152
|
renderComponent('panel', {
|
|
153
153
|
...EXAMPLE_PANEL_BASIC,
|
|
154
154
|
title: 'Panel title',
|
|
155
|
-
|
|
155
|
+
headingLevel: 3,
|
|
156
156
|
}),
|
|
157
157
|
);
|
|
158
158
|
|