hof 20.1.6 → 20.1.8

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.
@@ -116,7 +116,7 @@ module.exports = config => {
116
116
 
117
117
  if (process.env.HOF_SANDBOX === 'true') {
118
118
  const rootDir = require('path').resolve(__dirname, '../../../');
119
- ignored.push(`${rootDir}/frontend/govuk-template/govuk_template.html`);
119
+ ignored.push(`${rootDir}/frontend/govuk-template/govuk_template_generated.html`);
120
120
  watchLocation = [rootDir, '.'];
121
121
  }
122
122
 
@@ -103,9 +103,11 @@ module.exports = class Controller extends BaseController {
103
103
  const locals = super.locals(req, res);
104
104
  const stepLocals = req.form.options.locals || {};
105
105
 
106
- const fields = _.map(req.form.options.fields, (field, key) =>
106
+ let fields = _.map(req.form.options.fields, (field, key) =>
107
107
  Object.assign({}, field, { key })
108
108
  );
109
+ // only include fields that aren't dependents to mitigate duplicate fields on the page
110
+ fields = fields.filter(field => !req.form.options.fields[field.key].dependent);
109
111
 
110
112
  return _.extend({}, locals, {
111
113
  fields,
@@ -53,6 +53,18 @@ module.exports = {
53
53
 
54
54
  base64decode(value) {
55
55
  return Buffer.from(value, 'base64').toString();
56
+ },
57
+
58
+ ukPostcode(value) {
59
+ if (typeof value !== 'string') {
60
+ return value;
61
+ }
62
+
63
+ const postcode = this.uppercase(this.removespaces(value));
64
+ const firstPart = postcode.slice(0, -3);
65
+ const secondPart = postcode.slice(-3);
66
+
67
+ return `${firstPart} ${secondPart}`;
56
68
  }
57
69
 
58
70
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "20.1.6",
4
+ "version": "20.1.8",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -25,7 +25,7 @@
25
25
  "unit": "LOG_LEVEL=error nyc _mocha \"test/**/*.spec.js\" \"sandbox/test/**/*.spec.js\"",
26
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
- "test:functional": "funkie mocha ./test/functional-tests --exit",
28
+ "test:functional": "funkie mocha ./test/functional-tests --timeout 20000 --exit",
29
29
  "test:client": "karma start test/frontend/toolkit/karma.conf.js",
30
30
  "test:cookie-banner": "jest test/frontend/jest",
31
31
  "test:acceptance": "TAGS=\"${TAGS:=@feature}\" yarn run test:cucumber",