@ons/design-system 62.2.3 → 63.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/access-code/example-access-code-error.njk +1 -1
- package/components/accordion/_macro.njk +1 -1
- package/components/breadcrumbs/_macro.njk +2 -2
- package/components/breadcrumbs/_macro.spec.js +1 -1
- package/components/button/_macro.njk +1 -1
- package/components/button/_macro.spec.js +6 -6
- package/components/card/_macro.njk +1 -1
- package/components/card/_macro.spec.js +1 -1
- package/components/collapsible/_macro.spec.js +1 -1
- package/components/content-pagination/_macro.njk +2 -2
- package/components/content-pagination/_macro.spec.js +2 -2
- package/components/details/_macro.njk +1 -1
- package/components/details/_macro.spec.js +1 -1
- package/components/document-list/_macro.njk +1 -1
- package/components/footer/_macro.njk +2 -2
- package/components/footer/_macro.spec.js +7 -7
- package/components/header/_macro.njk +3 -3
- package/components/header/_macro.spec.js +5 -6
- package/components/{icons → icon}/_macro.spec.js +7 -7
- package/components/{images → image}/_macro.spec.js +13 -13
- package/components/{images/example-images-for-regular-screens.njk → image/example-image-for-regular-screens.njk} +1 -1
- package/components/{images/example-images-for-retina-screens.njk → image/example-image-for-retina-screens.njk} +1 -1
- package/components/{lists → list}/_macro.njk +3 -3
- package/components/{lists → list}/_macro.spec.js +42 -42
- package/components/message/_macro.njk +2 -2
- package/components/message/_macro.spec.js +0 -1
- package/components/metadata/_macro.njk +1 -1
- package/components/navigation/_macro.njk +3 -3
- package/components/pagination/_macro.njk +65 -69
- package/components/pagination/_macro.spec.js +18 -16
- package/components/pagination/example-pagination-first.njk +5 -5
- package/components/pagination/example-pagination-last.njk +5 -5
- package/components/pagination/example-pagination-with-no-range-indicator.njk +11 -11
- package/components/pagination/example-pagination.njk +2 -2
- package/components/panel/_macro.njk +2 -2
- package/components/panel/_macro.spec.js +2 -2
- package/components/panel/example-panel-with-error-summary.njk +1 -1
- package/components/phase-banner/_phase-banner.scss +2 -1
- package/components/question/_macro.njk +1 -1
- package/components/question/_macro.spec.js +1 -1
- package/components/quote/_macro.njk +1 -1
- package/components/quote/_macro.spec.js +1 -1
- package/components/related-content/_macro.njk +1 -1
- package/components/related-content/_macro.spec.js +1 -1
- package/components/related-content/example-related-content-general.njk +1 -1
- package/components/relationships/example-relationships-error.njk +1 -1
- package/components/section-navigation/_macro.njk +2 -2
- package/components/share-page/_macro.njk +1 -1
- package/components/share-page/_macro.spec.js +5 -5
- package/components/summary/_macro.njk +4 -4
- package/components/summary/_macro.spec.js +1 -1
- package/components/summary/example-summary-grouped-total.njk +3 -3
- package/components/table/_macro.njk +3 -3
- package/components/table/_macro.spec.js +1 -1
- package/components/table/example-table-basic.njk +1 -2
- package/components/table-of-contents/_macro.njk +1 -1
- package/components/table-of-contents/_macro.spec.js +2 -2
- package/components/tabs/_macro.njk +2 -2
- package/components/tabs/_macro.spec.js +5 -8
- package/components/tabs/example-tabs.njk +1 -0
- package/components/timeline/_macro.njk +1 -1
- package/components/timeline/_macro.spec.js +1 -1
- package/components/timeout-modal/example-timeout-modal.njk +2 -0
- package/css/main.css +3 -3
- package/css/print.css +1 -1
- package/package.json +1 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/main.scss +3 -3
- /package/components/{icons/_icons.scss → icon/_icon.scss} +0 -0
- /package/components/{icons → icon}/_macro.njk +0 -0
- /package/components/{images/_images.scss → image/_image.scss} +0 -0
- /package/components/{images → image}/_macro.njk +0 -0
- /package/components/{lists → list}/_list.scss +0 -0
|
@@ -12,7 +12,8 @@ const PAGINATION_PREV_NEXT_LABELS = {
|
|
|
12
12
|
|
|
13
13
|
const EXAMPLE_PAGINATION_MINIMAL = {
|
|
14
14
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
15
|
-
|
|
15
|
+
currentPageNumber: 1,
|
|
16
|
+
pages: [{ url: '/page/1' }],
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
describe('macro: pagination', () => {
|
|
@@ -54,7 +55,8 @@ describe('macro: pagination', () => {
|
|
|
54
55
|
const $ = cheerio.load(
|
|
55
56
|
renderComponent('pagination', {
|
|
56
57
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
57
|
-
|
|
58
|
+
currentPageNumber: 1,
|
|
59
|
+
pages: [{ url: '/page/1' }],
|
|
58
60
|
}),
|
|
59
61
|
);
|
|
60
62
|
|
|
@@ -85,7 +87,8 @@ describe('macro: pagination', () => {
|
|
|
85
87
|
const $ = cheerio.load(
|
|
86
88
|
renderComponent('pagination', {
|
|
87
89
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
88
|
-
|
|
90
|
+
currentPageNumber: 1,
|
|
91
|
+
pages: [{ url: '/page/1' }, { url: '/page/2' }],
|
|
89
92
|
}),
|
|
90
93
|
);
|
|
91
94
|
|
|
@@ -118,7 +121,8 @@ describe('macro: pagination', () => {
|
|
|
118
121
|
const $ = cheerio.load(
|
|
119
122
|
renderComponent('pagination', {
|
|
120
123
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
121
|
-
|
|
124
|
+
currentPageNumber: 2,
|
|
125
|
+
pages: [{ url: '/page/1' }, { url: '/page/2' }],
|
|
122
126
|
}),
|
|
123
127
|
);
|
|
124
128
|
|
|
@@ -151,7 +155,8 @@ describe('macro: pagination', () => {
|
|
|
151
155
|
const $ = cheerio.load(
|
|
152
156
|
renderComponent('pagination', {
|
|
153
157
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
154
|
-
|
|
158
|
+
currentPageNumber: 2,
|
|
159
|
+
pages: [{ url: '/page/1' }, { url: '/page/2' }, { url: '/page/3' }],
|
|
155
160
|
}),
|
|
156
161
|
);
|
|
157
162
|
|
|
@@ -186,7 +191,8 @@ describe('macro: pagination', () => {
|
|
|
186
191
|
const $ = cheerio.load(
|
|
187
192
|
renderComponent('pagination', {
|
|
188
193
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
189
|
-
|
|
194
|
+
currentPageNumber: 2,
|
|
195
|
+
pages: [{ url: '/page/1' }, { url: '/page/2' }, { url: '/page/3' }, { url: '/page/4' }, { url: '/page/5' }],
|
|
190
196
|
}),
|
|
191
197
|
);
|
|
192
198
|
|
|
@@ -223,14 +229,8 @@ describe('macro: pagination', () => {
|
|
|
223
229
|
const $ = cheerio.load(
|
|
224
230
|
renderComponent('pagination', {
|
|
225
231
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
{ url: '/page/2', current: true },
|
|
229
|
-
{ url: '/page/3' },
|
|
230
|
-
{ url: '/page/4' },
|
|
231
|
-
{ url: '/page/5' },
|
|
232
|
-
{ url: '/page/6' },
|
|
233
|
-
],
|
|
232
|
+
currentPageNumber: 2,
|
|
233
|
+
pages: [{ url: '/page/1' }, { url: '/page/2' }, { url: '/page/3' }, { url: '/page/4' }, { url: '/page/5' }, { url: '/page/6' }],
|
|
234
234
|
}),
|
|
235
235
|
);
|
|
236
236
|
|
|
@@ -267,12 +267,13 @@ describe('macro: pagination', () => {
|
|
|
267
267
|
const $ = cheerio.load(
|
|
268
268
|
renderComponent('pagination', {
|
|
269
269
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
270
|
+
currentPageNumber: 5,
|
|
270
271
|
pages: [
|
|
271
272
|
{ url: '/page/1' },
|
|
272
273
|
{ url: '/page/2' },
|
|
273
274
|
{ url: '/page/3' },
|
|
274
275
|
{ url: '/page/4' },
|
|
275
|
-
{ url: '/page/5'
|
|
276
|
+
{ url: '/page/5' },
|
|
276
277
|
{ url: '/page/6' },
|
|
277
278
|
{ url: '/page/7' },
|
|
278
279
|
{ url: '/page/8' },
|
|
@@ -318,6 +319,7 @@ describe('macro: pagination', () => {
|
|
|
318
319
|
const $ = cheerio.load(
|
|
319
320
|
renderComponent('pagination', {
|
|
320
321
|
...PAGINATION_PREV_NEXT_LABELS,
|
|
322
|
+
currentPageNumber: 10,
|
|
321
323
|
pages: [
|
|
322
324
|
{ url: '/page/1' },
|
|
323
325
|
{ url: '/page/2' },
|
|
@@ -328,7 +330,7 @@ describe('macro: pagination', () => {
|
|
|
328
330
|
{ url: '/page/7' },
|
|
329
331
|
{ url: '/page/8' },
|
|
330
332
|
{ url: '/page/9' },
|
|
331
|
-
{ url: '/page/10'
|
|
333
|
+
{ url: '/page/10' },
|
|
332
334
|
{ url: '/page/11' },
|
|
333
335
|
],
|
|
334
336
|
}),
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
"previous": "Previous",
|
|
6
6
|
"next": "Next",
|
|
7
7
|
"hideRangeIndicator": true,
|
|
8
|
+
"currentPageNumber": 1,
|
|
8
9
|
"pages": [
|
|
9
10
|
{
|
|
10
|
-
"url": "#
|
|
11
|
-
"current": true
|
|
11
|
+
"url": "#0"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
"url": "#
|
|
14
|
+
"url": "#0"
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
"url": "#
|
|
17
|
+
"url": "#0"
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
|
-
"url": "#
|
|
20
|
+
"url": "#0"
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
})
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
"previous": "Previous",
|
|
6
6
|
"next": "Next",
|
|
7
7
|
"hideRangeIndicator": true,
|
|
8
|
+
"currentPageNumber": 4,
|
|
8
9
|
"pages": [
|
|
9
10
|
{
|
|
10
|
-
"url": "#
|
|
11
|
+
"url": "#0"
|
|
11
12
|
},
|
|
12
13
|
{
|
|
13
|
-
"url": "#
|
|
14
|
+
"url": "#0"
|
|
14
15
|
},
|
|
15
16
|
{
|
|
16
|
-
"url": "#
|
|
17
|
+
"url": "#0"
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
|
-
"url": "#
|
|
20
|
-
"current": true
|
|
20
|
+
"url": "#0"
|
|
21
21
|
}
|
|
22
22
|
]
|
|
23
23
|
})
|
|
@@ -5,37 +5,37 @@
|
|
|
5
5
|
"previous": "Previous",
|
|
6
6
|
"next": "Next",
|
|
7
7
|
"hideRangeIndicator": true,
|
|
8
|
+
"currentPageNumber": 5,
|
|
8
9
|
"pages": [
|
|
9
10
|
{
|
|
10
|
-
"url": "#
|
|
11
|
+
"url": "#0"
|
|
11
12
|
},
|
|
12
13
|
{
|
|
13
|
-
"url": "#
|
|
14
|
+
"url": "#0"
|
|
14
15
|
},
|
|
15
16
|
{
|
|
16
|
-
"url": "#
|
|
17
|
+
"url": "#0"
|
|
17
18
|
},
|
|
18
19
|
{
|
|
19
|
-
"url": "#
|
|
20
|
+
"url": "#0"
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
|
-
"url": "#
|
|
23
|
-
"current": true
|
|
23
|
+
"url": "#0"
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
"url": "#
|
|
26
|
+
"url": "#0"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
"url": "#
|
|
29
|
+
"url": "#0"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
|
-
"url": "#
|
|
32
|
+
"url": "#0"
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
"url": "#
|
|
35
|
+
"url": "#0"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
"url": "#
|
|
38
|
+
"url": "#0"
|
|
39
39
|
}
|
|
40
40
|
]
|
|
41
41
|
})
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
{% endif %}
|
|
40
40
|
|
|
41
41
|
{% if params.type == "announcement" %}
|
|
42
|
-
{% from "components/
|
|
42
|
+
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
43
43
|
<span class="ons-panel__icon" aria-hidden="true">
|
|
44
44
|
{{
|
|
45
45
|
onsIcon({
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
{% endif %}
|
|
71
71
|
|
|
72
72
|
{% if params.iconType %}
|
|
73
|
-
{% from "components/
|
|
73
|
+
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
74
74
|
<span class= "ons-panel__icon ons-u-fs-{{ params.iconSize | default('r') }}">
|
|
75
75
|
{{
|
|
76
76
|
onsIcon({
|
|
@@ -313,7 +313,7 @@ describe('macro: panel', () => {
|
|
|
313
313
|
|
|
314
314
|
it('has `arrow-forward` icon', () => {
|
|
315
315
|
const faker = templateFaker();
|
|
316
|
-
const iconsSpy = faker.spy('
|
|
316
|
+
const iconsSpy = faker.spy('icon');
|
|
317
317
|
|
|
318
318
|
faker.renderComponent('panel', {
|
|
319
319
|
...EXAMPLE_PANEL_BASIC,
|
|
@@ -385,7 +385,7 @@ describe('macro: panel', () => {
|
|
|
385
385
|
|
|
386
386
|
it('has a custom icon `iconType`', () => {
|
|
387
387
|
const faker = templateFaker();
|
|
388
|
-
const iconsSpy = faker.spy('
|
|
388
|
+
const iconsSpy = faker.spy('icon');
|
|
389
389
|
|
|
390
390
|
faker.renderComponent('panel', {
|
|
391
391
|
...EXAMPLE_PANEL_BASIC,
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
{% if item.listLeadingLine %}
|
|
53
53
|
<p class="ons-question-guidance__list-leading-line">{{ item.listLeadingLine }}</p>
|
|
54
54
|
{% endif %}
|
|
55
|
-
{% from "components/
|
|
55
|
+
{% from "components/list/_macro.njk" import onsList %}
|
|
56
56
|
{{
|
|
57
57
|
onsList({
|
|
58
58
|
"itemsList": item.itemsList
|
|
@@ -239,7 +239,7 @@ describe('macro: question', () => {
|
|
|
239
239
|
|
|
240
240
|
it('outputs the expected list', () => {
|
|
241
241
|
const faker = templateFaker();
|
|
242
|
-
const listSpy = faker.spy('
|
|
242
|
+
const listSpy = faker.spy('list');
|
|
243
243
|
|
|
244
244
|
faker.renderComponent('question', EXAMPLE_QUESTION_GUIDANCE);
|
|
245
245
|
|
|
@@ -111,7 +111,7 @@ describe('macro: related-content', () => {
|
|
|
111
111
|
|
|
112
112
|
it('renders the expected list items using the list macro', () => {
|
|
113
113
|
const faker = templateFaker();
|
|
114
|
-
const listsSpy = faker.spy('
|
|
114
|
+
const listsSpy = faker.spy('list');
|
|
115
115
|
|
|
116
116
|
faker.renderComponent('related-content', EXAMPLE_RELATED_CONTENT_LINKS);
|
|
117
117
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% from "components/related-content/_macro.njk" import onsRelatedContent %}
|
|
2
2
|
{% from "components/related-content/_section-macro.njk" import onsRelatedContentSection %}
|
|
3
|
-
{% from "components/
|
|
3
|
+
{% from "components/list/_macro.njk" import onsList %}
|
|
4
4
|
|
|
5
5
|
{% call onsRelatedContent({
|
|
6
6
|
"ariaLabel": 'Related content'
|
|
@@ -6,7 +6,7 @@ layout: ~
|
|
|
6
6
|
{% from "components/question/_macro.njk" import onsQuestion %}
|
|
7
7
|
{% from "components/relationships/_macro.njk" import onsRelationships %}
|
|
8
8
|
{% from "components/panel/_macro.njk" import onsPanel %}
|
|
9
|
-
{% from "components/
|
|
9
|
+
{% from "components/list/_macro.njk" import onsList %}
|
|
10
10
|
|
|
11
11
|
{% set pageConfig = {
|
|
12
12
|
"header": {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
{% if section.title %}
|
|
7
7
|
<h3 class="ons-u-fs-r--b ons-u-mb-s">{{ section.title }}</h3>{% endif %}
|
|
8
8
|
<ul class="ons-section-nav__list">
|
|
9
|
-
{% for item in
|
|
9
|
+
{% for item in section.itemsList %}
|
|
10
10
|
{% if (params.currentPath and item.url == params.currentPath) or (params.tabQuery and params.tabQuery == item.title|lower) %}
|
|
11
11
|
{% set isCurrent = true %}
|
|
12
12
|
{% else %}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<h3 class="ons-u-fs-r--b ons-u-mb-s">{{ params.title }}</h3>
|
|
34
34
|
{% endif %}
|
|
35
35
|
<ul class="ons-section-nav__list">
|
|
36
|
-
{% for item in
|
|
36
|
+
{% for item in params.itemsList %}
|
|
37
37
|
{% if (params.currentPath and item.url == params.currentPath) or (params.tabQuery and params.tabQuery == item.title|lower) %}
|
|
38
38
|
{% set isCurrent = true %}
|
|
39
39
|
{% else %}
|
|
@@ -48,7 +48,7 @@ describe('macro: share-page', () => {
|
|
|
48
48
|
|
|
49
49
|
it('uses the provided icon size', () => {
|
|
50
50
|
const faker = templateFaker();
|
|
51
|
-
const listsSpy = faker.spy('
|
|
51
|
+
const listsSpy = faker.spy('list');
|
|
52
52
|
|
|
53
53
|
faker.renderComponent('share-page', {
|
|
54
54
|
...EXAMPLE_SHARE_PAGE,
|
|
@@ -61,7 +61,7 @@ describe('macro: share-page', () => {
|
|
|
61
61
|
describe('Share on Twitter', () => {
|
|
62
62
|
it('has a link with the expected url', () => {
|
|
63
63
|
const faker = templateFaker();
|
|
64
|
-
const listsSpy = faker.spy('
|
|
64
|
+
const listsSpy = faker.spy('list');
|
|
65
65
|
|
|
66
66
|
faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
|
|
67
67
|
|
|
@@ -73,7 +73,7 @@ describe('macro: share-page', () => {
|
|
|
73
73
|
|
|
74
74
|
it('has a link which opens in a new tab', () => {
|
|
75
75
|
const faker = templateFaker();
|
|
76
|
-
const listsSpy = faker.spy('
|
|
76
|
+
const listsSpy = faker.spy('list');
|
|
77
77
|
|
|
78
78
|
faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
|
|
79
79
|
|
|
@@ -87,7 +87,7 @@ describe('macro: share-page', () => {
|
|
|
87
87
|
describe('Share on Facebook', () => {
|
|
88
88
|
it('has a link with the expected url', () => {
|
|
89
89
|
const faker = templateFaker();
|
|
90
|
-
const listsSpy = faker.spy('
|
|
90
|
+
const listsSpy = faker.spy('list');
|
|
91
91
|
|
|
92
92
|
faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
|
|
93
93
|
|
|
@@ -97,7 +97,7 @@ describe('macro: share-page', () => {
|
|
|
97
97
|
|
|
98
98
|
it('has a link which opens in a new tab', () => {
|
|
99
99
|
const faker = templateFaker();
|
|
100
|
-
const listsSpy = faker.spy('
|
|
100
|
+
const listsSpy = faker.spy('list');
|
|
101
101
|
|
|
102
102
|
faker.renderComponent('share-page', EXAMPLE_SHARE_PAGE);
|
|
103
103
|
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
{% if group.rows %}
|
|
24
24
|
<div class="ons-summary__items">
|
|
25
25
|
|
|
26
|
-
{% for row in
|
|
26
|
+
{% for row in group.rows %}
|
|
27
27
|
{% set itemClass = "" %}
|
|
28
28
|
{% if row.error %} {% set itemClass = " ons-summary__item--error" %}{% endif %}
|
|
29
29
|
{% if row.total %} {% set itemClass = itemClass + " ons-summary__item--total" %}{% endif %}
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
{% if rowItem.rowTitleAttributes %}{% for attribute, value in (rowItem.rowTitleAttributes.items() if rowItem.rowTitleAttributes is mapping and rowItem.rowTitleAttributes.items else rowItem.rowTitleAttributes) %}{{attribute}}="{{value}}" {% endfor %}{% endif %}
|
|
43
43
|
>
|
|
44
44
|
{% if rowItem.iconType %}
|
|
45
|
-
{% from "components/
|
|
45
|
+
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
46
46
|
<span class="ons-summary__item-title-icon{% if rowItem.iconType == 'check' %} ons-summary__item-title-icon--check{% endif %}">
|
|
47
47
|
{{
|
|
48
48
|
onsIcon({
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
{% endif %}
|
|
76
76
|
{% else %}
|
|
77
77
|
<ul class="ons-u-mb-no">
|
|
78
|
-
{% for value in
|
|
78
|
+
{% for value in rowItem.valueList %}
|
|
79
79
|
<li>
|
|
80
80
|
<span class="ons-summary__text">{{ value.text | safe }}</span>
|
|
81
81
|
{% if value.other or value.other == 0 %}
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
{% endif %}
|
|
92
92
|
{% if rowItem.actions %}
|
|
93
93
|
<dd class="ons-summary__actions">
|
|
94
|
-
{% for action in
|
|
94
|
+
{% for action in rowItem.actions %}
|
|
95
95
|
{% if loop.index > 1 %}<span class="ons-summary__spacer"></span>{% endif %}
|
|
96
96
|
<a
|
|
97
97
|
href="{{ action.url }}"
|
|
@@ -409,7 +409,7 @@ describe('macro: summary', () => {
|
|
|
409
409
|
|
|
410
410
|
it('has a custom icon `iconType`', () => {
|
|
411
411
|
const faker = templateFaker();
|
|
412
|
-
const iconsSpy = faker.spy('
|
|
412
|
+
const iconsSpy = faker.spy('icon');
|
|
413
413
|
|
|
414
414
|
faker.renderComponent('summary', EXAMPLE_SUMMARY_BASIC);
|
|
415
415
|
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"groupTitle": "Summary - Section Title",
|
|
9
9
|
"rows": [
|
|
10
10
|
{
|
|
11
|
-
"rowTitle": "Total value of acquisitions for transport assets and equipment",
|
|
12
11
|
"rowItems": [
|
|
13
12
|
{
|
|
13
|
+
"rowTitle": "Total value of acquisitions for transport assets and equipment",
|
|
14
14
|
"valueList": [
|
|
15
15
|
{
|
|
16
16
|
"text": "£9,000.00"
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"rowTitle": "Total value of acquisitions for computers and peripheral devices (hardware)",
|
|
31
30
|
"rowItems": [
|
|
32
31
|
{
|
|
32
|
+
"rowTitle": "Total value of acquisitions for computers and peripheral devices (hardware)",
|
|
33
33
|
"valueList": [
|
|
34
34
|
{
|
|
35
35
|
"text": "£225,000.00"
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
]
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
-
"rowTitle": "Grand total for value of acquisitions",
|
|
50
49
|
"total": true,
|
|
51
50
|
"rowItems": [
|
|
52
51
|
{
|
|
52
|
+
"rowTitle": "Grand total for value of acquisitions",
|
|
53
53
|
"valueList": [
|
|
54
54
|
{
|
|
55
55
|
"text": "£234,000.00"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{% macro onsTable(params) %}
|
|
2
2
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
3
|
-
{% from "components/
|
|
3
|
+
{% from "components/icon/_macro.njk" import onsIcon %}
|
|
4
4
|
|
|
5
5
|
{% set variants = params.variants if params.variants else '' %}
|
|
6
6
|
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
</thead>
|
|
33
33
|
<tbody class="ons-table__body">
|
|
34
34
|
{% for tr in params.trs %}
|
|
35
|
-
<tr class="ons-table__row{{ " ons-table__row--highlight" if tr.highlight }}" {% if tr.
|
|
35
|
+
<tr class="ons-table__row{{ " ons-table__row--highlight" if tr.highlight }}" {% if tr.id %} id="{{ tr.id }}"{% endif %}>
|
|
36
36
|
{% for td in tr.tds %}
|
|
37
|
-
<td class="ons-table__cell{{ ' ' + td.tdClasses if td.tdClasses }}{{ " ons-table__cell--numeric" if td.numeric }}" {% if td.id %} id="{{ td.id }}"{% endif %} {% if td.
|
|
37
|
+
<td class="ons-table__cell{{ ' ' + td.tdClasses if td.tdClasses }}{{ " ons-table__cell--numeric" if td.numeric }}" {% if td.id %} id="{{ td.id }}"{% endif %} {% if td.data %} data-th="{{ td.data }}"{% endif %} {% if td.dataSort %} data-sort-value="{{ td.dataSort }}"{% endif %}>
|
|
38
38
|
{% if td.form %}
|
|
39
39
|
<form action="{{ td.form.action }}" method="{{ td.form.method | default('POST')}}">
|
|
40
40
|
{{
|
|
@@ -111,7 +111,7 @@ describe('macro: table', () => {
|
|
|
111
111
|
|
|
112
112
|
it('does not render "sort-sprite" icon', () => {
|
|
113
113
|
const faker = templateFaker();
|
|
114
|
-
const iconsSpy = faker.spy('
|
|
114
|
+
const iconsSpy = faker.spy('icon');
|
|
115
115
|
|
|
116
116
|
faker.renderComponent('table', EXAMPLE_TABLE);
|
|
117
117
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{% macro onsTableOfContents(params) %}
|
|
2
|
-
{% from "components/
|
|
2
|
+
{% from "components/list/_macro.njk" import onsList %}
|
|
3
3
|
{% from "components/skip-to-content/_macro.njk" import onsSkipToContent %}
|
|
4
4
|
|
|
5
5
|
<aside class="ons-toc-container" role="complementary">
|
|
@@ -114,7 +114,7 @@ describe('macro: table-of-contents', () => {
|
|
|
114
114
|
|
|
115
115
|
it('outputs `lists` component', () => {
|
|
116
116
|
const faker = templateFaker();
|
|
117
|
-
const listsSpy = faker.spy('
|
|
117
|
+
const listsSpy = faker.spy('list');
|
|
118
118
|
|
|
119
119
|
faker.renderComponent('table-of-contents', EXAMPLE_TABLE_OF_CONTENTS_SINGLE);
|
|
120
120
|
|
|
@@ -157,7 +157,7 @@ describe('macro: table-of-contents', () => {
|
|
|
157
157
|
|
|
158
158
|
it('outputs `lists` component for each list', () => {
|
|
159
159
|
const faker = templateFaker();
|
|
160
|
-
const listsSpy = faker.spy('
|
|
160
|
+
const listsSpy = faker.spy('list');
|
|
161
161
|
|
|
162
162
|
faker.renderComponent('table-of-contents', EXAMPLE_TABLE_OF_CONTENTS_MULTIPLE);
|
|
163
163
|
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
|
|
16
16
|
<ul class="ons-tabs__list">
|
|
17
17
|
{%- for tab in params.tabs -%}
|
|
18
|
-
<li class="ons-tab__list-item"><a href="#{{ tab.id if tab.id else '
|
|
18
|
+
<li class="ons-tab__list-item"><a href="#{{ tab.id if tab.id else tab.title|trim|replace(' ','-')|lower}}" class="ons-tab" data-ga="click" data-ga-category="tabs" data-ga-action="Show: {{ tab.title }}" data-ga-label="Show: {{ tab.title }}">{{ tab.title }}{% if tab.hiddenSpan %}<span class='ons-u-d-no'>{{tab.hiddenSpan}}</span>{% endif %}</a></li>
|
|
19
19
|
{%- endfor -%}
|
|
20
20
|
</ul>
|
|
21
21
|
|
|
22
22
|
{% for tab in params.tabs %}
|
|
23
|
-
<section id="{{ tab.id if tab.id else '
|
|
23
|
+
<section id="{{ tab.id if tab.id else tab.title|trim|replace(' ','-')|lower }}" class="ons-tabs__panel">
|
|
24
24
|
{{ tab.content | safe }}
|
|
25
25
|
</section>
|
|
26
26
|
{% endfor %}
|
|
@@ -12,6 +12,7 @@ const EXAMPLE_TABS = {
|
|
|
12
12
|
id: 'first-tab',
|
|
13
13
|
title: 'Tab 1',
|
|
14
14
|
content: 'Example content...',
|
|
15
|
+
hiddenSpan: 'for Example',
|
|
15
16
|
},
|
|
16
17
|
{
|
|
17
18
|
id: 'second-tab',
|
|
@@ -87,18 +88,14 @@ describe('macro: tabs', () => {
|
|
|
87
88
|
it('has default tab id attribute values when identifiers are not provided', () => {
|
|
88
89
|
const $ = cheerio.load(renderComponent('tabs', EXAMPLE_TABS_WITHOUT_TAB_IDS));
|
|
89
90
|
|
|
90
|
-
expect($('.ons-tabs__panel:first').attr('id')).toBe('
|
|
91
|
-
expect($('.ons-tabs__panel:last').attr('id')).toBe('
|
|
91
|
+
expect($('.ons-tabs__panel:first').attr('id')).toBe('tab-1');
|
|
92
|
+
expect($('.ons-tabs__panel:last').attr('id')).toBe('tab-2');
|
|
92
93
|
});
|
|
93
94
|
|
|
94
|
-
it('has expected label text in tab links', () => {
|
|
95
|
+
it('has expected label text in tab links and visually hidden span in tab 1', () => {
|
|
95
96
|
const $ = cheerio.load(renderComponent('tabs', EXAMPLE_TABS));
|
|
96
97
|
|
|
97
|
-
expect(
|
|
98
|
-
$('.ons-tab:first')
|
|
99
|
-
.text()
|
|
100
|
-
.trim(),
|
|
101
|
-
).toBe('Tab 1');
|
|
98
|
+
expect($('.ons-tab:first').html()).toBe('Tab 1<span class="ons-u-d-no">for Example</span>');
|
|
102
99
|
expect(
|
|
103
100
|
$('.ons-tab:last')
|
|
104
101
|
.text()
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
{
|
|
8
8
|
"id": "ukis",
|
|
9
9
|
"title": 'UKIS',
|
|
10
|
+
"hiddenSpan": 'for UKIS',
|
|
10
11
|
"content": '<h2 class="ons-u-d-no@m">UKIS</h2>
|
|
11
12
|
<h3>Aim of this survey</h3>
|
|
12
13
|
<p class="ons-u-fs-r">The aim of the UK Innovation Survey (UKIS) is to collect data from businesses about various aspects of their innovation related activities. Using this data we can measure the level, types and trends in innovation.</p>
|