hof 19.14.8 → 20.0.0-beta.10
Sign up to get free protection for your applications and to get access to all the features.
- package/.nyc_output/e2fdc3eb-4fd2-47e0-a392-fe5f665776a4.json +1 -0
- package/.nyc_output/processinfo/e2fdc3eb-4fd2-47e0-a392-fe5f665776a4.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.vscode/settings.json +6 -0
- package/components/date/index.js +3 -1
- package/components/date/templates/date.html +15 -12
- package/controller/controller.js +39 -0
- package/frontend/govuk-template/build/config.js +2 -2
- package/frontend/govuk-template/build/govuk_template.html +104 -0
- package/frontend/govuk-template/build/index.js +2 -2
- package/frontend/govuk-template/govuk_template_generated.html +104 -0
- package/frontend/govuk-template/index.js +4 -4
- package/frontend/template-mixins/mixins/template-mixins.js +20 -9
- package/frontend/template-mixins/partials/forms/checkbox-group.html +38 -0
- package/frontend/template-mixins/partials/forms/checkbox.html +4 -4
- package/frontend/template-mixins/partials/forms/input-submit.html +1 -1
- package/frontend/template-mixins/partials/forms/input-text-date.html +37 -0
- package/frontend/template-mixins/partials/forms/input-text-group.html +12 -9
- package/frontend/template-mixins/partials/forms/option-group.html +33 -26
- package/frontend/template-mixins/partials/forms/select.html +10 -5
- package/frontend/template-mixins/partials/forms/textarea-group.html +15 -6
- package/frontend/template-mixins/partials/mixins/panel.html +3 -4
- package/frontend/template-partials/views/accessibility.html +4 -4
- package/frontend/template-partials/views/cookies.html +1 -1
- package/frontend/template-partials/views/layout.html +22 -22
- package/frontend/template-partials/views/partials/back.html +1 -1
- package/frontend/template-partials/views/partials/bullet-list.html +1 -1
- package/frontend/template-partials/views/partials/confirmation-alert.html +4 -3
- package/frontend/template-partials/views/partials/continue.html +1 -1
- package/frontend/template-partials/views/partials/cookie-banner.html +27 -24
- package/frontend/template-partials/views/partials/cookie-settings-radio.html +6 -6
- package/frontend/template-partials/views/partials/external-link.html +1 -1
- package/frontend/template-partials/views/partials/form.html +1 -1
- package/frontend/template-partials/views/partials/maincontent-left.html +4 -4
- package/frontend/template-partials/views/partials/navigation.html +7 -6
- package/frontend/template-partials/views/partials/session-cookies-table.html +6 -6
- package/frontend/template-partials/views/partials/table.html +7 -7
- package/frontend/template-partials/views/partials/validation-list.html +2 -2
- package/frontend/template-partials/views/partials/validation-summary.html +14 -13
- package/frontend/template-partials/views/session-timeout.html +1 -1
- package/frontend/themes/gov-uk/client-js/cookieSettings.js +1 -1
- package/frontend/themes/gov-uk/client-js/govuk-cookies.js +121 -0
- package/frontend/themes/gov-uk/client-js/index.js +6 -1
- package/frontend/themes/gov-uk/client-js/skip-to-main.js +19 -0
- package/frontend/themes/gov-uk/styles/_cookie-banner.scss +51 -1
- package/frontend/themes/gov-uk/styles/modules/_validation.scss +3 -3
- package/frontend/toolkit/assets/javascript/character-count.js +4 -4
- package/frontend/toolkit/assets/javascript/form-focus.js +10 -1
- package/frontend/toolkit/assets/javascript/validation.js +6 -1
- package/frontend/toolkit/assets/stylesheets/modules/_validation.scss +3 -3
- package/index.js +5 -0
- package/lib/settings.js +18 -2
- package/middleware/rate-limiter.js +1 -0
- package/package.json +3 -2
- package/sandbox/.env +1 -0
- package/sandbox/apps/sandbox/fields.js +23 -11
- package/sandbox/apps/sandbox/translations/en/default.json +203 -0
- package/sandbox/apps/sandbox/translations/src/en/fields.json +9 -6
- package/sandbox/apps/sandbox/translations/src/en/journey.json +4 -1
- package/sandbox/apps/sandbox/translations/src/en/pages.json +2 -29
- package/sandbox/apps/sandbox/translations/src/en/validation.json +1 -1
- package/sandbox/assets/js/index.js +1 -1
- package/sandbox/assets/scss/app.scss +17 -16
- package/sandbox/package.json +4 -1
- package/sandbox/public/css/app.css +9389 -0
- package/sandbox/public/images/icons/icon-caret-left.png +0 -0
- package/sandbox/public/images/icons/icon-complete.png +0 -0
- package/sandbox/public/images/icons/icon-cross-remove-sign.png +0 -0
- package/sandbox/public/js/bundle.js +35658 -0
- package/sandbox/yarn.lock +767 -0
- package/frontend/govuk-template/govuk_template.html +0 -109
- package/frontend/themes/gov-uk/views/partials/form.html +0 -9
- package/frontend/themes/gov-uk/views/partials/forms/option-group.html +0 -28
- package/frontend/themes/gov-uk/views/partials/mixins/panel.html +0 -3
- package/frontend/themes/gov-uk/views/partials/validation-summary.html +0 -24
- package/sandbox/apps/sandbox/views/confirmation.html +0 -15
@@ -0,0 +1,121 @@
|
|
1
|
+
/* eslint-disable no-undef, no-param-reassign, no-unused-vars */
|
2
|
+
(function () {
|
3
|
+
'use strict';
|
4
|
+
const root = this;
|
5
|
+
if(typeof root.GOVUK === 'undefined') { root.GOVUK = {}; }
|
6
|
+
|
7
|
+
/*
|
8
|
+
Cookie methods
|
9
|
+
==============
|
10
|
+
|
11
|
+
Usage:
|
12
|
+
|
13
|
+
Setting a cookie:
|
14
|
+
GOVUK.cookie('hobnob', 'tasty', { days: 30 });
|
15
|
+
|
16
|
+
Reading a cookie:
|
17
|
+
GOVUK.cookie('hobnob');
|
18
|
+
|
19
|
+
Deleting a cookie:
|
20
|
+
GOVUK.cookie('hobnob', null);
|
21
|
+
*/
|
22
|
+
GOVUK.cookie = function (name, value, options) {
|
23
|
+
if(typeof value !== 'undefined') {
|
24
|
+
if(value === false || value === null) {
|
25
|
+
return GOVUK.setCookie(name, '', { days: -1 });
|
26
|
+
}
|
27
|
+
return GOVUK.setCookie(name, value, options);
|
28
|
+
}
|
29
|
+
return GOVUK.getCookie(name);
|
30
|
+
};
|
31
|
+
GOVUK.setCookie = function (name, value, options) {
|
32
|
+
if(typeof options === 'undefined') {
|
33
|
+
options = {};
|
34
|
+
}
|
35
|
+
let cookieString = name + '=' + value + '; path=/';
|
36
|
+
if (options.days) {
|
37
|
+
const date = new Date();
|
38
|
+
date.setTime(date.getTime() + (options.days * 24 * 60 * 60 * 1000));
|
39
|
+
cookieString = cookieString + '; expires=' + date.toGMTString();
|
40
|
+
}
|
41
|
+
if (document.location.protocol === 'https:') {
|
42
|
+
cookieString = cookieString + '; Secure';
|
43
|
+
}
|
44
|
+
document.cookie = cookieString;
|
45
|
+
};
|
46
|
+
GOVUK.getCookie = function (name) {
|
47
|
+
const nameEQ = name + '=';
|
48
|
+
const cookies = document.cookie.split(';');
|
49
|
+
for(let i = 0, len = cookies.length; i < len; i++) {
|
50
|
+
let cookie = cookies[i];
|
51
|
+
while (cookie.charAt(0) === ' ') {
|
52
|
+
cookie = cookie.substring(1, cookie.length);
|
53
|
+
}
|
54
|
+
if (cookie.indexOf(nameEQ) === 0) {
|
55
|
+
return decodeURIComponent(cookie.substring(nameEQ.length));
|
56
|
+
}
|
57
|
+
}
|
58
|
+
return null;
|
59
|
+
};
|
60
|
+
}).call(this);
|
61
|
+
(function () {
|
62
|
+
'use strict';
|
63
|
+
const root = this;
|
64
|
+
if (typeof root.GOVUK === 'undefined') { root.GOVUK = {}; }
|
65
|
+
|
66
|
+
GOVUK.addCookieMessage = function () {
|
67
|
+
const message = document.getElementById('global-cookie-message');
|
68
|
+
|
69
|
+
const hasCookieMessage = (message && GOVUK.cookie('seen_cookie_message') === null);
|
70
|
+
|
71
|
+
if (hasCookieMessage) {
|
72
|
+
message.style.display = 'block';
|
73
|
+
GOVUK.cookie('seen_cookie_message', 'yes', { days: 28 });
|
74
|
+
|
75
|
+
document.addEventListener('DOMContentLoaded', function (event) {
|
76
|
+
if (GOVUK.analytics && typeof GOVUK.analytics.trackEvent === 'function') {
|
77
|
+
GOVUK.analytics.trackEvent('cookieBanner', 'Cookie banner shown', {
|
78
|
+
value: 1,
|
79
|
+
nonInteraction: true
|
80
|
+
});
|
81
|
+
}
|
82
|
+
});
|
83
|
+
}
|
84
|
+
};
|
85
|
+
}).call(this)
|
86
|
+
;
|
87
|
+
(function () {
|
88
|
+
'use strict';
|
89
|
+
|
90
|
+
// add cookie message
|
91
|
+
if (window.GOVUK && GOVUK.addCookieMessage) {
|
92
|
+
GOVUK.addCookieMessage();
|
93
|
+
}
|
94
|
+
|
95
|
+
// header navigation toggle
|
96
|
+
if (document.querySelectorAll && document.addEventListener) {
|
97
|
+
const els = document.querySelectorAll('.js-header-toggle');
|
98
|
+
let i; let _i;
|
99
|
+
for(i = 0, _i = els.length; i < _i; i++) {
|
100
|
+
els[i].addEventListener('click', function (e) {
|
101
|
+
e.preventDefault();
|
102
|
+
const target = document.getElementById(this.getAttribute('href').substr(1));
|
103
|
+
const targetClass = target.getAttribute('class') || '';
|
104
|
+
const sourceClass = this.getAttribute('class') || '';
|
105
|
+
|
106
|
+
if(targetClass.indexOf('js-visible') !== -1) {
|
107
|
+
target.setAttribute('class', targetClass.replace(/(^|\s)js-visible(\s|$)/, ''));
|
108
|
+
} else {
|
109
|
+
target.setAttribute('class', targetClass + ' js-visible');
|
110
|
+
}
|
111
|
+
if(sourceClass.indexOf('js-visible') !== -1) {
|
112
|
+
this.setAttribute('class', sourceClass.replace(/(^|\s)js-visible(\s|$)/, ''));
|
113
|
+
} else {
|
114
|
+
this.setAttribute('class', sourceClass + ' js-visible');
|
115
|
+
}
|
116
|
+
this.setAttribute('aria-expanded', this.getAttribute('aria-expanded') !== 'true');
|
117
|
+
target.setAttribute('aria-hidden', target.getAttribute('aria-hidden') === 'false');
|
118
|
+
});
|
119
|
+
}
|
120
|
+
}
|
121
|
+
}).call(this);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* eslint-disable no-var */
|
1
|
+
/* eslint-disable no-var, vars-on-top, no-unused-vars */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var toolkit = require('../../../toolkit');
|
@@ -8,6 +8,11 @@ var formFocus = toolkit.formFocus;
|
|
8
8
|
var characterCount = toolkit.characterCount;
|
9
9
|
var validation = toolkit.validation;
|
10
10
|
|
11
|
+
var GOVUK = require('govuk-frontend');
|
12
|
+
GOVUK.initAll();
|
13
|
+
window.GOVUK = GOVUK;
|
14
|
+
var skipToMain = require('./skip-to-main');
|
15
|
+
var cookie = require('./govuk-cookies');
|
11
16
|
var cookieSettings = require('./cookieSettings');
|
12
17
|
|
13
18
|
toolkit.detailsSummary();
|
@@ -0,0 +1,19 @@
|
|
1
|
+
const skipToMain = function () {
|
2
|
+
const skipToMainLink = document.getElementById('skip-to-main');
|
3
|
+
const firstControlId = skipToMainLink.hash.split('#')[1] ? skipToMainLink.hash.split('#')[1] : 'main-content';
|
4
|
+
if(firstControlId === 'main-content') {
|
5
|
+
skipToMainLink.setAttribute('href', '#main-content');
|
6
|
+
}
|
7
|
+
if(firstControlId) {
|
8
|
+
// eslint-disable-next-line no-unused-vars
|
9
|
+
skipToMainLink.onclick = function (e) {
|
10
|
+
// here timeout added just to make this functionality asynchronous
|
11
|
+
// to focus on form as well as non form contents
|
12
|
+
setTimeout(() => {
|
13
|
+
const firstControl = document.getElementById(firstControlId);
|
14
|
+
firstControl.focus();
|
15
|
+
}, 10);
|
16
|
+
};
|
17
|
+
}
|
18
|
+
};
|
19
|
+
skipToMain();
|
@@ -10,7 +10,6 @@
|
|
10
10
|
}
|
11
11
|
|
12
12
|
#cookie-banner {
|
13
|
-
max-width: 960px;
|
14
13
|
margin: 0 15px;
|
15
14
|
p {
|
16
15
|
margin: 0;
|
@@ -62,3 +61,54 @@
|
|
62
61
|
height: fit-content;
|
63
62
|
}
|
64
63
|
}
|
64
|
+
|
65
|
+
// the following are additional hof specific govuk cookie banner styling
|
66
|
+
.govuk-banner--success {
|
67
|
+
border-color: #00703c;
|
68
|
+
color: #00703c;
|
69
|
+
}
|
70
|
+
|
71
|
+
.govuk-banner {
|
72
|
+
border: 5px solid #1d70b8;
|
73
|
+
font-size: 0;
|
74
|
+
margin-bottom: 30px;
|
75
|
+
padding: 10px;
|
76
|
+
}
|
77
|
+
|
78
|
+
.govuk-banner__icon{
|
79
|
+
display: inline-block;
|
80
|
+
}
|
81
|
+
|
82
|
+
.govuk-banner__message {
|
83
|
+
font-family: "GDS Transport", Arial, sans-serif;
|
84
|
+
-webkit-font-smoothing: antialiased;
|
85
|
+
font-weight: 400;
|
86
|
+
font-size: 1rem;
|
87
|
+
line-height: 1.25;
|
88
|
+
color: #0b0c0c;
|
89
|
+
display: block;
|
90
|
+
overflow: hidden;
|
91
|
+
display: inline-block;
|
92
|
+
margin-left: 10px;
|
93
|
+
}
|
94
|
+
|
95
|
+
.govuk-banner__assistive {
|
96
|
+
position: absolute !important;
|
97
|
+
width: 1px !important;
|
98
|
+
height: 1px !important;
|
99
|
+
margin: 0 !important;
|
100
|
+
padding: 0 !important;
|
101
|
+
overflow: hidden !important;
|
102
|
+
clip: rect(0 0 0 0) !important;
|
103
|
+
clip-path: inset(50%) !important;
|
104
|
+
border: 0 !important;
|
105
|
+
white-space: nowrap !important;
|
106
|
+
}
|
107
|
+
|
108
|
+
.cookie-table-holder > table > tbody > tr > td:first-child{
|
109
|
+
font-weight:bold;
|
110
|
+
}
|
111
|
+
|
112
|
+
.js-enabled #global-cookie-message {
|
113
|
+
display: none;
|
114
|
+
}
|
@@ -22,7 +22,7 @@
|
|
22
22
|
}
|
23
23
|
}
|
24
24
|
|
25
|
-
.
|
25
|
+
.govuk-form-group--error {
|
26
26
|
box-sizing: border-box;
|
27
27
|
padding-left: $gutter-half - $validation-bdr-size;
|
28
28
|
border-left: $validation-bdr-size-lg solid $error-colour;
|
@@ -36,7 +36,7 @@
|
|
36
36
|
}
|
37
37
|
}
|
38
38
|
|
39
|
-
.error-message {
|
39
|
+
.govuk-error-message {
|
40
40
|
display: block;
|
41
41
|
@include media(tablet) {
|
42
42
|
margin-bottom: 0.5em;
|
@@ -46,6 +46,6 @@
|
|
46
46
|
}
|
47
47
|
|
48
48
|
.invalid-input,
|
49
|
-
.
|
49
|
+
.govuk-form-group--error .date-input {
|
50
50
|
border: $validation-bdr-size solid $error-colour;
|
51
51
|
}
|
@@ -30,12 +30,12 @@ CharacterCount.prototype.updateCount = function () {
|
|
30
30
|
this.$maxlengthHint.innerHTML = 'You have ' + number + characterNoun + remainderSuffix;
|
31
31
|
|
32
32
|
if (currentLength >= this.maxLength + 1) {
|
33
|
-
helpers.removeClass(this.$maxlengthHint, '
|
34
|
-
helpers.addClass(this.$maxlengthHint, 'error-message');
|
33
|
+
helpers.removeClass(this.$maxlengthHint, 'govuk-hint');
|
34
|
+
helpers.addClass(this.$maxlengthHint, 'govuk-error-message');
|
35
35
|
helpers.addClass(this.$textarea, 'textarea-error');
|
36
36
|
} else {
|
37
|
-
helpers.addClass(this.$maxlengthHint, '
|
38
|
-
helpers.removeClass(this.$maxlengthHint, 'error-message');
|
37
|
+
helpers.addClass(this.$maxlengthHint, 'govuk-hint');
|
38
|
+
helpers.removeClass(this.$maxlengthHint, 'govuk-error-message');
|
39
39
|
helpers.removeClass(this.$textarea, 'textarea-error');
|
40
40
|
}
|
41
41
|
};
|
@@ -71,11 +71,20 @@ function formFocus() {
|
|
71
71
|
var labels;
|
72
72
|
var summaries;
|
73
73
|
|
74
|
-
|
74
|
+
var editMode = getElementFromSummaryLink && getEditPath === 'edit';
|
75
|
+
|
76
|
+
if (getElementFromSummaryLink && document.getElementById(getElementFromSummaryLink) && editMode) {
|
75
77
|
document.getElementById(getElementFromSummaryLink).focus();
|
78
|
+
}
|
79
|
+
|
80
|
+
if (getElementFromSummaryLink && document.getElementById(getElementFromSummaryLink + '-group') && editMode) {
|
76
81
|
document.getElementById(getElementFromSummaryLink + '-group').scrollIntoView();
|
77
82
|
}
|
78
83
|
|
84
|
+
if (document.getElementById(getElementFromSummaryLink + '-day') && forms.length === 1 && editMode) {
|
85
|
+
document.getElementById(getElementFromSummaryLink + '-day').focus();
|
86
|
+
}
|
87
|
+
|
79
88
|
if (forms.length > 0) {
|
80
89
|
labels = document.getElementsByTagName('label');
|
81
90
|
if (labels) {
|
@@ -24,7 +24,12 @@ function clicked(e) {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
if (inputs) {
|
27
|
-
inputs[0].
|
27
|
+
if (inputs[0].getAttribute('type') === 'hidden') {
|
28
|
+
var getVisibleElements = group.querySelectorAll('input[type=text]');
|
29
|
+
getVisibleElements[0].focus();
|
30
|
+
} else {
|
31
|
+
inputs[0].focus();
|
32
|
+
}
|
28
33
|
}
|
29
34
|
}
|
30
35
|
}
|
@@ -22,7 +22,7 @@
|
|
22
22
|
}
|
23
23
|
}
|
24
24
|
|
25
|
-
.
|
25
|
+
.govuk-form-group--error {
|
26
26
|
box-sizing: border-box;
|
27
27
|
padding-left: $gutter-half - $validation-bdr-size;
|
28
28
|
border-left: $validation-bdr-size-lg solid $error-colour;
|
@@ -36,7 +36,7 @@
|
|
36
36
|
}
|
37
37
|
}
|
38
38
|
|
39
|
-
.error-message {
|
39
|
+
.govuk-error-message {
|
40
40
|
display: block;
|
41
41
|
@include media(tablet) {
|
42
42
|
margin-bottom: 0.5em;
|
@@ -46,6 +46,6 @@
|
|
46
46
|
}
|
47
47
|
|
48
48
|
.invalid-input,
|
49
|
-
.
|
49
|
+
.govuk-form-group--error .date-input {
|
50
50
|
border: $validation-bdr-size solid $error-colour;
|
51
51
|
}
|
package/index.js
CHANGED
@@ -120,6 +120,8 @@ const getContentSecurityPolicy = (config, res) => {
|
|
120
120
|
* @param options.getTerms {boolean} Optional boolean - whether to mount the /terms endpoint
|
121
121
|
* @param options.getCookies {boolean} Optional boolean - whether to mount the /cookies endpoint
|
122
122
|
* @param options.noCache {boolean} Optional boolean - whether to disable caching
|
123
|
+
* @param options.getAccessibilityStatement {boolean} Optional boolean - whether to mount the
|
124
|
+
* /accessibility-statement endpoint
|
123
125
|
*
|
124
126
|
* @returns {object} A new HOF application using the configuration supplied in options
|
125
127
|
*/
|
@@ -209,6 +211,9 @@ function bootstrap(options) {
|
|
209
211
|
app.use(hofMiddleware.rateLimiter(config, 'requests'));
|
210
212
|
}
|
211
213
|
|
214
|
+
// Set up routing so <YOUR-SITE-URL>/assets are served from /node_modules/govuk-frontend/govuk/assets
|
215
|
+
app.use('/assets', express.static(path.join(__dirname, '/node_modules/govuk-frontend/govuk/assets')));
|
216
|
+
|
212
217
|
if (config.getAccessibility === true) {
|
213
218
|
deprecate(
|
214
219
|
'`getAccessibility` option is deprecated and may be removed in future versions.',
|
package/lib/settings.js
CHANGED
@@ -7,7 +7,22 @@ const hoganExpressStrict = require('hogan-express-strict');
|
|
7
7
|
const expressPartialTemplates = require('express-partial-templates');
|
8
8
|
const bodyParser = require('body-parser');
|
9
9
|
|
10
|
-
|
10
|
+
const dirExists = dir => {
|
11
|
+
try {
|
12
|
+
if (fs.existsSync(dir)) {
|
13
|
+
return true;
|
14
|
+
}
|
15
|
+
return false;
|
16
|
+
} catch(err) {
|
17
|
+
throw new Error(`${err}: Cannot check if the directory path exists`);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
const filterEmptyViews = views => {
|
22
|
+
return views.filter(view => dirExists(view));
|
23
|
+
};
|
24
|
+
|
25
|
+
module.exports = async (app, config) => {
|
11
26
|
const viewEngine = config.viewEngine || 'html';
|
12
27
|
|
13
28
|
app.use((req, res, next) => {
|
@@ -17,7 +32,8 @@ module.exports = (app, config) => {
|
|
17
32
|
|
18
33
|
app.use(config.theme());
|
19
34
|
|
20
|
-
const
|
35
|
+
const filteredViews = filterEmptyViews(config.theme.views);
|
36
|
+
const viewPaths = [].concat(filteredViews);
|
21
37
|
app.set('view engine', viewEngine);
|
22
38
|
app.enable('view cache');
|
23
39
|
|
@@ -4,6 +4,7 @@ const redis = require('redis');
|
|
4
4
|
const config = require('./../config/hof-defaults');
|
5
5
|
|
6
6
|
module.exports = (options, rateLimitType) => {
|
7
|
+
// eslint-disable-next-line no-console
|
7
8
|
const logger = options.logger || { log: (func, msg) => console[func](msg) };
|
8
9
|
const rateLimits = options.rateLimits[rateLimitType];
|
9
10
|
const timestampName = `${rateLimitType}TimeStamp`;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "hof",
|
3
3
|
"description": "A bootstrap for HOF projects",
|
4
|
-
"version": "
|
4
|
+
"version": "20.0.0-beta.10",
|
5
5
|
"license": "MIT",
|
6
6
|
"main": "index.js",
|
7
7
|
"author": "HomeOffice",
|
@@ -23,7 +23,7 @@
|
|
23
23
|
"scripts": {
|
24
24
|
"test": "yarn run unit && yarn run test:cookie-banner && yarn run test:functional && yarn run test:client && yarn run test:lint",
|
25
25
|
"unit": "LOG_LEVEL=error nyc _mocha \"test/**/*.spec.js\" \"sandbox/test/**/*.spec.js\"",
|
26
|
-
"unit:nocov": "LOG_LEVEL=error mocha",
|
26
|
+
"unit:nocov": "LOG_LEVEL=error mocha \"test/**/*.spec.js\" \"sandbox/test/**/*.spec.js\"",
|
27
27
|
"test:lint": "eslint . --config ./node_modules/eslint-config-hof/default.js",
|
28
28
|
"test:functional": "funkie mocha ./test/functional-tests --exit",
|
29
29
|
"test:client": "karma start test/frontend/toolkit/karma.conf.js",
|
@@ -57,6 +57,7 @@
|
|
57
57
|
"findup": "^0.1.5",
|
58
58
|
"glob": "^7.2.0",
|
59
59
|
"govuk-elements-sass": "^3.1.3",
|
60
|
+
"govuk-frontend": "3.14",
|
60
61
|
"govuk_template_mustache": "^0.26.0",
|
61
62
|
"helmet": "^3.22.0",
|
62
63
|
"hogan-express-strict": "^0.5.4",
|
package/sandbox/.env
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
// GA_TAG=UA-215558609-1
|
@@ -8,16 +8,25 @@ module.exports = {
|
|
8
8
|
'landing-page-radio': {
|
9
9
|
mixin: 'radio-group',
|
10
10
|
validate: ['required'],
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
isPageHeading: true,
|
12
|
+
// Design system says to avoid in-line unless it's two options,
|
13
|
+
// so just added as an example below but by default it isn't
|
14
|
+
className: ['govuk-radios--inline'],
|
14
15
|
options: ['basic-form', 'complex-form', 'build-your-own-form']
|
15
16
|
},
|
16
17
|
name: {
|
17
18
|
validate: ['required', 'notUrl', { type: 'maxlength', arguments: 200 }],
|
19
|
+
// need to remove this for the heading to go
|
20
|
+
labelClassName: ['govuk-label--l'],
|
21
|
+
isPageHeading: 'true'
|
18
22
|
},
|
19
|
-
dateOfBirth: dateComponent('dateOfBirth', {
|
20
|
-
|
23
|
+
'dateOfBirth': dateComponent('dateOfBirth', {
|
24
|
+
isPageHeading: 'true',
|
25
|
+
validate: [
|
26
|
+
'required',
|
27
|
+
'date',
|
28
|
+
{ type: 'after', arguments: ['1900'] }
|
29
|
+
]
|
21
30
|
}),
|
22
31
|
building: {
|
23
32
|
validate: ['required', 'notUrl', { type: 'maxlength', arguments: 100 }]
|
@@ -37,6 +46,7 @@ module.exports = {
|
|
37
46
|
formatter: ['removespaces', 'uppercase']
|
38
47
|
},
|
39
48
|
incomeTypes: {
|
49
|
+
isPageHeading: 'true',
|
40
50
|
mixin: 'checkbox-group',
|
41
51
|
labelClassName: 'visuallyhidden',
|
42
52
|
validate: ['required'],
|
@@ -49,11 +59,9 @@ module.exports = {
|
|
49
59
|
]
|
50
60
|
},
|
51
61
|
countryOfHearing: {
|
62
|
+
isPageHeading: 'true',
|
52
63
|
mixin: 'radio-group',
|
53
64
|
validate: ['required'],
|
54
|
-
legend: {
|
55
|
-
className: 'visuallyhidden'
|
56
|
-
},
|
57
65
|
options: [
|
58
66
|
'englandAndWales',
|
59
67
|
'scotland',
|
@@ -61,6 +69,8 @@ module.exports = {
|
|
61
69
|
]
|
62
70
|
},
|
63
71
|
email: {
|
72
|
+
isPageHeading: 'true',
|
73
|
+
labelClassName: ['govuk-label--l'],
|
64
74
|
validate: ['required', 'email']
|
65
75
|
},
|
66
76
|
phone: {
|
@@ -72,6 +82,7 @@ module.exports = {
|
|
72
82
|
},
|
73
83
|
countrySelect: {
|
74
84
|
mixin: 'select',
|
85
|
+
isPageHeading: 'true',
|
75
86
|
className: ['typeahead'],
|
76
87
|
options:[''].concat(require('homeoffice-countries').allCountries),
|
77
88
|
legend: {
|
@@ -81,14 +92,15 @@ module.exports = {
|
|
81
92
|
},
|
82
93
|
complaintDetails: {
|
83
94
|
mixin: 'textarea',
|
84
|
-
labelClassName: 'visuallyhidden',
|
85
95
|
// we want to ignore default formatters as we want
|
86
96
|
// to preserve white space
|
97
|
+
isPageHeading: 'true',
|
87
98
|
'ignore-defaults': true,
|
88
99
|
// apply the other default formatters
|
89
100
|
formatter: ['trim', 'hyphens'],
|
101
|
+
labelClassName: ['govuk-label--l'],
|
90
102
|
// attributes here are passed to the field element
|
91
|
-
validate: ['required', { type: 'maxlength', arguments:
|
103
|
+
validate: ['required', { type: 'maxlength', arguments: 10 }],
|
92
104
|
attributes: [{
|
93
105
|
attribute: 'rows',
|
94
106
|
value: 8
|
@@ -96,7 +108,7 @@ module.exports = {
|
|
96
108
|
},
|
97
109
|
appealStages: {
|
98
110
|
mixin: 'select',
|
99
|
-
|
111
|
+
isPageHeading: 'true',
|
100
112
|
validate: ['required'],
|
101
113
|
options: [{
|
102
114
|
value: '',
|