@ukhomeoffice/cop-react-form-renderer 4.33.3 → 4.35.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.
@@ -153,7 +153,7 @@ describe('components.CollectionPage', function () {
153
153
  expect(label.textContent).toEqual(lbl);
154
154
  expect(label.getAttribute('for')).toEqual(fieldId);
155
155
  var hint = formGroup.childNodes[0].childNodes[1];
156
- expect(hint.tagName).toEqual('SPAN');
156
+ expect(hint.tagName).toEqual('DIV');
157
157
  expect(hint.classList).toContain('govuk-hint');
158
158
  expect(hint.textContent).toEqual(hnt);
159
159
  var input = formGroup.childNodes[0].childNodes[2];
@@ -173,7 +173,7 @@ describe('components.CollectionPage', function () {
173
173
  expect(label.textContent).toEqual(lbl);
174
174
  expect(label.getAttribute('for')).toEqual(fieldId);
175
175
  var hint = formGroup.childNodes[0].childNodes[1];
176
- expect(hint.tagName).toEqual('SPAN');
176
+ expect(hint.tagName).toEqual('DIV');
177
177
  expect(hint.classList).toContain('govuk-hint');
178
178
  expect(hint.textContent).toEqual(hnt);
179
179
  var outerWrapper = formGroup.childNodes[0].childNodes[2];
@@ -94,7 +94,7 @@ describe('components.FormComponent.Collection', function () {
94
94
  expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
95
95
  expect(label.getAttribute('for')).toEqual("".concat(ID, "[0].").concat(TEXT_ID));
96
96
  hint = formGroup.childNodes[0].childNodes[1];
97
- expect(hint.tagName).toEqual('SPAN');
97
+ expect(hint.tagName).toEqual('DIV');
98
98
  expect(hint.classList).toContain('govuk-hint');
99
99
  expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
100
100
  input = formGroup.childNodes[0].childNodes[2];
@@ -360,7 +360,7 @@ describe('components.FormComponent.Collection', function () {
360
360
  expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
361
361
  expect(label.getAttribute('for')).toEqual("".concat(ID, "[0].").concat(TEXT_ID));
362
362
  hint = formGroup.childNodes[0].childNodes[1];
363
- expect(hint.tagName).toEqual('SPAN');
363
+ expect(hint.tagName).toEqual('DIV');
364
364
  expect(hint.classList).toContain('govuk-hint');
365
365
  expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
366
366
  input = formGroup.childNodes[0].childNodes[2];
@@ -82,7 +82,7 @@ describe('components.FormComponent.Container', function () {
82
82
  expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
83
83
  expect(label.getAttribute('for')).toEqual("".concat(ID, ".").concat(TEXT_ID));
84
84
  hint = formGroup.childNodes[0].childNodes[1];
85
- expect(hint.tagName).toEqual('SPAN');
85
+ expect(hint.tagName).toEqual('DIV');
86
86
  expect(hint.classList).toContain('govuk-hint');
87
87
  expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
88
88
  input = formGroup.childNodes[0].childNodes[2];
@@ -139,7 +139,7 @@ describe('components.FormComponent.Container', function () {
139
139
  expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
140
140
  expect(label.getAttribute('for')).toEqual("".concat(ID, ".").concat(NESTED_ID, ".").concat(TEXT_ID));
141
141
  hint = formGroup.childNodes[0].childNodes[1];
142
- expect(hint.tagName).toEqual('SPAN');
142
+ expect(hint.tagName).toEqual('DIV');
143
143
  expect(hint.classList).toContain('govuk-hint');
144
144
  expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
145
145
  input = formGroup.childNodes[0].childNodes[2];
@@ -320,7 +320,7 @@ describe('components.FormComponent.Container', function () {
320
320
  expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
321
321
  expect(label.getAttribute('for')).toEqual("".concat(ID, ".").concat(TEXT_ID));
322
322
  hint = formGroup.childNodes[0].childNodes[1];
323
- expect(hint.tagName).toEqual('SPAN');
323
+ expect(hint.tagName).toEqual('DIV');
324
324
  expect(hint.classList).toContain('govuk-hint');
325
325
  expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
326
326
  input = formGroup.childNodes[0].childNodes[2];
@@ -402,7 +402,7 @@ describe('components.FormComponent.Container', function () {
402
402
  expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
403
403
  expect(label.getAttribute('for')).toEqual("".concat(ID, ".").concat(TEXT_ID));
404
404
  hint = formGroup.childNodes[0].childNodes[1];
405
- expect(hint.tagName).toEqual('SPAN');
405
+ expect(hint.tagName).toEqual('DIV');
406
406
  expect(hint.classList).toContain('govuk-hint');
407
407
  expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
408
408
  input = formGroup.childNodes[0].childNodes[2];
@@ -49,7 +49,7 @@ describe('components', function () {
49
49
  expect(label.textContent).toEqual("".concat(COMPONENT.label, " (optional)"));
50
50
  expect(label.getAttribute('for')).toEqual(ID);
51
51
  hint = formGroup.childNodes[0].childNodes[1];
52
- expect(hint.tagName).toEqual('SPAN');
52
+ expect(hint.tagName).toEqual('DIV');
53
53
  expect(hint.classList).toContain('govuk-hint');
54
54
  expect(hint.textContent).toEqual(COMPONENT.hint);
55
55
  input = formGroup.childNodes[0].childNodes[2];
@@ -244,7 +244,7 @@ describe('components', function () {
244
244
  expect(label.textContent).toEqual('Interpolated Text component (optional)');
245
245
  expect(label.getAttribute('for')).toEqual(ID);
246
246
  hint = formGroup.childNodes[0].childNodes[1];
247
- expect(hint.tagName).toEqual('SPAN');
247
+ expect(hint.tagName).toEqual('DIV');
248
248
  expect(hint.classList).toContain('govuk-hint');
249
249
  expect(hint.textContent).toEqual(COMPONENT.hint);
250
250
  input = formGroup.childNodes[0].childNodes[2];
@@ -73,14 +73,13 @@ var FormPage = function FormPage(_ref) {
73
73
  _useState4 = _slicedToArray(_useState3, 2),
74
74
  patchLabel = _useState4[0],
75
75
  setPatchLabel = _useState4[1];
76
-
77
- var docTitle = (0, _react.useState)(document.title);
78
76
  /**
79
77
  * Handle the state of the data directly within the page.
80
78
  * This is so that the overall form data isn't affected until such
81
79
  * time as the onAction handler is invoked.
82
80
  */
83
81
 
82
+
84
83
  var onPageChange = function onPageChange(_ref2) {
85
84
  var target = _ref2.target;
86
85
  page.formData[target.name] = target.value;
@@ -93,8 +92,9 @@ var FormPage = function FormPage(_ref) {
93
92
  };
94
93
 
95
94
  (0, _react.useEffect)(function () {
96
- document.title = errors.length > 0 ? 'Error: ' + docTitle : docTitle;
97
- }, [errors, docTitle]);
95
+ var coreDocTitle = document.title.replace('Error: ', '');
96
+ document.title = errors.length > 0 ? 'Error: ' + coreDocTitle : coreDocTitle;
97
+ }, [errors]);
98
98
 
99
99
  var classes = _utils.default.classBuilder(classBlock, classModifiers, className);
100
100
 
@@ -141,7 +141,7 @@ describe('components.FormPage', function () {
141
141
  expect(label.textContent).toEqual(lbl);
142
142
  expect(label.getAttribute('for')).toEqual(fieldId);
143
143
  var hint = formGroup.childNodes[0].childNodes[1];
144
- expect(hint.tagName).toEqual('SPAN');
144
+ expect(hint.tagName).toEqual('DIV');
145
145
  expect(hint.classList).toContain('govuk-hint');
146
146
  expect(hint.textContent).toEqual(hnt);
147
147
  var input = formGroup.childNodes[0].childNodes[2];
@@ -161,7 +161,7 @@ describe('components.FormPage', function () {
161
161
  expect(label.textContent).toEqual(lbl);
162
162
  expect(label.getAttribute('for')).toEqual(fieldId);
163
163
  var hint = formGroup.childNodes[0].childNodes[1];
164
- expect(hint.tagName).toEqual('SPAN');
164
+ expect(hint.tagName).toEqual('DIV');
165
165
  expect(hint.classList).toContain('govuk-hint');
166
166
  expect(hint.textContent).toEqual(hnt);
167
167
  var outerWrapper = formGroup.childNodes[0].childNodes[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/cop-react-form-renderer",
3
- "version": "4.33.3",
3
+ "version": "4.35.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "clean": "rimraf dist",
@@ -16,7 +16,7 @@
16
16
  "post-compile": "rimraf dist/*.test.* dist/**/*.test.* dist/**/*.stories.* dist/docs dist/assets"
17
17
  },
18
18
  "dependencies": {
19
- "@ukhomeoffice/cop-react-components": "2.5.0",
19
+ "@ukhomeoffice/cop-react-components": "2.7.1",
20
20
  "axios": "^0.23.0",
21
21
  "dayjs": "^1.11.0",
22
22
  "govuk-frontend": "^4.3.1",