@ons/design-system 68.0.0 → 68.0.2
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 +6 -0
- package/components/access-code/_macro.njk +1 -1
- package/components/access-code/_macro.spec.js +2 -10
- package/components/access-code/access-code.dom.js +1 -1
- package/components/access-code/access-code.spec.js +2 -2
- package/components/access-code/example-access-code-error.njk +9 -14
- package/components/access-code/example-access-code.njk +3 -5
- package/components/accordion/accordion.js +4 -4
- package/components/address-input/_macro.spec.js +3 -15
- package/components/address-input/autosuggest.address.dom.js +1 -1
- package/components/address-input/autosuggest.address.js +3 -2
- package/components/address-input/autosuggest.address.setter.js +3 -3
- package/components/address-input/autosuggest.address.spec.js +66 -69
- package/components/address-output/_macro.spec.js +6 -30
- package/components/autosuggest/_autosuggest.scss +1 -1
- package/components/autosuggest/autosuggest.dom.js +1 -1
- package/components/autosuggest/autosuggest.helpers.js +1 -1
- package/components/back-to-top/_back-to-top.scss +34 -0
- package/components/back-to-top/_macro.njk +17 -0
- package/components/back-to-top/_macro.spec.js +60 -0
- package/components/back-to-top/back-to-top.dom.js +12 -0
- package/components/back-to-top/back-to-top.js +58 -0
- package/components/back-to-top/back-to-top.spec.js +117 -0
- package/components/back-to-top/example-back-to-top.njk +37 -0
- package/components/back-to-top/example-full-page-back-to-top.njk +192 -0
- package/components/browser-banner/_macro.spec.js +4 -12
- package/components/button/_macro.njk +6 -6
- package/components/button/_macro.spec.js +1 -5
- package/components/button/button.js +7 -8
- package/components/button/button.spec.js +17 -39
- package/components/call-to-action/_macro.spec.js +2 -6
- package/components/card/_macro.njk +25 -25
- package/components/card/_macro.spec.js +10 -34
- package/components/char-check-limit/_macro.njk +1 -1
- package/components/char-check-limit/_macro.spec.js +3 -7
- package/components/char-check-limit/character-check.spec.js +24 -20
- package/components/checkboxes/_checkbox-macro.njk +1 -1
- package/components/checkboxes/_checkbox.scss +0 -3
- package/components/checkboxes/_macro.spec.js +1 -5
- package/components/checkboxes/checkbox-with-autoselect.js +3 -3
- package/components/checkboxes/checkbox-with-fieldset.js +2 -2
- package/components/checkboxes/checkboxes-with-reveal.js +4 -2
- package/components/checkboxes/checkboxes.dom.js +2 -2
- package/components/checkboxes/checkboxes.spec.js +13 -13
- package/components/content-pagination/_macro.spec.js +2 -2
- package/components/cookies-banner/cookies-banner.dom.js +1 -1
- package/components/cookies-banner/cookies-banner.js +1 -1
- package/components/cookies-banner/cookies-banner.spec.js +7 -7
- package/components/date-input/_macro.njk +71 -69
- package/components/date-input/_macro.spec.js +20 -5
- package/components/date-input/example-date-input-double-field.njk +27 -0
- package/components/date-input/example-date-input-single-field.njk +18 -0
- package/components/details/details.spec.js +12 -12
- package/components/details/example-details-with-warning.njk +5 -7
- package/components/document-list/_macro.spec.js +9 -27
- package/components/document-list/document-list.scss +1 -1
- package/components/document-list/example-document-list-downloads.njk +3 -3
- package/components/document-list/example-document-list-search-result-featured.njk +1 -1
- package/components/document-list/example-document-list-search-results.njk +3 -3
- package/components/download-resources/download-resources.js +54 -54
- package/components/download-resources/download-resources.spec.js +3 -1
- package/components/duration/_macro.njk +52 -48
- package/components/duration/_macro.spec.js +112 -4
- package/components/duration/example-duration-error-for-single-field.njk +1 -1
- package/components/duration/example-duration-single-field.njk +24 -0
- package/components/error/_macro.njk +1 -1
- package/components/error/_macro.spec.js +2 -6
- package/components/feedback/_macro.njk +1 -1
- package/components/feedback/_macro.spec.js +4 -20
- package/components/field/_field-group.scss +3 -4
- package/components/field/_macro.spec.js +1 -3
- package/components/fieldset/_fieldset.scss +1 -2
- package/components/fieldset/_macro.spec.js +3 -9
- package/components/footer/_footer.scss +8 -0
- package/components/footer/_macro.njk +8 -7
- package/components/footer/_macro.spec.js +14 -2
- package/components/header/_macro.njk +1 -1
- package/components/header/_macro.spec.js +1 -1
- package/components/helpers/grid.njk +15 -15
- package/components/icon/_macro.njk +17 -13
- package/components/icon/_macro.spec.js +8 -16
- package/components/image/_macro.spec.js +1 -5
- package/components/input/_macro.njk +22 -23
- package/components/input/_macro.spec.js +1 -1
- package/components/input/character-check.dom.js +1 -1
- package/components/input/input.spec.js +1 -4
- package/components/label/_label.scss +1 -0
- package/components/label/_macro.njk +3 -3
- package/components/label/_macro.spec.js +4 -13
- package/components/list/_macro.spec.js +4 -12
- package/components/message/_macro.njk +17 -17
- package/components/message/_macro.spec.js +9 -33
- package/components/message-list/_macro.spec.js +7 -39
- package/components/metadata/_macro.njk +10 -10
- package/components/modal/_macro.spec.js +3 -9
- package/components/modal/modal.dom.js +1 -1
- package/components/modal/modal.spec.js +5 -5
- package/components/multiple-input-fields/_macro.njk +49 -0
- package/components/mutually-exclusive/_macro.spec.js +2 -10
- package/components/mutually-exclusive/mutually-exclusive.checkboxes.spec.js +26 -26
- package/components/mutually-exclusive/mutually-exclusive.date.spec.js +128 -14
- package/components/mutually-exclusive/mutually-exclusive.dom.js +1 -1
- package/components/mutually-exclusive/mutually-exclusive.duration.spec.js +129 -8
- package/components/mutually-exclusive/mutually-exclusive.email.spec.js +7 -7
- package/components/mutually-exclusive/mutually-exclusive.js +13 -13
- package/components/mutually-exclusive/mutually-exclusive.multiple-options.checkboxes.spec.js +29 -29
- package/components/mutually-exclusive/mutually-exclusive.number.spec.js +7 -7
- package/components/mutually-exclusive/mutually-exclusive.textarea.spec.js +8 -8
- package/components/navigation/navigation.spec.js +0 -2
- package/components/pagination/_macro.spec.js +11 -53
- package/components/panel/_macro.njk +17 -17
- package/components/panel/_macro.spec.js +25 -25
- package/components/panel/_panel.scss +10 -9
- package/components/panel/example-panel-bare.njk +3 -4
- package/components/panel/example-panel-with-announcement.njk +6 -10
- package/components/panel/example-panel-with-error-summary.njk +2 -2
- package/components/panel/example-panel-with-information.njk +0 -1
- package/components/panel/example-panel-with-success-message.njk +1 -1
- package/components/panel/example-panel-with-warning.njk +2 -3
- package/components/password/password.dom.js +1 -1
- package/components/phase-banner/_macro.spec.js +3 -9
- package/components/question/_macro.njk +1 -1
- package/components/question/_macro.spec.js +5 -19
- package/components/question/_question.scss +1 -4
- package/components/question/example-question-interviewer-note.njk +1 -1
- package/components/quote/_macro.spec.js +2 -10
- package/components/radios/clear-radios.js +3 -3
- package/components/radios/radio-with-fieldset.js +4 -4
- package/components/radios/radios.dom.js +1 -1
- package/components/radios/radios.spec.js +26 -26
- package/components/related-content/_macro.spec.js +2 -4
- package/components/related-content/_section-macro.spec.js +2 -8
- package/components/relationships/example-relationships-error.njk +16 -18
- package/components/relationships/relationships.dom.js +1 -1
- package/components/relationships/relationships.js +2 -2
- package/components/reply/_macro.spec.js +3 -3
- package/components/reply/reply.dom.js +1 -1
- package/components/reply/reply.spec.js +3 -3
- package/components/section-navigation/_macro.njk +12 -12
- package/components/section-navigation/_macro.spec.js +13 -21
- package/components/select/_macro.spec.js +6 -6
- package/components/share-page/_macro.spec.js +6 -14
- package/components/skip-to-content/_macro.spec.js +3 -11
- package/components/skip-to-content/skip-to-content.dom.js +1 -1
- package/components/skip-to-content/skip-to-content.js +1 -1
- package/components/skip-to-content/skip-to-content.spec.js +2 -2
- package/components/status/_macro.njk +2 -2
- package/components/status/_macro.spec.js +5 -9
- package/components/status/example-status-dead.njk +1 -1
- package/components/status/example-status-error.njk +1 -1
- package/components/status/example-status-pending.njk +1 -1
- package/components/status/example-status-small.njk +1 -1
- package/components/status/example-status-success.njk +2 -2
- package/components/summary/_macro.njk +7 -8
- package/components/summary/_macro.spec.js +27 -9
- package/components/table/_macro.spec.js +6 -10
- package/components/table/scrollable-table.dom.js +1 -1
- package/components/table/scrollable-table.js +1 -1
- package/components/table/sortable-table.js +4 -4
- package/components/table/table.spec.js +21 -17
- package/components/table-of-contents/_macro.njk +31 -31
- package/components/table-of-contents/_macro.spec.js +3 -11
- package/components/table-of-contents/toc.dom.js +1 -1
- package/components/table-of-contents/toc.spec.js +36 -32
- package/components/tabs/example-tabs-details.njk +1 -1
- package/components/tabs/tabs.dom.js +1 -1
- package/components/tabs/tabs.js +8 -8
- package/components/text-indent/_macro.spec.js +2 -6
- package/components/textarea/textarea.dom.js +1 -1
- package/components/textarea/textarea.spec.js +8 -8
- package/components/timeout-modal/_macro.spec.js +1 -3
- package/components/timeout-modal/timeout-modal.dom.js +1 -1
- package/components/timeout-modal/timeout-modal.spec.js +10 -10
- package/components/timeout-panel/_macro.njk +16 -17
- package/components/timeout-panel/_macro.spec.js +1 -1
- package/components/timeout-panel/timeout-panel.dom.js +1 -1
- package/components/timeout-panel/timeout-panel.spec.js +8 -8
- package/components/video/_macro.spec.js +1 -5
- package/components/video/video.dom.js +1 -1
- package/components/video/video.spec.js +16 -12
- package/css/main.css +1 -1
- package/favicons/safari-pinned-tab.svg +23 -23
- package/js/analytics.js +12 -15
- package/js/cookies-settings.dom.js +1 -1
- package/js/cookies-settings.spec.js +19 -19
- package/js/domready.js +1 -1
- package/js/fetch.js +1 -1
- package/js/inpagelink.js +3 -3
- package/js/main.js +1 -0
- package/js/print-button.js +1 -1
- package/js/timeout.js +1 -1
- package/package.json +2 -1
- package/scripts/main.es5.js +1 -1
- package/scripts/main.js +1 -1
- package/scss/base/_typography.scss +8 -2
- package/scss/main.scss +1 -0
- package/scss/overrides/hcm.scss +8 -1
- package/scss/vars/_colors.scss +2 -1
- package/components/date-field-input/_macro.njk +0 -86
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Example: Long Page"
|
|
3
|
+
layout: ~
|
|
4
|
+
---
|
|
5
|
+
{% extends "layout/_template.njk" %}
|
|
6
|
+
{% from "components/list/_macro.njk" import onsList %}
|
|
7
|
+
{% from "components/back-to-top/_macro.njk" import onsBackToTop %}
|
|
8
|
+
{% from "components/related-content/_macro.njk" import onsRelatedContent %}
|
|
9
|
+
{% from "components/content-pagination/_macro.njk" import onsContentPagination %}
|
|
10
|
+
|
|
11
|
+
{% set pageConfig = {
|
|
12
|
+
"header": {
|
|
13
|
+
"title": 'Service name'
|
|
14
|
+
},
|
|
15
|
+
"breadcrumbs": {
|
|
16
|
+
"ariaLabel": 'Breadcrumbs',
|
|
17
|
+
"itemsList": [
|
|
18
|
+
{
|
|
19
|
+
"url": '#0',
|
|
20
|
+
"text": 'Home'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"url": '#0',
|
|
24
|
+
"text": 'News'
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"footer": {}
|
|
29
|
+
} %}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
{% block main %}
|
|
34
|
+
|
|
35
|
+
<h1 class="ons-u-fs-xxl">
|
|
36
|
+
<span class="ons-u-fs-m ons-u-db ons-u-mb-xs ons-u-lighter">Press releases</span>
|
|
37
|
+
<span class="ons-u-vh">: </span>
|
|
38
|
+
<span class="ons-u-fs-xxl ons-u-db">ONS launches Integrated Data Service to boost government collaboration on data sharing</span>
|
|
39
|
+
</h1>
|
|
40
|
+
|
|
41
|
+
<div class="ons-grid ons-grid--column@xs@s">
|
|
42
|
+
|
|
43
|
+
<div class="ons-grid__col ons-col-7@m">
|
|
44
|
+
|
|
45
|
+
<div class="ons-page__body ons-u-mt-m">
|
|
46
|
+
|
|
47
|
+
<p>In a groundbreaking move, the Office for National Statistics (ONS) has embarked on a transformative journey with the introduction of the Integrated Data Service (IDS). This sophisticated, cloud-based platform is meticulously crafted to empower analysts and researchers, providing them with unprecedented access to a diverse array of data sources. The overarching goal of the IDS is nothing short of unlocking the boundless potential inherent in data, thereby contributing significantly to evidence-based policymaking while fostering a culture of collaboration across various government departments.</p>
|
|
48
|
+
|
|
49
|
+
<p>The inaugural phase of the IDS has now been unveiled through the exclusive introduction of a private beta version. This exclusive access is extended to a carefully curated group of government analysts, offering them a unique opportunity to delve into the intricacies of comparing and combining data held not only by the ONS but also by other government departments. The emphasis here is on fostering a collaborative ecosystem that transcends traditional boundaries, a move poised to play a pivotal role in maximizing the utility of data for the collective benefit of the government's policy formulation and decision-making processes.</p>
|
|
50
|
+
|
|
51
|
+
<p>Launching next spring, a public beta will open the door for accredited researchers outside of government to use the new service.</p>
|
|
52
|
+
|
|
53
|
+
<p>The three projects selected for the private beta and will focus on some of the government’s top priorities:</p>
|
|
54
|
+
|
|
55
|
+
{{
|
|
56
|
+
onsList({
|
|
57
|
+
"itemsList": [
|
|
58
|
+
{
|
|
59
|
+
"text": '<p>wage growth - an ONS and HM Treasury collaboration will investigate in detail how wages change across the country, helping inform the government’s “Levelling Up” policy agenda</p>'
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"text": '<p>energy efficiency - working with the Valuation Office Agency to provide better information on the energy efficiency of homes around the country as part of wider work to help measure the UK’s progress towards reaching net zero by 2050</p>'
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"text": '<p>regional issues - a collaboration with Department for Business, Energy, and Industrial Strategy to analyse how text from local news sources across the UK can be used to understand concerns of communities around the country</p>'
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
}}
|
|
70
|
+
|
|
71
|
+
<p>DCMS Minister for State Julia Lopez said: "The Integrated Data Service is a crucial part of our National Data Strategy and will make it easier and quicker for policy makers to access robust evidence for making the decisions that can improve the lives of people across the country.</p>
|
|
72
|
+
|
|
73
|
+
<p>"Unlocking the power of data will boost the economy, create jobs and help us build back better from the pandemic.” </p><p>Joanna Davinson, Executive Director at the Central Digital and Data Office, said: “The Integrated Data Service will provide the public sector with secure access to high-quality data for better research and analysis.</p>
|
|
74
|
+
|
|
75
|
+
<p>“This is aligned to our vision of having increased availability of data for decision-makers to ensure more data driven policies. In this way, we can enable transformation of the Government’s use of data and support the delivery of efficient public services for users.”</p>
|
|
76
|
+
|
|
77
|
+
<p>Alison Pritchard, Deputy National Statistician for Data Capability, said: "The Service demonstrates how data held, managed and accessed in a trusted and secure environment can benefit us all by providing essential insight on social and economic factors. I am particularly looking forward to engaging widely to explain how we are protecting the data appropriately and making sure it is put to use for the public good."</p>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div class="ons-u-mt-l ons-u-mt-xl@m">
|
|
82
|
+
{{
|
|
83
|
+
onsContentPagination({
|
|
84
|
+
"ariaLabel": 'Article pagination',
|
|
85
|
+
"contentPaginationItems": [
|
|
86
|
+
{
|
|
87
|
+
"rel": 'prev',
|
|
88
|
+
"text": 'Previous',
|
|
89
|
+
"url": '#0',
|
|
90
|
+
"label": 'Office for National Statistics win top Royal Statistical Society award'
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"rel": 'next',
|
|
94
|
+
"text": 'Next',
|
|
95
|
+
"url": '#0',
|
|
96
|
+
"label": 'Five Office for National Statistics names in New Year’s Honours'
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
}}
|
|
101
|
+
|
|
102
|
+
{{ onsBackToTop() }}
|
|
103
|
+
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<div class="ons-grid__col ons-col-4@m ons-push-1@m">
|
|
111
|
+
|
|
112
|
+
{% call onsRelatedContent({
|
|
113
|
+
"ariaLabel": 'Related content',
|
|
114
|
+
"rows": [
|
|
115
|
+
{
|
|
116
|
+
"id": 'published-date',
|
|
117
|
+
"title": 'Published on',
|
|
118
|
+
"itemsList": [
|
|
119
|
+
{
|
|
120
|
+
"text": '<time datetime="2021-08-01">1 August 2021</time>'
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"id": 'published-in',
|
|
126
|
+
"title": 'Published in',
|
|
127
|
+
"classes": 'ons-u-mb-no',
|
|
128
|
+
"variants": 'bare',
|
|
129
|
+
"itemsList": [
|
|
130
|
+
{
|
|
131
|
+
"text": 'Press releases',
|
|
132
|
+
"url": '#0'
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"id": 'tags',
|
|
138
|
+
"title": 'Tags',
|
|
139
|
+
"itemsList": [
|
|
140
|
+
{
|
|
141
|
+
"text": 'Integrated data',
|
|
142
|
+
"url": '#0'
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"text": 'Census 2021',
|
|
146
|
+
"url": '#0'
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"text": 'Survey',
|
|
150
|
+
"url": '#0'
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"id": 'share-this-article',
|
|
156
|
+
"title": 'Share this article',
|
|
157
|
+
"variants": 'social',
|
|
158
|
+
"iconPosition": 'before',
|
|
159
|
+
"iconSize": 'xxl',
|
|
160
|
+
"itemsList": [
|
|
161
|
+
{
|
|
162
|
+
"url": '#0',
|
|
163
|
+
"text": 'Facebook',
|
|
164
|
+
"iconType": 'facebook',
|
|
165
|
+
"rel": 'noreferrer external'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"url": '#0',
|
|
169
|
+
"text": 'Twitter',
|
|
170
|
+
"iconType": 'twitter',
|
|
171
|
+
"rel": 'noreferrer external'
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
}) %}
|
|
177
|
+
|
|
178
|
+
{% endcall %}
|
|
179
|
+
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
{% endblock %}
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
@@ -18,18 +18,14 @@ describe('macro: browser-banner', () => {
|
|
|
18
18
|
it('has the default `bannerLeadingText`', () => {
|
|
19
19
|
const $ = cheerio.load(renderComponent('browser-banner', EXAMPLE_BROWSER_BANNER_DEFAULT));
|
|
20
20
|
|
|
21
|
-
const bannerLeadingText = $('.ons-browser-banner__lead')
|
|
22
|
-
.text()
|
|
23
|
-
.trim();
|
|
21
|
+
const bannerLeadingText = $('.ons-browser-banner__lead').text().trim();
|
|
24
22
|
expect(bannerLeadingText).toBe('This website no longer supports your browser.');
|
|
25
23
|
});
|
|
26
24
|
|
|
27
25
|
it('has the default `bannerCTA`', () => {
|
|
28
26
|
const $ = cheerio.load(renderComponent('browser-banner', EXAMPLE_BROWSER_BANNER_DEFAULT));
|
|
29
27
|
|
|
30
|
-
const bannerCtaHtml = $('.ons-browser-banner__cta')
|
|
31
|
-
.text()
|
|
32
|
-
.trim();
|
|
28
|
+
const bannerCtaHtml = $('.ons-browser-banner__cta').text().trim();
|
|
33
29
|
expect(bannerCtaHtml).toBe('You can upgrade your browser to the latest version.');
|
|
34
30
|
});
|
|
35
31
|
|
|
@@ -91,18 +87,14 @@ describe('mode: Welsh language', () => {
|
|
|
91
87
|
}),
|
|
92
88
|
);
|
|
93
89
|
|
|
94
|
-
const bannerLeadingText = $('.ons-browser-banner__lead')
|
|
95
|
-
.text()
|
|
96
|
-
.trim();
|
|
90
|
+
const bannerLeadingText = $('.ons-browser-banner__lead').text().trim();
|
|
97
91
|
expect(bannerLeadingText).toBe('Nid yw’r wefan hon yn cefnogi eich porwr mwyach.');
|
|
98
92
|
});
|
|
99
93
|
|
|
100
94
|
it('has the welsh version of default `bannerCTA`', () => {
|
|
101
95
|
const $ = cheerio.load(renderComponent('browser-banner', { lang: 'cy' }));
|
|
102
96
|
|
|
103
|
-
const bannerCtaHtml = $('.ons-browser-banner__cta')
|
|
104
|
-
.text()
|
|
105
|
-
.trim();
|
|
97
|
+
const bannerCtaHtml = $('.ons-browser-banner__cta').text().trim();
|
|
106
98
|
expect(bannerCtaHtml).toBe('Gallwch ddiweddaru eich porwr i’r fersiwn ddiweddaraf.');
|
|
107
99
|
});
|
|
108
100
|
|
|
@@ -93,12 +93,12 @@
|
|
|
93
93
|
{% endif -%}
|
|
94
94
|
<span class="ons-btn__text">{{- params.html | safe if params.html else params.text -}}</span>
|
|
95
95
|
{%- if iconPosition == "after" %}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
{{-
|
|
97
|
+
onsIcon({
|
|
98
|
+
"iconType": iconType,
|
|
99
|
+
"classes": 'ons-u-ml-xs'
|
|
100
|
+
})
|
|
101
|
+
-}}
|
|
102
102
|
{% endif -%}
|
|
103
103
|
{% elif iconPosition == "only" -%}
|
|
104
104
|
{{-
|
|
@@ -212,11 +212,7 @@ describe('macro: button', () => {
|
|
|
212
212
|
}),
|
|
213
213
|
);
|
|
214
214
|
|
|
215
|
-
expect(
|
|
216
|
-
$('.ons-btn__text + .ons-icon')
|
|
217
|
-
.prev()
|
|
218
|
-
.text(),
|
|
219
|
-
).toBe('Click me!');
|
|
215
|
+
expect($('.ons-btn__text + .ons-icon').prev().text()).toBe('Click me!');
|
|
220
216
|
});
|
|
221
217
|
|
|
222
218
|
describe('mode: standard', () => {
|
|
@@ -40,7 +40,7 @@ export default class SubmitButton {
|
|
|
40
40
|
timerButtonEl.setAttribute('disabled', true);
|
|
41
41
|
}
|
|
42
42
|
setTimeout(
|
|
43
|
-
timerButtonEl => {
|
|
43
|
+
(timerButtonEl) => {
|
|
44
44
|
timerButtonEl.removeAttribute('disabled');
|
|
45
45
|
i = 0;
|
|
46
46
|
},
|
|
@@ -49,18 +49,17 @@ export default class SubmitButton {
|
|
|
49
49
|
);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
linkButtonDown(e){
|
|
53
|
-
if (e.keyCode == 32 || e.keyCode == 13){
|
|
54
|
-
this.button.classList.add(
|
|
52
|
+
linkButtonDown(e) {
|
|
53
|
+
if (e.keyCode == 32 || e.keyCode == 13) {
|
|
54
|
+
this.button.classList.add('active');
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
linkButtonUp(e){
|
|
57
|
+
|
|
58
|
+
linkButtonUp(e) {
|
|
59
59
|
if (e.keyCode == 32 || e.keyCode == 13) {
|
|
60
|
-
this.button.classList.remove(
|
|
60
|
+
this.button.classList.remove('active');
|
|
61
61
|
e.preventDefault();
|
|
62
62
|
this.button.click();
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
|
|
66
65
|
}
|
|
@@ -26,16 +26,14 @@ describe('script: button', () => {
|
|
|
26
26
|
'/test',
|
|
27
27
|
`
|
|
28
28
|
<form>
|
|
29
|
-
${renderComponent('button', {
|
|
30
|
-
id: 'test-button',
|
|
31
|
-
})}
|
|
29
|
+
${renderComponent('button', { id: 'test-button' })}
|
|
32
30
|
</form>
|
|
33
|
-
|
|
31
|
+
`,
|
|
34
32
|
);
|
|
35
33
|
|
|
36
34
|
await page.evaluate(() => {
|
|
37
35
|
window.__COUNTER = 0;
|
|
38
|
-
document.querySelector('form').addEventListener('submit', event => {
|
|
36
|
+
document.querySelector('form').addEventListener('submit', (event) => {
|
|
39
37
|
window.__COUNTER++;
|
|
40
38
|
event.preventDefault();
|
|
41
39
|
});
|
|
@@ -101,13 +99,9 @@ describe('script: button', () => {
|
|
|
101
99
|
'/test',
|
|
102
100
|
`
|
|
103
101
|
<form onsubmit="return false;">
|
|
104
|
-
${renderComponent('button', {
|
|
105
|
-
id: 'test-button',
|
|
106
|
-
text: 'Submit',
|
|
107
|
-
variants: 'loader',
|
|
108
|
-
})}
|
|
102
|
+
${renderComponent('button', { id: 'test-button', text: 'Submit', variants: 'loader' })}
|
|
109
103
|
</form>
|
|
110
|
-
|
|
104
|
+
`,
|
|
111
105
|
);
|
|
112
106
|
|
|
113
107
|
await page.click('#test-button');
|
|
@@ -121,13 +115,9 @@ describe('script: button', () => {
|
|
|
121
115
|
'/test',
|
|
122
116
|
`
|
|
123
117
|
<form>
|
|
124
|
-
${renderComponent('button', {
|
|
125
|
-
id: 'test-button',
|
|
126
|
-
text: 'Submit',
|
|
127
|
-
variants: 'loader',
|
|
128
|
-
})}
|
|
118
|
+
${renderComponent('button', { id: 'test-button', text: 'Submit', variants: 'loader' })}
|
|
129
119
|
</form>
|
|
130
|
-
|
|
120
|
+
`,
|
|
131
121
|
);
|
|
132
122
|
|
|
133
123
|
const hasIsLoadingClass = await page.evaluate(() => document.querySelector('#test-button').classList.contains('ons-is-loading'));
|
|
@@ -139,13 +129,9 @@ describe('script: button', () => {
|
|
|
139
129
|
'/test',
|
|
140
130
|
`
|
|
141
131
|
<form onsubmit="return false;">
|
|
142
|
-
${renderComponent('button', {
|
|
143
|
-
id: 'test-button',
|
|
144
|
-
text: 'Submit',
|
|
145
|
-
variants: 'loader',
|
|
146
|
-
})}
|
|
132
|
+
${renderComponent('button', { id: 'test-button', text: 'Submit', variants: 'loader' })}
|
|
147
133
|
</form>
|
|
148
|
-
|
|
134
|
+
`,
|
|
149
135
|
);
|
|
150
136
|
|
|
151
137
|
await page.click('#test-button');
|
|
@@ -168,7 +154,7 @@ describe('script: button', () => {
|
|
|
168
154
|
|
|
169
155
|
await page.evaluate(() => {
|
|
170
156
|
window.__COUNTER = 0;
|
|
171
|
-
document.querySelector('#test-button').addEventListener('click', event => {
|
|
157
|
+
document.querySelector('#test-button').addEventListener('click', (event) => {
|
|
172
158
|
window.__COUNTER++;
|
|
173
159
|
event.preventDefault();
|
|
174
160
|
});
|
|
@@ -193,7 +179,7 @@ describe('script: button', () => {
|
|
|
193
179
|
|
|
194
180
|
await page.evaluate(() => {
|
|
195
181
|
window.__COUNTER = 0;
|
|
196
|
-
document.querySelector('#test-button').addEventListener('click', event => {
|
|
182
|
+
document.querySelector('#test-button').addEventListener('click', (event) => {
|
|
197
183
|
window.__COUNTER++;
|
|
198
184
|
event.preventDefault();
|
|
199
185
|
});
|
|
@@ -211,18 +197,14 @@ describe('script: button', () => {
|
|
|
211
197
|
'/test',
|
|
212
198
|
`
|
|
213
199
|
<form>
|
|
214
|
-
${renderComponent('button', {
|
|
215
|
-
id: 'test-button',
|
|
216
|
-
variants: 'timer',
|
|
217
|
-
text: 'Submit',
|
|
218
|
-
})}
|
|
200
|
+
${renderComponent('button', { id: 'test-button', variants: 'timer', text: 'Submit' })}
|
|
219
201
|
</form>
|
|
220
|
-
|
|
202
|
+
`,
|
|
221
203
|
);
|
|
222
204
|
|
|
223
205
|
await page.evaluate(() => {
|
|
224
206
|
window.__COUNTER = 0;
|
|
225
|
-
document.querySelector('form').addEventListener('submit', event => {
|
|
207
|
+
document.querySelector('form').addEventListener('submit', (event) => {
|
|
226
208
|
window.__COUNTER++;
|
|
227
209
|
event.preventDefault();
|
|
228
210
|
});
|
|
@@ -240,18 +222,14 @@ describe('script: button', () => {
|
|
|
240
222
|
'/test',
|
|
241
223
|
`
|
|
242
224
|
<form>
|
|
243
|
-
${renderComponent('button', {
|
|
244
|
-
id: 'test-button',
|
|
245
|
-
variants: 'timer',
|
|
246
|
-
text: 'Submit',
|
|
247
|
-
})}
|
|
225
|
+
${renderComponent('button', { id: 'test-button', variants: 'timer', text: 'Submit' })}
|
|
248
226
|
</form>
|
|
249
|
-
|
|
227
|
+
`,
|
|
250
228
|
);
|
|
251
229
|
|
|
252
230
|
await page.evaluate(() => {
|
|
253
231
|
window.__COUNTER = 0;
|
|
254
|
-
document.querySelector('form').addEventListener('submit', event => {
|
|
232
|
+
document.querySelector('form').addEventListener('submit', (event) => {
|
|
255
233
|
window.__COUNTER++;
|
|
256
234
|
event.preventDefault();
|
|
257
235
|
});
|
|
@@ -25,18 +25,14 @@ describe('macro: call-to-action', () => {
|
|
|
25
25
|
it('has the provided `headingText`', () => {
|
|
26
26
|
const $ = cheerio.load(renderComponent('call-to-action', EXAMPLE_CALL_TO_ACTION));
|
|
27
27
|
|
|
28
|
-
const headingText = $('.ons-call-to-action__heading')
|
|
29
|
-
.text()
|
|
30
|
-
.trim();
|
|
28
|
+
const headingText = $('.ons-call-to-action__heading').text().trim();
|
|
31
29
|
expect(headingText).toBe('Call to action heading.');
|
|
32
30
|
});
|
|
33
31
|
|
|
34
32
|
it('has the provided `paragraphText`', () => {
|
|
35
33
|
const $ = cheerio.load(renderComponent('call-to-action', EXAMPLE_CALL_TO_ACTION));
|
|
36
34
|
|
|
37
|
-
const paragraphText = $('.ons-call-to-action__text')
|
|
38
|
-
.text()
|
|
39
|
-
.trim();
|
|
35
|
+
const paragraphText = $('.ons-call-to-action__text').text().trim();
|
|
40
36
|
expect(paragraphText).toBe('Descriptive text about call to action');
|
|
41
37
|
});
|
|
42
38
|
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{%- macro onsCard(params) -%}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
{% set headingLevel = params.headingLevel | default(2) %}
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<div class="ons-card">
|
|
6
|
+
<a href="{{ params.url }}" class="ons-card__link">
|
|
7
|
+
{%- if params.image -%}
|
|
8
|
+
{% if params.image.smallSrc %}
|
|
9
|
+
<img class="ons-card__image ons-u-mb-s" height="200" width="303"{% if params.image.largeSrc %} srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %} src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}" loading="lazy">
|
|
10
|
+
{% elif params.image == true or params.image.placeholderURL %}
|
|
11
|
+
<img class="ons-card__image ons-u-mb-s " height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png 1x, {{ params.image.placeholderURL if params.image.placeholderURL }}/img/large/placeholder-card.png 2x" src="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png" alt="" loading="lazy">
|
|
12
|
+
{% endif %}
|
|
13
|
+
{%- endif -%}
|
|
14
|
+
<h{{ headingLevel }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m')}}" id="{{ params.id }}">
|
|
15
|
+
{{ params.title }}
|
|
16
|
+
</h{{ headingLevel }}>
|
|
17
|
+
</a>
|
|
6
18
|
|
|
7
|
-
|
|
8
|
-
<a href="{{ params.url }}" class="ons-card__link">
|
|
9
|
-
{%- if params.image -%}
|
|
10
|
-
{% if params.image.smallSrc %}
|
|
11
|
-
<img class="ons-card__image ons-u-mb-s" height="200" width="303"{% if params.image.largeSrc %} srcset="{{ params.image.smallSrc }} 1x, {{ params.image.largeSrc }} 2x"{% endif %} src="{{ params.image.smallSrc }}" alt="{{ params.image.alt }}" loading="lazy">
|
|
12
|
-
{% elif params.image == true or params.image.placeholderURL %}
|
|
13
|
-
<img class="ons-card__image ons-u-mb-s " height="100" width="303" srcset="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png 1x, {{ params.image.placeholderURL if params.image.placeholderURL }}/img/large/placeholder-card.png 2x" src="{{ params.image.placeholderURL if params.image.placeholderURL }}/img/small/placeholder-card.png" alt="" loading="lazy">
|
|
14
|
-
{% endif %}
|
|
15
|
-
{%- endif -%}
|
|
16
|
-
<h{{ titleSize }} class="ons-card__title {{ params.titleClasses | default('ons-u-fs-m')}}" id="{{ params.id }}">
|
|
17
|
-
{{ params.title }}
|
|
18
|
-
</h{{ titleSize }}>
|
|
19
|
-
</a>
|
|
19
|
+
<p id="{{ params.textId }}">{{ params.text }}</p>
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
{% if params.itemsList -%}
|
|
22
|
+
{% from "components/list/_macro.njk" import onsList %}
|
|
23
|
+
{{
|
|
24
|
+
onsList({
|
|
25
|
+
"variants": 'dashed',
|
|
26
|
+
"itemsList": params.itemsList
|
|
27
|
+
})
|
|
28
|
+
}}
|
|
29
|
+
{% endif %}
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
{{
|
|
25
|
-
onsList({
|
|
26
|
-
"variants": 'dashed',
|
|
27
|
-
"itemsList": params.itemsList
|
|
28
|
-
})
|
|
29
|
-
}}
|
|
30
|
-
{% endif %}
|
|
31
|
+
</div>
|
|
31
32
|
|
|
32
|
-
</div>
|
|
33
33
|
{%- endmacro -%}
|
|
@@ -50,39 +50,27 @@ describe('macro: card', () => {
|
|
|
50
50
|
it('has the provided `title` text', () => {
|
|
51
51
|
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));
|
|
52
52
|
|
|
53
|
-
expect(
|
|
54
|
-
$('.ons-card__title')
|
|
55
|
-
.text()
|
|
56
|
-
.trim(),
|
|
57
|
-
).toBe('Example card title');
|
|
53
|
+
expect($('.ons-card__title').text().trim()).toBe('Example card title');
|
|
58
54
|
});
|
|
59
55
|
|
|
60
56
|
it.each([
|
|
61
57
|
[1, 'h1'],
|
|
62
58
|
[4, 'h4'],
|
|
63
|
-
])('has the correct element type for the provided `
|
|
59
|
+
])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
|
|
64
60
|
const $ = cheerio.load(
|
|
65
61
|
renderComponent('card', {
|
|
66
62
|
...EXAMPLE_CARD_WITHOUT_IMAGE,
|
|
67
|
-
|
|
63
|
+
headingLevel,
|
|
68
64
|
}),
|
|
69
65
|
);
|
|
70
66
|
|
|
71
|
-
expect(
|
|
72
|
-
$(`${expectedTitleTag}.ons-card__title`)
|
|
73
|
-
.text()
|
|
74
|
-
.trim(),
|
|
75
|
-
).toBe('Example card title');
|
|
67
|
+
expect($(`${expectedTitleTag}.ons-card__title`).text().trim()).toBe('Example card title');
|
|
76
68
|
});
|
|
77
69
|
|
|
78
70
|
it('has the provided `text` accessible via the `textId` identifier', () => {
|
|
79
71
|
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITHOUT_IMAGE));
|
|
80
72
|
|
|
81
|
-
expect(
|
|
82
|
-
$('#example-text-id')
|
|
83
|
-
.text()
|
|
84
|
-
.trim(),
|
|
85
|
-
).toBe('Example card text.');
|
|
73
|
+
expect($('#example-text-id').text().trim()).toBe('Example card text.');
|
|
86
74
|
});
|
|
87
75
|
|
|
88
76
|
it('renders the provided `itemsList` using the `list` component', () => {
|
|
@@ -123,29 +111,21 @@ describe('macro: card', () => {
|
|
|
123
111
|
it('has the provided `title` text', () => {
|
|
124
112
|
const $ = cheerio.load(renderComponent('card', EXAMPLE_CARD_WITH_IMAGE));
|
|
125
113
|
|
|
126
|
-
expect(
|
|
127
|
-
$('.ons-card__title')
|
|
128
|
-
.text()
|
|
129
|
-
.trim(),
|
|
130
|
-
).toBe('Example card title');
|
|
114
|
+
expect($('.ons-card__title').text().trim()).toBe('Example card title');
|
|
131
115
|
});
|
|
132
116
|
|
|
133
117
|
it.each([
|
|
134
118
|
[1, 'h1'],
|
|
135
119
|
[4, 'h4'],
|
|
136
|
-
])('has the correct element type for the provided `
|
|
120
|
+
])('has the correct element type for the provided `headingLevel` (%i -> %s)', (headingLevel, expectedTitleTag) => {
|
|
137
121
|
const $ = cheerio.load(
|
|
138
122
|
renderComponent('card', {
|
|
139
123
|
...EXAMPLE_CARD_WITH_IMAGE,
|
|
140
|
-
|
|
124
|
+
headingLevel,
|
|
141
125
|
}),
|
|
142
126
|
);
|
|
143
127
|
|
|
144
|
-
expect(
|
|
145
|
-
$(`${expectedTitleTag}.ons-card__title`)
|
|
146
|
-
.text()
|
|
147
|
-
.trim(),
|
|
148
|
-
).toBe('Example card title');
|
|
128
|
+
expect($(`${expectedTitleTag}.ons-card__title`).text().trim()).toBe('Example card title');
|
|
149
129
|
});
|
|
150
130
|
|
|
151
131
|
it('has the provided `text`', () => {
|
|
@@ -155,11 +135,7 @@ describe('macro: card', () => {
|
|
|
155
135
|
}),
|
|
156
136
|
);
|
|
157
137
|
|
|
158
|
-
expect(
|
|
159
|
-
$('#example-text-id')
|
|
160
|
-
.text()
|
|
161
|
-
.trim(),
|
|
162
|
-
).toBe('Example card text.');
|
|
138
|
+
expect($('#example-text-id').text().trim()).toBe('Example card text.');
|
|
163
139
|
});
|
|
164
140
|
|
|
165
141
|
it('outputs a hyperlink with the provided `url`', () => {
|
|
@@ -27,7 +27,7 @@ describe('macro: char-check-limit', () => {
|
|
|
27
27
|
'char-check-limit',
|
|
28
28
|
{
|
|
29
29
|
...EXAMPLE_CHAR_CHECK_LIMIT,
|
|
30
|
-
|
|
30
|
+
variant: 'check',
|
|
31
31
|
},
|
|
32
32
|
['<p>Test content.</p>'],
|
|
33
33
|
),
|
|
@@ -58,16 +58,12 @@ describe('macro: char-check-limit', () => {
|
|
|
58
58
|
'char-check-limit',
|
|
59
59
|
{
|
|
60
60
|
...EXAMPLE_CHAR_CHECK_LIMIT,
|
|
61
|
-
|
|
61
|
+
variant: 'check',
|
|
62
62
|
},
|
|
63
63
|
['<p>Test content.</p>'],
|
|
64
64
|
),
|
|
65
65
|
);
|
|
66
66
|
|
|
67
|
-
expect(
|
|
68
|
-
$('.ons-js-char-check-input')
|
|
69
|
-
.html()
|
|
70
|
-
.trim(),
|
|
71
|
-
).toBe('<p>Test content.</p>');
|
|
67
|
+
expect($('.ons-js-char-check-input').html().trim()).toBe('<p>Test content.</p>');
|
|
72
68
|
});
|
|
73
69
|
});
|