@ons/design-system 54.0.1 → 55.2.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 +3 -3
- package/components/accordion/_macro.njk +1 -1
- package/components/address-input/_macro.njk +7 -7
- package/components/address-output/_macro.njk +7 -7
- package/components/autosuggest/_macro.njk +19 -19
- package/components/breadcrumbs/_macro.njk +3 -3
- package/components/browser-banner/_macro.njk +1 -1
- package/components/browser-banner/_macro.spec.js +31 -0
- package/components/button/_button.scss +21 -7
- package/components/button/_macro.njk +25 -25
- package/components/button/_macro.spec.js +2 -2
- package/components/call-to-action/_macro.njk +1 -1
- package/components/card/_macro.njk +10 -10
- package/components/checkboxes/_checkbox-macro.njk +9 -9
- package/components/checkboxes/_checkbox.scss +43 -10
- package/components/checkboxes/_macro.njk +10 -10
- package/components/checkboxes/checkbox-with-fieldset.js +6 -5
- package/components/checkboxes/checkboxes.dom.js +6 -9
- package/components/code-highlight/_macro.njk +1 -1
- package/components/collapsible/_collapsible.scss +2 -1
- package/components/collapsible/_macro.njk +7 -7
- package/components/date-input/_macro.njk +5 -5
- package/components/document-list/_macro.njk +29 -29
- package/components/document-list/document-list.scss +2 -0
- package/components/download-resources/download-resources.js +19 -0
- package/components/download-resources/download-resources.spec.js +95 -0
- package/components/duration/_macro.njk +9 -9
- package/components/duration/_macro.spec.js +0 -3
- package/components/error/_macro.njk +1 -1
- package/components/external-link/_macro.njk +2 -2
- package/components/external-link/_macro.spec.js +2 -2
- package/components/feedback/_macro.njk +2 -2
- package/components/field/_macro.njk +5 -5
- package/components/fieldset/_fieldset.scss +11 -1
- package/components/fieldset/_macro.njk +15 -14
- package/components/fieldset/_macro.spec.js +27 -5
- package/components/footer/_footer.scss +1 -0
- package/components/footer/_macro.njk +18 -18
- package/components/footer/_macro.spec.js +18 -0
- package/components/header/_header.scss +7 -2
- package/components/header/_macro.njk +63 -37
- package/components/header/_macro.spec.js +82 -14
- package/components/hero/_macro.njk +16 -16
- package/components/hero/_macro.spec.js +1 -1
- package/components/icons/_macro.njk +2 -2
- package/components/images/_macro.njk +3 -3
- package/components/input/_input-type.scss +7 -0
- package/components/input/_input.scss +13 -2
- package/components/input/_macro.njk +40 -34
- package/components/input/_macro.spec.js +64 -59
- package/components/label/_label.scss +1 -1
- package/components/label/_macro.njk +27 -15
- package/components/label/_macro.spec.js +31 -0
- package/components/language-selector/_macro.njk +1 -1
- package/components/lists/_macro.njk +22 -22
- package/components/lists/_macro.spec.js +2 -2
- package/components/message/_macro.njk +6 -6
- package/components/message/_message.scss +1 -0
- package/components/message-list/_macro.njk +1 -1
- package/components/metadata/_macro.njk +2 -2
- package/components/modal/_macro.njk +6 -6
- package/components/modal/_modal.scss +10 -9
- package/components/mutually-exclusive/_macro.njk +1 -1
- package/components/mutually-exclusive/mutually-exclusive.js +3 -1
- package/components/navigation/_macro.njk +9 -10
- package/components/navigation/_macro.spec.js +0 -1
- package/components/pagination/_macro.njk +3 -3
- package/components/pagination/_pagination.scss +1 -0
- package/components/panel/_macro.njk +38 -43
- package/components/panel/_macro.spec.js +24 -33
- package/components/panel/_panel.scss +13 -5
- package/components/phase-banner/_macro.njk +1 -1
- package/components/phase-banner/_macro.spec.js +31 -0
- package/components/phase-banner/_phase-banner.scss +1 -0
- package/components/promotional-banner/_macro.njk +2 -2
- package/components/question/_macro.njk +18 -18
- package/components/quote/_macro.njk +2 -2
- package/components/radios/_macro.njk +8 -8
- package/components/radios/_radio.scss +15 -3
- package/components/radios/check-radios.js +5 -1
- package/components/related-content/_macro.njk +2 -2
- package/components/relationships/_macro.njk +2 -2
- package/components/reply/_macro.njk +2 -2
- package/components/section-navigation/_macro.njk +2 -2
- package/components/select/_macro.njk +8 -8
- package/components/share-page/_macro.njk +2 -2
- package/components/skip-to-content/_skip.scss +2 -1
- package/components/status/_macro.njk +2 -2
- package/components/summary/_macro.njk +25 -25
- package/components/table/_macro.njk +13 -12
- package/components/table/_macro.spec.js +0 -27
- package/components/table/_table.scss +13 -6
- package/components/table/sortable-table.js +1 -0
- package/components/table-of-contents/_macro.njk +4 -4
- package/components/tabs/_tabs.scss +5 -3
- package/components/textarea/_macro.njk +8 -8
- package/components/timeline/_macro.njk +1 -1
- package/components/video/_macro.njk +1 -1
- package/css/census.css +1 -1
- package/css/ids.css +1 -1
- package/css/main.css +1 -1
- package/layout/_template.njk +57 -44
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_global.scss +1 -0
- package/scss/overrides/hcm.scss +205 -46
- package/scss/patternlib.scss +1 -0
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
{% macro onsDuration(params) %}
|
|
8
8
|
{% set numberOfFields = 0 %}
|
|
9
9
|
|
|
10
|
-
{% if params.field1
|
|
10
|
+
{% if params.field1 %}
|
|
11
11
|
{% set numberOfFields = numberOfFields + 1 %}
|
|
12
12
|
{% endif %}
|
|
13
13
|
|
|
14
|
-
{% if params.field2
|
|
14
|
+
{% if params.field2 %}
|
|
15
15
|
{% set numberOfFields = numberOfFields + 1 %}
|
|
16
16
|
{% endif %}
|
|
17
17
|
|
|
18
18
|
{% set fields %}
|
|
19
|
-
{% if params.field1
|
|
19
|
+
{% if params.field1 %}
|
|
20
20
|
{{ onsInput({
|
|
21
21
|
"id": params.field1.id,
|
|
22
|
-
"classes": (" ons-input--error" if (params.error
|
|
22
|
+
"classes": (" ons-input--error" if (params.error and params.field1.error) or (numberOfFields > 1 and params.error and not params.field1.error and not params.field2.error) else "") + (" ons-js-exclusive-group-item" if params.mutuallyExclusive else ""),
|
|
23
23
|
"width": "2",
|
|
24
24
|
"type": "number",
|
|
25
25
|
"name": params.field1.name,
|
|
26
26
|
"value": params.field1.value,
|
|
27
27
|
"suffix": {
|
|
28
28
|
"text": params.field1.suffix.text,
|
|
29
|
-
"title": params.field1.suffix.title
|
|
29
|
+
"title": params.field1.suffix.title,
|
|
30
30
|
"id": params.field1.suffix.id
|
|
31
31
|
},
|
|
32
32
|
"label": {
|
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
}) }}
|
|
40
40
|
{% endif %}
|
|
41
41
|
|
|
42
|
-
{% if params.field2
|
|
42
|
+
{% if params.field2 %}
|
|
43
43
|
{{ onsInput({
|
|
44
44
|
"id": params.field2.id,
|
|
45
|
-
"classes": (" ons-input--error" if (params.error
|
|
45
|
+
"classes": (" ons-input--error" if (params.error and params.field2.error) or (numberOfFields > 1 and params.error and not params.field1.error and not params.field2.error) else "") + (" ons-js-exclusive-group-item" if params.mutuallyExclusive else ""),
|
|
46
46
|
"width": "2",
|
|
47
47
|
"type": "number",
|
|
48
48
|
"name": params.field2.name,
|
|
49
49
|
"value": params.field2.value,
|
|
50
50
|
"suffix": {
|
|
51
51
|
"text": params.field2.suffix.text,
|
|
52
|
-
"title": params.field2.suffix.title
|
|
52
|
+
"title": params.field2.suffix.title,
|
|
53
53
|
"id": params.field2.suffix.id
|
|
54
54
|
},
|
|
55
55
|
"label": {
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
{% endif %}
|
|
64
64
|
{% endset %}
|
|
65
65
|
|
|
66
|
-
{% if params.mutuallyExclusive
|
|
66
|
+
{% if params.mutuallyExclusive %}
|
|
67
67
|
{% set mutuallyExclusive = params.mutuallyExclusive | setAttributes({
|
|
68
68
|
"id": params.id,
|
|
69
69
|
"legend": params.legendOrLabel,
|
|
@@ -78,7 +78,6 @@ describe('macro: duration', () => {
|
|
|
78
78
|
suffix: {
|
|
79
79
|
id: 'address-duration-years-suffix',
|
|
80
80
|
text: 'Years',
|
|
81
|
-
title: 'Years',
|
|
82
81
|
},
|
|
83
82
|
});
|
|
84
83
|
|
|
@@ -100,7 +99,6 @@ describe('macro: duration', () => {
|
|
|
100
99
|
suffix: {
|
|
101
100
|
id: 'address-duration-months-suffix',
|
|
102
101
|
text: 'Months',
|
|
103
|
-
title: 'Months',
|
|
104
102
|
},
|
|
105
103
|
});
|
|
106
104
|
});
|
|
@@ -228,7 +226,6 @@ describe('macro: duration', () => {
|
|
|
228
226
|
suffix: {
|
|
229
227
|
id: 'address-duration-years-suffix',
|
|
230
228
|
text: 'Years',
|
|
231
|
-
title: 'Years',
|
|
232
229
|
},
|
|
233
230
|
});
|
|
234
231
|
});
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{% set content %}
|
|
5
5
|
<p
|
|
6
6
|
class="ons-panel__error"
|
|
7
|
-
{% if params.attributes
|
|
7
|
+
{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
8
8
|
>
|
|
9
9
|
<strong>{{ params.text }}</strong>
|
|
10
10
|
</p>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{# Icon needed to be directly put here instead of calling macro to solve an issue with extra space on the end of links being underlined #}
|
|
2
2
|
{% macro onsExternalLink(params) %}
|
|
3
|
-
<a href="{{ params.url }}" class="ons-external-link{% if params.classes
|
|
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
6
|
</span><span class="ons-external-link__icon"> <svg class="ons-svg-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
|
-
</svg></span><span class="ons-external-link__new-window-description ons-u-vh">({{- params.newWindowDescription | default("opens in a new tab") -}})</span></a>
|
|
9
|
+
</svg></span><span class="ons-external-link__new-window-description ons-u-vh"> ({{- params.newWindowDescription | default("opens in a new tab") -}})</span></a>
|
|
10
10
|
{% endmacro %}
|
|
@@ -54,7 +54,7 @@ describe('macro: external-link', () => {
|
|
|
54
54
|
it('has a default new window description', async () => {
|
|
55
55
|
const $ = cheerio.load(renderComponent('external-link', EXAMPLE_EXTERNAL_LINK));
|
|
56
56
|
|
|
57
|
-
expect($('.ons-external-link__new-window-description').text()).toBe('(opens in a new tab)');
|
|
57
|
+
expect($('.ons-external-link__new-window-description').text()).toBe(' (opens in a new tab)');
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
it('has a custom new window description when `newWindowDescription` is provided', () => {
|
|
@@ -65,7 +65,7 @@ describe('macro: external-link', () => {
|
|
|
65
65
|
}),
|
|
66
66
|
);
|
|
67
67
|
|
|
68
|
-
expect($('.ons-external-link__new-window-description').text()).toBe('(custom opens in a new tab text)');
|
|
68
|
+
expect($('.ons-external-link__new-window-description').text()).toBe(' (custom opens in a new tab text)');
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
it('has an "external-link" icon', async () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{% macro onsFeedback(params) %}
|
|
2
2
|
{% set headingLevel = params.headingLevel | default("2") %}
|
|
3
|
-
<div {% if params.id
|
|
4
|
-
<h{{ headingLevel }} class="ons-feedback__heading{{ ' ' + params.headingClasses if params.headingClasses
|
|
3
|
+
<div {% if params.id %} id="{{ params.id }}"{% endif %} class="ons-feedback{% if params.classes %} {{ params.classes }}{% endif %}">
|
|
4
|
+
<h{{ headingLevel }} class="ons-feedback__heading{{ ' ' + params.headingClasses if params.headingClasses }}">
|
|
5
5
|
{{ params.heading }}
|
|
6
6
|
</h{{ headingLevel }}>
|
|
7
7
|
<p class="ons-feedback__content">{{- params.content | safe -}}</p>
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
{% endif %}
|
|
7
7
|
|
|
8
8
|
{% set field %}
|
|
9
|
-
{% if params.dontWrap
|
|
9
|
+
{% if params.dontWrap %}
|
|
10
10
|
{{- caller() if caller -}}
|
|
11
11
|
{% else %}
|
|
12
12
|
<div
|
|
13
|
-
{% if params.id
|
|
14
|
-
class="ons-field{% if params.inline
|
|
15
|
-
{% if params.attributes
|
|
13
|
+
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
14
|
+
class="ons-field{% if params.inline %} ons-field--inline{% endif %}{% if params.classes %} {{ params.classes }}{% endif %}"
|
|
15
|
+
{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
16
16
|
>
|
|
17
17
|
{{- caller() if caller -}}
|
|
18
18
|
</div>
|
|
19
19
|
{% endif %}
|
|
20
20
|
{% endset %}
|
|
21
21
|
|
|
22
|
-
{% if params.error
|
|
22
|
+
{% if params.error %}
|
|
23
23
|
{% call onsError(params.error) %}
|
|
24
24
|
{{ field | safe }}
|
|
25
25
|
{% endcall %}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
.ons-fieldset {
|
|
2
2
|
&__legend {
|
|
3
3
|
font-weight: $font-weight-bold;
|
|
4
|
-
margin: 0
|
|
4
|
+
margin: 0;
|
|
5
|
+
&:not(&--with-description) {
|
|
6
|
+
margin-bottom: 0.55rem;
|
|
7
|
+
}
|
|
8
|
+
&-title {
|
|
9
|
+
display: block;
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0 0 1.5rem;
|
|
12
|
+
}
|
|
5
13
|
}
|
|
6
14
|
|
|
7
15
|
&__description:not(&__description--title) {
|
|
8
16
|
@extend .ons-label__description;
|
|
17
|
+
|
|
18
|
+
margin-bottom: 0.55rem;
|
|
9
19
|
}
|
|
10
20
|
|
|
11
21
|
&__description--title {
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
{% from "components/error/_macro.njk" import onsError %}
|
|
2
2
|
|
|
3
3
|
{% macro onsFieldset(params) %}
|
|
4
|
+
{% set descriptionID = (params.id ~ "-" if params.id else "") ~ "legend-description" %}
|
|
4
5
|
{% set fieldset -%}
|
|
5
|
-
{% if params.dontWrap
|
|
6
|
+
{% if params.dontWrap -%}
|
|
6
7
|
<div class="ons-input-items">
|
|
7
8
|
{{- caller() if caller -}}
|
|
8
9
|
</div>
|
|
9
|
-
{%- elif
|
|
10
|
+
{%- elif params.legend or params.legendIsQuestionTitle -%}
|
|
10
11
|
<fieldset
|
|
11
|
-
{% if params.id
|
|
12
|
-
class="ons-fieldset{% if params.classes
|
|
13
|
-
{% if params.attributes
|
|
12
|
+
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
13
|
+
class="ons-fieldset{% if params.classes %} {{ params.classes }}{% endif %}"
|
|
14
|
+
{% if params.attributes %}{% for attribute, value in (params.attributes.items() if params.attributes is mapping and params.attributes.items else params.attributes) %}{{ attribute }}{% if value %}="{{ value }}"{% endif %} {% endfor %}{% endif %}
|
|
14
15
|
>
|
|
15
|
-
<legend class="ons-fieldset__legend{% if params.legendIsQuestionTitle
|
|
16
|
+
<legend{% if params.description %} aria-describedBy="{{ descriptionID }}"{% endif %} class="ons-fieldset__legend{% if params.legendIsQuestionTitle %} ons-u-mb-no{% endif %}{% if params.legendClasses %} {{ params.legendClasses }}{% endif %}{% if params.description %} ons-fieldset__legend--with-description{% endif %}">
|
|
16
17
|
{%- if params.legendIsQuestionTitle -%}
|
|
17
|
-
<h1 id="fieldset-legend-title" class="ons-fieldset__legend-title
|
|
18
|
+
<h1 id="fieldset-legend-title" class="ons-fieldset__legend-title{% if params.legendTitleClasses %} {{ params.legendTitleClasses }}{% endif %}">
|
|
18
19
|
{{- params.legend | safe -}}
|
|
19
20
|
</h1>
|
|
20
21
|
{%- else -%}
|
|
21
|
-
<span class="ons-fieldset__legend-title">{{- params.legend | safe -}}</span>
|
|
22
|
-
{%- endif -%}
|
|
23
|
-
{%- if params.description is defined and params.description -%}
|
|
24
|
-
<div class="ons-fieldset__description{% if params.legendIsQuestionTitle %} ons-fieldset__description--title ons-u-mb-m{% endif %}">
|
|
25
|
-
{{- params.description | safe -}}
|
|
26
|
-
</div>
|
|
22
|
+
<span class="ons-fieldset__legend-title ons-u-pb-no">{{- params.legend | safe -}}</span>
|
|
27
23
|
{%- endif -%}
|
|
28
24
|
</legend>
|
|
25
|
+
{%- if params.description -%}
|
|
26
|
+
<div id="{{ descriptionID }}" class="ons-fieldset__description{% if params.legendIsQuestionTitle %} ons-fieldset__description--title ons-u-mb-m{% endif %}">
|
|
27
|
+
{{- params.description | safe -}}
|
|
28
|
+
</div>
|
|
29
|
+
{%- endif -%}
|
|
29
30
|
{{- caller() if caller -}}
|
|
30
31
|
</fieldset>
|
|
31
32
|
{%- endif %}
|
|
32
33
|
{%- endset %}
|
|
33
34
|
|
|
34
|
-
{% if params.error
|
|
35
|
+
{% if params.error -%}
|
|
35
36
|
{% call onsError(params.error) %}
|
|
36
37
|
{{- fieldset | safe -}}
|
|
37
38
|
{% endcall %}
|
|
@@ -32,6 +32,13 @@ describe('macro: fieldset', () => {
|
|
|
32
32
|
expect(title).toBe('Fieldset legend');
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
it('has the correct `aria-decribedby` value', () => {
|
|
36
|
+
const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC));
|
|
37
|
+
|
|
38
|
+
const ariaDescByVal = $('.ons-fieldset__legend').attr('aria-describedby');
|
|
39
|
+
expect(ariaDescByVal).toBe('example-fieldset-legend-description');
|
|
40
|
+
});
|
|
41
|
+
|
|
35
42
|
it('has the `description` text', () => {
|
|
36
43
|
const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC));
|
|
37
44
|
|
|
@@ -41,6 +48,26 @@ describe('macro: fieldset', () => {
|
|
|
41
48
|
expect(title).toBe('A fieldset description');
|
|
42
49
|
});
|
|
43
50
|
|
|
51
|
+
it('has the correct `description` `id` when no `fieldset `id` is provided', () => {
|
|
52
|
+
const $ = cheerio.load(renderComponent('fieldset', { ...EXAMPLE_FIELDSET_BASIC, id: undefined }));
|
|
53
|
+
|
|
54
|
+
const id = $('.ons-fieldset__description').attr('id');
|
|
55
|
+
expect(id).toBe('legend-description');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('has the correct `description` `id` when `fieldset `id` is provided', () => {
|
|
59
|
+
const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC));
|
|
60
|
+
|
|
61
|
+
const id = $('.ons-fieldset__description').attr('id');
|
|
62
|
+
expect(id).toBe('example-fieldset-legend-description');
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('has the correct `legend` class when `description` is provided', () => {
|
|
66
|
+
const $ = cheerio.load(renderComponent('fieldset', EXAMPLE_FIELDSET_BASIC));
|
|
67
|
+
|
|
68
|
+
expect($('.ons-fieldset__legend').hasClass('ons-fieldset__legend--with-description')).toBe(true);
|
|
69
|
+
});
|
|
70
|
+
|
|
44
71
|
it('has additionally provided style classes', () => {
|
|
45
72
|
const $ = cheerio.load(
|
|
46
73
|
renderComponent('fieldset', {
|
|
@@ -123,11 +150,6 @@ describe('macro: fieldset', () => {
|
|
|
123
150
|
expect(results).toHaveNoViolations();
|
|
124
151
|
});
|
|
125
152
|
|
|
126
|
-
it('has the correct class', () => {
|
|
127
|
-
const $ = cheerio.load(renderComponent('fieldset', { ...EXAMPLE_FIELDSET_BASIC, legendIsQuestionTitle: true }));
|
|
128
|
-
expect($('.ons-fieldset__legend').hasClass('ons-u-mb-no')).toBe(true);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
153
|
it('renders the legend in a H1', () => {
|
|
132
154
|
const $ = cheerio.load(renderComponent('fieldset', { ...EXAMPLE_FIELDSET_BASIC, legendIsQuestionTitle: true }));
|
|
133
155
|
const titleTag = $('.ons-fieldset__legend-title')[0].tagName;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
{% from "components/lists/_macro.njk" import onsList %}
|
|
4
4
|
{% from "components/icons/_macro.njk" import onsIcon %}
|
|
5
5
|
|
|
6
|
-
{% if params.lang
|
|
6
|
+
{% if params.lang %}
|
|
7
7
|
{% set lang = params.lang %}
|
|
8
8
|
{% else %}
|
|
9
9
|
{% set lang = 'en' %}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
{% endset %}
|
|
31
31
|
|
|
32
32
|
{% set poweredByLogo %}
|
|
33
|
-
{% if params.poweredBy
|
|
33
|
+
{% if params.poweredBy and params.poweredBy.logo %}
|
|
34
34
|
{{
|
|
35
35
|
onsIcon({
|
|
36
36
|
"iconType": params.poweredBy.logo,
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
|
|
44
44
|
<footer class="ons-footer">
|
|
45
45
|
|
|
46
|
-
{% if params.footerWarning
|
|
46
|
+
{% if params.footerWarning %}
|
|
47
47
|
{% from "components/panel/_macro.njk" import onsPanel %}
|
|
48
48
|
<div class="ons-footer__warning">
|
|
49
49
|
<div class="ons-container">
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
</div>
|
|
59
59
|
{% endif %}
|
|
60
60
|
|
|
61
|
-
{% if params.button
|
|
61
|
+
{% if params.button %}
|
|
62
62
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
63
63
|
<div class="ons-footer__button-container ons-u-d-no@m">
|
|
64
64
|
{{
|
|
@@ -81,16 +81,16 @@
|
|
|
81
81
|
</div>
|
|
82
82
|
{% endif %}
|
|
83
83
|
|
|
84
|
-
<div class="ons-footer__body{{ ' ' + params.classes if params.classes else '' }}" data-analytics="footer" {% if params.attributes
|
|
85
|
-
<div class="ons-container{{ ' ons-container--wide' if params.wide }}">
|
|
84
|
+
<div class="ons-footer__body{{ ' ' + params.classes if params.classes else '' }}" data-analytics="footer" {% if params.attributes %}{% for attribute, value in (params.attributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}>
|
|
85
|
+
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
86
86
|
<div class="ons-grid">
|
|
87
|
-
{% if params.newTabWarning
|
|
87
|
+
{% if params.newTabWarning %}
|
|
88
88
|
<div class="ons-grid__col">
|
|
89
89
|
<p class="ons-u-fs-s ons-u-mb-m ons-footer__new-tab-warning">{{ params.newTabWarning | safe }}</p>
|
|
90
90
|
</div>
|
|
91
91
|
{% endif %}
|
|
92
92
|
|
|
93
|
-
{% if params.cols
|
|
93
|
+
{% if params.cols %}
|
|
94
94
|
{% for col in params.cols %}
|
|
95
95
|
<!-- Full footer columns -->
|
|
96
96
|
<div class="ons-grid__col ons-col-4@m{{ ' ons-u-mt-m@xxs@m' if loop.index > 1 }}">
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
}}
|
|
107
107
|
</div>
|
|
108
108
|
{% endfor %}
|
|
109
|
-
{% elif params.rows
|
|
109
|
+
{% elif params.rows %}
|
|
110
110
|
{% for row in params.rows %}
|
|
111
111
|
<!-- Transactional footer row -->
|
|
112
112
|
<div class="ons-grid__col">
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
{% endfor %}
|
|
122
122
|
{% endif %}
|
|
123
123
|
|
|
124
|
-
{% if (params.cols
|
|
124
|
+
{% if (params.cols) or (params.rows) %}
|
|
125
125
|
<div class="ons-grid__col ons-u-mb-m">
|
|
126
126
|
<hr class="ons-footer__hr">
|
|
127
127
|
</div>
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
|
|
132
132
|
<div class="ons-grid ons-grid--flex ons-grid--vertical-top ons-grid--between">
|
|
133
133
|
<div class="ons-grid__col">
|
|
134
|
-
{% if params.legal
|
|
134
|
+
{% if params.legal %}
|
|
135
135
|
<!-- Legal -->
|
|
136
136
|
{% for legal in params.legal %}
|
|
137
137
|
{{
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
{% endfor %}
|
|
145
145
|
{% endif %}
|
|
146
146
|
|
|
147
|
-
{% if params.OGLLink
|
|
147
|
+
{% if params.OGLLink %}
|
|
148
148
|
<!-- OGL -->
|
|
149
149
|
<div class="ons-footer__license ons-u-mb-m">
|
|
150
150
|
{{
|
|
@@ -152,9 +152,9 @@
|
|
|
152
152
|
"iconType": 'ogl'
|
|
153
153
|
})
|
|
154
154
|
}}
|
|
155
|
-
{% if params.OGLLink.HTML
|
|
155
|
+
{% if params.OGLLink.HTML %}
|
|
156
156
|
{{ params.OGLLink.HTML | safe }}
|
|
157
|
-
{% elif params.OGLLink
|
|
157
|
+
{% elif params.OGLLink %}
|
|
158
158
|
{% from "components/external-link/_macro.njk" import onsExternalLink %}
|
|
159
159
|
{% if params.lang == 'cy' %}
|
|
160
160
|
{{ params.OGLLink.pre | default('Mae’r holl gynnwys ar gael o dan y') }} {{
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
</div>
|
|
176
176
|
{% endif %}
|
|
177
177
|
|
|
178
|
-
{% if params.poweredBy
|
|
178
|
+
{% if params.poweredBy %}
|
|
179
179
|
{% if not params.poweredBy.partnership %}
|
|
180
180
|
<div class="ons-footer__poweredby ons-u-mb-m">
|
|
181
181
|
{{ poweredByLogo | safe }}
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
{% endif %}
|
|
189
189
|
</div>
|
|
190
190
|
|
|
191
|
-
{% if params.crest
|
|
191
|
+
{% if params.crest %}
|
|
192
192
|
<!-- Crest -->
|
|
193
193
|
<div class="ons-grid__col ons-footer__crest ons-u-mb-m@xxs@l">
|
|
194
194
|
{{
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
{% endif %}
|
|
201
201
|
</div>
|
|
202
202
|
|
|
203
|
-
{% if (params.poweredBy
|
|
203
|
+
{% if (params.poweredBy) and (params.poweredBy.partnership) %}
|
|
204
204
|
<div class="ons-grid ons-grid--flex ons-grid--vertical-bottom ons-grid--between ons-u-mt-l">
|
|
205
205
|
<div class="ons-grid__col ons-footer__poweredby ons-u-mb-m">
|
|
206
206
|
{{ poweredByLogo | safe }}
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
</div>
|
|
230
230
|
{% endif %}
|
|
231
231
|
|
|
232
|
-
{% if params.copyrightDeclaration
|
|
232
|
+
{% if params.copyrightDeclaration %}
|
|
233
233
|
<!-- Copyright -->
|
|
234
234
|
<div class="ons-grid">
|
|
235
235
|
<div class="ons-grid__col">
|
|
@@ -102,6 +102,24 @@ describe('macro: footer', () => {
|
|
|
102
102
|
expect(hasClass).toBe(false);
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
+
it('decorates container block with `fullWidth` modifier when the `fullWidth` parameter is provided', () => {
|
|
106
|
+
const $ = cheerio.load(
|
|
107
|
+
renderComponent('footer', {
|
|
108
|
+
fullWidth: true,
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const hasClass = $('.ons-container').hasClass('ons-container--full-width');
|
|
113
|
+
expect(hasClass).toBe(true);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('does not decorate container block with `fullWidth` modifier when the `fullWidth` parameter is not provided', () => {
|
|
117
|
+
const $ = cheerio.load(renderComponent('footer', {}));
|
|
118
|
+
|
|
119
|
+
const hasClass = $('.ons-container').hasClass('ons-container--full-width');
|
|
120
|
+
expect(hasClass).toBe(false);
|
|
121
|
+
});
|
|
122
|
+
|
|
105
123
|
it('has additionally provided `attributes` on the `body` element', () => {
|
|
106
124
|
const $ = cheerio.load(
|
|
107
125
|
renderComponent('footer', {
|
|
@@ -101,11 +101,12 @@
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
&__grid-top {
|
|
104
|
+
color: $color-text-inverse;
|
|
104
105
|
min-height: 36px;
|
|
105
106
|
a {
|
|
106
|
-
color: $color-
|
|
107
|
+
color: $color-text-inverse;
|
|
107
108
|
&:hover {
|
|
108
|
-
text-decoration: underline solid $color-
|
|
109
|
+
text-decoration: underline solid $color-text-inverse-link-hover 3px;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
}
|
|
@@ -208,6 +209,10 @@
|
|
|
208
209
|
&:first-child {
|
|
209
210
|
margin-left: 0;
|
|
210
211
|
}
|
|
212
|
+
.ons-svg-icon {
|
|
213
|
+
clip-path: circle(9px at center);
|
|
214
|
+
margin-right: 0.5rem;
|
|
215
|
+
}
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
.ons-language-links {
|