@ons/design-system 72.1.1 → 72.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/button/_button.scss +1 -1
- package/components/char-check-limit/_macro.spec.js +50 -58
- package/components/description-list/_description-list.scss +40 -9
- package/components/description-list/_macro.njk +26 -12
- package/components/description-list/_macro.spec.js +15 -2
- package/components/description-list/example-inline-description-list.njk +59 -0
- package/components/header/_macro.njk +92 -90
- package/components/header/_macro.spec.js +10 -0
- package/components/header/example-header-basic.njk +11 -0
- package/components/hero/_hero.scss +282 -4
- package/components/hero/_macro.njk +56 -10
- package/components/hero/_macro.spec.js +89 -1
- package/components/hero/example-hero-grey.njk +78 -0
- package/components/hero/example-hero-navy-blue.njk +14 -0
- package/components/icon/_macro.njk +146 -0
- package/components/list/_list.scss +3 -0
- package/components/list/_macro.njk +12 -18
- package/components/list/_macro.spec.js +11 -7
- package/components/panel/_macro.njk +1 -1
- package/components/panel/_macro.spec.js +15 -1
- package/components/tabs/_tabs.scss +1 -1
- package/css/main.css +1 -1
- package/package.json +1 -1
- package/scss/vars/_colors.scss +3 -0
|
@@ -5,65 +5,57 @@ import * as cheerio from 'cheerio';
|
|
|
5
5
|
import axe from '../../tests/helpers/axe';
|
|
6
6
|
import { renderComponent } from '../../tests/helpers/rendering';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const results = await axe($.html());
|
|
37
|
-
expect(results).toHaveNoViolations();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('has the provided `id` attribute', () => {
|
|
41
|
-
const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
|
|
42
|
-
|
|
43
|
-
expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit');
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it('has the provided data attributes', () => {
|
|
47
|
-
const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
|
|
48
|
-
|
|
49
|
-
expect($('.ons-input__limit').attr('data-charcount-singular')).toBe('You have {x} character remaining');
|
|
50
|
-
expect($('.ons-input__limit').attr('data-charcount-plural')).toBe('You have {x} characters remaining');
|
|
51
|
-
expect($('.ons-input__limit').attr('data-charcount-limit-singular')).toBe('{x} character too many');
|
|
52
|
-
expect($('.ons-input__limit').attr('data-charcount-limit-plural')).toBe('{x} characters too many');
|
|
8
|
+
import { EXAMPLE_CHAR_CHECK_LIMIT } from './_test-examples';
|
|
9
|
+
|
|
10
|
+
describe('FOR: Macro: CharCheckLimit', () => {
|
|
11
|
+
describe('GIVEN: Params: Required', () => {
|
|
12
|
+
describe('WHEN: required params are provided', () => {
|
|
13
|
+
const $ = cheerio.load(renderComponent('char-check-limit', EXAMPLE_CHAR_CHECK_LIMIT));
|
|
14
|
+
|
|
15
|
+
test('THEN: passes jest-axe checks', async () => {
|
|
16
|
+
const results = await axe($.html());
|
|
17
|
+
|
|
18
|
+
expect(results).toHaveNoViolations();
|
|
19
|
+
});
|
|
20
|
+
test('THEN: has the provided id attribute', () => {
|
|
21
|
+
expect($('.ons-input__limit').attr('id')).toBe('example-char-check-limit');
|
|
22
|
+
});
|
|
23
|
+
test('THEN: has the data attribute which defines charCountPlural', () => {
|
|
24
|
+
expect($('.ons-input__limit').attr('data-charcount-plural')).toBe('You have {x} characters remaining');
|
|
25
|
+
});
|
|
26
|
+
test('THEN: has the data attribute which defines charCountSingular', () => {
|
|
27
|
+
expect($('.ons-input__limit').attr('data-charcount-singular')).toBe('You have {x} character remaining');
|
|
28
|
+
});
|
|
29
|
+
test('THEN: has the data attribute which defines charCountOverLimitSingular', () => {
|
|
30
|
+
expect($('.ons-input__limit').attr('data-charcount-limit-singular')).toBe('{x} character too many');
|
|
31
|
+
});
|
|
32
|
+
test('THEN: has the data attribute which defines charCountOverLimitPlural', () => {
|
|
33
|
+
expect($('.ons-input__limit').attr('data-charcount-limit-plural')).toBe('{x} characters too many');
|
|
34
|
+
});
|
|
35
|
+
});
|
|
53
36
|
});
|
|
54
37
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
38
|
+
describe('GIVEN: Params: variant', () => {
|
|
39
|
+
describe('WHEN: variant is provided', () => {
|
|
40
|
+
const $ = cheerio.load(
|
|
41
|
+
renderComponent(
|
|
42
|
+
'char-check-limit',
|
|
43
|
+
{
|
|
44
|
+
...EXAMPLE_CHAR_CHECK_LIMIT,
|
|
45
|
+
variant: 'check',
|
|
46
|
+
},
|
|
47
|
+
['<p>Test content.</p>'],
|
|
48
|
+
),
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
test('THEN: passes jest-axe checks with variant set to check', async () => {
|
|
52
|
+
const results = await axe($.html());
|
|
53
|
+
expect(results).toHaveNoViolations();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test('THEN: renders the passed content', () => {
|
|
57
|
+
expect($('.ons-js-char-check-input').text()).toBe('Test content.');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
68
60
|
});
|
|
69
61
|
});
|
|
@@ -7,25 +7,56 @@
|
|
|
7
7
|
clear: both;
|
|
8
8
|
float: left;
|
|
9
9
|
font-weight: $font-weight-bold;
|
|
10
|
-
|
|
11
|
-
&:not(:first-child) {
|
|
12
|
-
margin-top: 0.5rem;
|
|
13
|
-
}
|
|
14
10
|
}
|
|
15
11
|
|
|
16
12
|
&__value {
|
|
17
13
|
float: right;
|
|
18
14
|
margin-left: 0; /* As normalize adds a 40px left margin */
|
|
15
|
+
}
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
&__item {
|
|
18
|
+
&:not(:first-child) {
|
|
19
|
+
.ons-description-list__term {
|
|
22
20
|
margin-top: 0.5rem;
|
|
23
21
|
}
|
|
22
|
+
|
|
23
|
+
.ons-description-list__value:nth-of-type(1) {
|
|
24
|
+
@include mq(m) {
|
|
25
|
+
margin-top: 0.5rem;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ons-description-list--inline & {
|
|
30
|
+
.ons-description-list__value:nth-of-type(1),
|
|
31
|
+
.ons-description-list__term {
|
|
32
|
+
@include mq(l) {
|
|
33
|
+
margin-top: 0;
|
|
34
|
+
}
|
|
35
|
+
@include mq(xs, l) {
|
|
36
|
+
margin-top: 0.5rem;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&--inline {
|
|
44
|
+
.ons-description-list__term {
|
|
45
|
+
padding-right: 1rem;
|
|
24
46
|
}
|
|
25
47
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
48
|
+
@include mq(l) {
|
|
49
|
+
display: grid;
|
|
50
|
+
grid-template-columns: repeat(3, 1fr);
|
|
51
|
+
gap: 0.5rem 2.5rem;
|
|
52
|
+
|
|
53
|
+
.ons-description-list__value {
|
|
54
|
+
grid-column-start: 2;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.ons-description-list__item {
|
|
58
|
+
display: grid;
|
|
59
|
+
grid-template-columns: auto 1fr;
|
|
29
60
|
}
|
|
30
61
|
}
|
|
31
62
|
}
|
|
@@ -1,23 +1,37 @@
|
|
|
1
1
|
{% macro onsDescriptionList(params) %}
|
|
2
2
|
<dl
|
|
3
|
-
class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless ons-u-cf{{
|
|
4
|
-
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
3
|
+
class="ons-description-list ons-description-list__items ons-grid ons-grid--gutterless{{ ' ons-description-list--inline' if params.variant == 'inline' else ' ons-u-cf' }}{{ ' ' + params.classes if params.classes else '' }}"
|
|
4
|
+
{% if params.id %}id="{{ params.id }}"{% endif %}
|
|
5
|
+
{% if params.descriptionListLabel %}
|
|
5
6
|
title="{{ params.descriptionListLabel }}" aria-label="{{ params.descriptionListLabel }}"
|
|
6
7
|
{% endif %}
|
|
7
8
|
>
|
|
8
9
|
{% for item in params.itemsList %}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{% if descriptionItem.description | length %}
|
|
14
|
-
<dd
|
|
15
|
-
{% if descriptionItem.id %}id="{{ descriptionItem.id }}"{% endif %}class="ons-description-list__value ons-grid__col ons-col-{{ params.descriptionCol }}@m"
|
|
10
|
+
<div class="ons-description-list__item">
|
|
11
|
+
{% if item.term | length %}
|
|
12
|
+
<dt
|
|
13
|
+
class="ons-description-list__term ons-grid__col ons-col-{{ params.termCol }}@{{ 'xs@l' if params.variant == 'inline' else 'm' }}"
|
|
16
14
|
>
|
|
17
|
-
{{-
|
|
18
|
-
</
|
|
15
|
+
{{- item.term -}}
|
|
16
|
+
</dt>
|
|
19
17
|
{% endif %}
|
|
20
|
-
|
|
18
|
+
{% for descriptionItem in item.descriptions %}
|
|
19
|
+
{% if descriptionItem.description | length %}
|
|
20
|
+
<dd
|
|
21
|
+
{% if descriptionItem.id %}id="{{ descriptionItem.id }}"{% endif %}
|
|
22
|
+
class="ons-description-list__value ons-grid__col ons-col-{{ params.descriptionCol }}@{{ 'xs@l' if params.variant == 'inline' else 'm' }}"
|
|
23
|
+
>
|
|
24
|
+
{%- if descriptionItem.url -%}
|
|
25
|
+
<a class="ons-description-list__link" href="{{ descriptionItem.url }}">
|
|
26
|
+
{{- descriptionItem.description -}}
|
|
27
|
+
</a>
|
|
28
|
+
{%- else -%}
|
|
29
|
+
{{- descriptionItem.description -}}
|
|
30
|
+
{%- endif -%}
|
|
31
|
+
</dd>
|
|
32
|
+
{% endif %}
|
|
33
|
+
{% endfor %}
|
|
34
|
+
</div>
|
|
21
35
|
{% endfor %}
|
|
22
36
|
</dl>
|
|
23
37
|
{% endmacro %}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @jest-environment jsdom */
|
|
2
2
|
|
|
3
3
|
import * as cheerio from 'cheerio';
|
|
4
|
-
|
|
5
4
|
import axe from '../../tests/helpers/axe';
|
|
6
5
|
import { renderComponent } from '../../tests/helpers/rendering';
|
|
7
6
|
|
|
@@ -31,6 +30,7 @@ const EXAMPLE_DESCRIPTION_LIST_FULL = {
|
|
|
31
30
|
{
|
|
32
31
|
id: 'description-3',
|
|
33
32
|
description: '49300005832',
|
|
33
|
+
url: '#',
|
|
34
34
|
},
|
|
35
35
|
],
|
|
36
36
|
},
|
|
@@ -87,6 +87,17 @@ describe('macro: description-list', () => {
|
|
|
87
87
|
expect($('#example-id').length).toBe(1);
|
|
88
88
|
});
|
|
89
89
|
|
|
90
|
+
it('has the provided variant style class when variant is provided', () => {
|
|
91
|
+
const $ = cheerio.load(
|
|
92
|
+
renderComponent('description-list', {
|
|
93
|
+
...EXAMPLE_DESCRIPTION_LIST_MINIMAL,
|
|
94
|
+
variant: 'inline',
|
|
95
|
+
}),
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
expect($('.ons-description-list').hasClass('ons-description-list--inline')).toBe(true);
|
|
99
|
+
});
|
|
100
|
+
|
|
90
101
|
it('has additionally provided style classes', () => {
|
|
91
102
|
const $ = cheerio.load(
|
|
92
103
|
renderComponent('description-list', {
|
|
@@ -132,7 +143,9 @@ describe('macro: description-list', () => {
|
|
|
132
143
|
|
|
133
144
|
expect($listElements[4].tagName).toBe('dd');
|
|
134
145
|
expect($($listElements[4]).attr('id')).toBe('description-3');
|
|
135
|
-
|
|
146
|
+
const $link = $($listElements[4]).find('a');
|
|
147
|
+
expect($link.attr('href')).toBe('#');
|
|
148
|
+
expect($link.text()).toBe('49300005832');
|
|
136
149
|
});
|
|
137
150
|
|
|
138
151
|
it.each([
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{% from "components/description-list/_macro.njk" import onsDescriptionList %}
|
|
2
|
+
{{
|
|
3
|
+
onsDescriptionList({
|
|
4
|
+
"classes": "ons-u-mb-no",
|
|
5
|
+
"descriptionListLabel": "Information about this business and its survey requirements",
|
|
6
|
+
"variant": 'inline',
|
|
7
|
+
"termCol": "4",
|
|
8
|
+
"descriptionCol": "8",
|
|
9
|
+
"itemsList": [
|
|
10
|
+
{
|
|
11
|
+
"term": "Survey:",
|
|
12
|
+
"descriptions": [
|
|
13
|
+
{
|
|
14
|
+
"description": "Bricks & Blocks"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"term": "RU Refs:",
|
|
20
|
+
"descriptions": [
|
|
21
|
+
{
|
|
22
|
+
"description": "49900000118"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"description": "49300005832"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"term": "Business:",
|
|
31
|
+
"descriptions": [
|
|
32
|
+
{
|
|
33
|
+
"description": "Bolts & Ratchets Ltd."
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"term": "Trading as:",
|
|
39
|
+
"descriptions": [
|
|
40
|
+
{
|
|
41
|
+
"description": "Bolts & Ratchets"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"term": "To:",
|
|
47
|
+
"descriptions": [
|
|
48
|
+
{
|
|
49
|
+
"description": "Jacky Turner"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"description": "Louise Goodland",
|
|
53
|
+
'url': '#'
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
})
|
|
59
|
+
}}
|
|
@@ -218,118 +218,120 @@
|
|
|
218
218
|
</nav>
|
|
219
219
|
{% endif %}
|
|
220
220
|
</div>
|
|
221
|
-
|
|
222
|
-
<div class="ons-
|
|
223
|
-
<div
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
221
|
+
{% if params.variants != "basic" %}
|
|
222
|
+
<div class="ons-header__main">
|
|
223
|
+
<div class="ons-container{{ ' ons-container--full-width' if params.fullWidth }}{{ ' ons-container--wide' if params.wide }}">
|
|
224
|
+
<div
|
|
225
|
+
class="ons-grid ons-grid-flex ons-grid-flex--between ons-grid-flex--vertical-center ons-grid-flex--no-wrap{{ ' ons-grid--gutterless' if not params.button }}"
|
|
226
|
+
>
|
|
227
|
+
<div class="ons-grid__col ons-col-auto ons-u-flex-shrink">
|
|
228
|
+
{% if params.titleLogo.large %}
|
|
228
229
|
|
|
229
|
-
|
|
230
|
-
<div
|
|
231
|
-
class="ons-header__title-logo ons-header__title-logo--large{{ ' ' + params.titleLogo.classes if params.titleLogo.classes else '' }}{{ ' ons-u-d-no@2xs@s' if params.titleLogo.small }}"
|
|
232
|
-
>
|
|
233
|
-
{{ params.titleLogo.large | safe }}
|
|
234
|
-
</div>
|
|
235
|
-
{% if params.titleLogo.small %}
|
|
230
|
+
{% set title %}
|
|
236
231
|
<div
|
|
237
|
-
class="ons-header__title-logo ons-header__title-logo--
|
|
232
|
+
class="ons-header__title-logo ons-header__title-logo--large{{ ' ' + params.titleLogo.classes if params.titleLogo.classes else '' }}{{ ' ons-u-d-no@2xs@s' if params.titleLogo.small }}"
|
|
238
233
|
>
|
|
239
|
-
{{ params.titleLogo.
|
|
234
|
+
{{ params.titleLogo.large | safe }}
|
|
240
235
|
</div>
|
|
241
|
-
|
|
242
|
-
|
|
236
|
+
{% if params.titleLogo.small %}
|
|
237
|
+
<div
|
|
238
|
+
class="ons-header__title-logo ons-header__title-logo--small ons-u-d-no@s{{ ' ' + params.titleLogo.classes if params.titleLogo.classes else '' }}"
|
|
239
|
+
>
|
|
240
|
+
{{ params.titleLogo.small | safe }}
|
|
241
|
+
</div>
|
|
242
|
+
{% endif %}
|
|
243
|
+
{% endset %}
|
|
243
244
|
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
{% if params.titleUrl %}
|
|
246
|
+
<a class="ons-header__title-logo-link" href="{{ params.titleUrl }}">{{ title | safe }}</a>
|
|
247
|
+
{% else %}
|
|
248
|
+
{{ title | safe }}
|
|
249
|
+
{% endif %}
|
|
246
250
|
{% else %}
|
|
247
|
-
{{ title | safe }}
|
|
248
|
-
{% endif %}
|
|
249
|
-
{% else %}
|
|
250
251
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
{% set title %}
|
|
253
|
+
{{ openingTag | safe }}
|
|
254
|
+
class="ons-header__title">{{ params.title }}{{ closingTag | safe }}
|
|
255
|
+
{% endset %}
|
|
255
256
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
{% if params.titleUrl %}
|
|
258
|
+
<a class="ons-header__title-link" href="{{ params.titleUrl }}">{{ title | safe }}</a>
|
|
259
|
+
{% else %}
|
|
260
|
+
{{ title | safe }}
|
|
261
|
+
{% endif %}
|
|
260
262
|
{% endif %}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
</div>
|
|
263
|
+
{% if params.description %}
|
|
264
|
+
<p class="ons-header__description">{{ params.description }}</p>
|
|
265
|
+
{% endif %}
|
|
266
|
+
</div>
|
|
266
267
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
{% if params.button %}
|
|
269
|
+
{% if params.variants == 'neutral' %}
|
|
270
|
+
{% set buttonVariant = "ghost-dark" %}
|
|
271
|
+
{% else %}
|
|
272
|
+
{% set buttonVariant = "ghost" %}
|
|
273
|
+
{% endif %}
|
|
274
|
+
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
|
|
275
|
+
{{
|
|
276
|
+
onsButton({
|
|
277
|
+
"text": params.button.text,
|
|
278
|
+
"classes": "ons-u-d-no@2xs@l" if params.navigation else "ons-u-d-no@2xs@m",
|
|
279
|
+
"variants": buttonVariant,
|
|
280
|
+
"name": params.button.name,
|
|
281
|
+
"attributes": params.button.attributes,
|
|
282
|
+
"url": params.button.url,
|
|
283
|
+
"iconType": "exit",
|
|
284
|
+
"iconPosition": "after"
|
|
285
|
+
})
|
|
286
|
+
}}
|
|
287
|
+
</div>
|
|
272
288
|
{% endif %}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
"
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
289
|
+
{% if params.navigation or params.siteSearchAutosuggest %}
|
|
290
|
+
<div class="ons-grid__col ons-col-auto ons-u-flex-no-shrink">
|
|
291
|
+
{% if params.siteSearchAutosuggest %}
|
|
292
|
+
{% if params.variants == 'neutral' %}
|
|
293
|
+
{% set buttonVariant = ["small", "ghost-dark"] %}
|
|
294
|
+
{% else %}
|
|
295
|
+
{% set buttonVariant = ["small", "ghost"] %}
|
|
296
|
+
{% endif %}
|
|
297
|
+
<span class="ons-grid ons-u-d-no@2xs@xs ons-u-ml-no ons-u-d-no@l">
|
|
298
|
+
{{
|
|
299
|
+
onsButton({
|
|
300
|
+
"text": "Search",
|
|
301
|
+
"classes": "ons-btn--search ons-u-ml-2xs ons-u-d-no ons-js-toggle-search",
|
|
302
|
+
"variants": buttonVariant,
|
|
303
|
+
"iconType": "search",
|
|
304
|
+
"iconPosition": "only",
|
|
305
|
+
"attributes": {
|
|
306
|
+
"aria-label": "Toggle search" ,
|
|
307
|
+
"aria-controls": "ons-site-search",
|
|
308
|
+
"aria-expanded": "false"
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
}}
|
|
312
|
+
</span>
|
|
295
313
|
{% endif %}
|
|
296
|
-
|
|
314
|
+
{% if params.navigation.toggleNavigationButton %}
|
|
315
|
+
{% set buttonVariant = ["mobile", "ghost"] %}
|
|
297
316
|
{{
|
|
298
317
|
onsButton({
|
|
299
|
-
"text":
|
|
300
|
-
"classes": "ons-
|
|
318
|
+
"text": params.navigation.toggleNavigationButton.text,
|
|
319
|
+
"classes": "ons-u-ml-2xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l",
|
|
301
320
|
"variants": buttonVariant,
|
|
302
|
-
"iconType": "search",
|
|
303
|
-
"iconPosition": "only",
|
|
304
321
|
"attributes": {
|
|
305
|
-
"aria-label": "Toggle
|
|
306
|
-
"aria-controls":
|
|
322
|
+
"aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
|
|
323
|
+
"aria-controls": params.navigation.id,
|
|
307
324
|
"aria-expanded": "false"
|
|
308
325
|
}
|
|
309
326
|
})
|
|
310
327
|
}}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
{{
|
|
316
|
-
onsButton({
|
|
317
|
-
"text": params.navigation.toggleNavigationButton.text,
|
|
318
|
-
"classes": "ons-u-ml-2xs ons-u-d-no ons-js-navigation-button ons-u-d-no@l",
|
|
319
|
-
"variants": buttonVariant,
|
|
320
|
-
"attributes": {
|
|
321
|
-
"aria-label": params.navigation.toggleNavigationButton.ariaLabel | default("Toggle main menu") ,
|
|
322
|
-
"aria-controls": params.navigation.id,
|
|
323
|
-
"aria-expanded": "false"
|
|
324
|
-
}
|
|
325
|
-
})
|
|
326
|
-
}}
|
|
327
|
-
{% endif %}
|
|
328
|
-
</div>
|
|
329
|
-
{% endif %}
|
|
328
|
+
{% endif %}
|
|
329
|
+
</div>
|
|
330
|
+
{% endif %}
|
|
331
|
+
</div>
|
|
330
332
|
</div>
|
|
331
333
|
</div>
|
|
332
|
-
|
|
334
|
+
{% endif %}
|
|
333
335
|
{% if params.navigation %}
|
|
334
336
|
{{ onsNavigation(params) }}
|
|
335
337
|
{% endif %}
|
|
@@ -43,6 +43,16 @@ describe('FOR: Macro: Header', () => {
|
|
|
43
43
|
expect($('.ons-header--variant-b').length).toBe(1);
|
|
44
44
|
});
|
|
45
45
|
});
|
|
46
|
+
describe('WHEN: variants is set to basic', () => {
|
|
47
|
+
test('THEN: does not render the main part of the header', () => {
|
|
48
|
+
const $ = cheerio.load(
|
|
49
|
+
renderComponent('header', {
|
|
50
|
+
variants: 'basic',
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
53
|
+
expect($('.ons-header > .ons-header__main').length).toBe(0);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
46
56
|
});
|
|
47
57
|
describe('GIVEN: Params: classes', () => {
|
|
48
58
|
describe('WHEN: classes are provided', () => {
|