@ukhomeoffice/cop-react-form-renderer 4.29.0 → 4.31.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/dist/components/CollectionPage/CollectionPage.test.js +9 -9
- package/dist/components/FormComponent/Collection.test.js +7 -7
- package/dist/components/FormComponent/Container.test.js +14 -14
- package/dist/components/FormComponent/FormComponent.test.js +6 -6
- package/dist/components/FormPage/FormPage.test.js +8 -8
- package/dist/components/FormRenderer/FormRenderer.js +2 -1
- package/dist/components/FormRenderer/FormRenderer.test.js +17 -17
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +4 -3
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +2 -2
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +4 -3
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +7 -7
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +11 -11
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +1 -7
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.textarea.test.js +1 -1
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +4 -4
- package/dist/utils/Validate/validateEmail.js +1 -1
- package/package.json +2 -2
|
@@ -147,16 +147,16 @@ describe('components.CollectionPage', function () {
|
|
|
147
147
|
var checkInputField = function checkInputField(formGroup, fieldId, lbl, hnt, val) {
|
|
148
148
|
expect(formGroup.tagName).toEqual('DIV');
|
|
149
149
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
150
|
-
var label = formGroup.childNodes[0];
|
|
150
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
151
151
|
expect(label.tagName).toEqual('LABEL');
|
|
152
152
|
expect(label.classList).toContain('govuk-label');
|
|
153
153
|
expect(label.textContent).toEqual(lbl);
|
|
154
154
|
expect(label.getAttribute('for')).toEqual(fieldId);
|
|
155
|
-
var hint = formGroup.childNodes[1];
|
|
155
|
+
var hint = formGroup.childNodes[0].childNodes[1];
|
|
156
156
|
expect(hint.tagName).toEqual('SPAN');
|
|
157
157
|
expect(hint.classList).toContain('govuk-hint');
|
|
158
158
|
expect(hint.textContent).toEqual(hnt);
|
|
159
|
-
var input = formGroup.childNodes[2];
|
|
159
|
+
var input = formGroup.childNodes[0].childNodes[2];
|
|
160
160
|
expect(input.tagName).toEqual('INPUT');
|
|
161
161
|
expect(input.classList).toContain('govuk-input');
|
|
162
162
|
expect(input.id).toEqual(fieldId);
|
|
@@ -167,16 +167,16 @@ describe('components.CollectionPage', function () {
|
|
|
167
167
|
var checkAutoCompleteField = function checkAutoCompleteField(formGroup, fieldId, lbl, hnt, val) {
|
|
168
168
|
expect(formGroup.tagName).toEqual('DIV');
|
|
169
169
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
170
|
-
var label = formGroup.childNodes[0];
|
|
170
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
171
171
|
expect(label.tagName).toEqual('LABEL');
|
|
172
172
|
expect(label.classList).toContain('govuk-label');
|
|
173
173
|
expect(label.textContent).toEqual(lbl);
|
|
174
174
|
expect(label.getAttribute('for')).toEqual(fieldId);
|
|
175
|
-
var hint = formGroup.childNodes[1];
|
|
175
|
+
var hint = formGroup.childNodes[0].childNodes[1];
|
|
176
176
|
expect(hint.tagName).toEqual('SPAN');
|
|
177
177
|
expect(hint.classList).toContain('govuk-hint');
|
|
178
178
|
expect(hint.textContent).toEqual(hnt);
|
|
179
|
-
var outerWrapper = formGroup.childNodes[2];
|
|
179
|
+
var outerWrapper = formGroup.childNodes[0].childNodes[2];
|
|
180
180
|
expect(outerWrapper.classList).toContain('hods-autocomplete__outer-wrapper');
|
|
181
181
|
var autocomplete = outerWrapper.childNodes[0];
|
|
182
182
|
expect(autocomplete.classList).toContain('hods-autocomplete__wrapper');
|
|
@@ -293,7 +293,7 @@ describe('components.CollectionPage', function () {
|
|
|
293
293
|
page = container.childNodes[0];
|
|
294
294
|
expect(page.tagName).toEqual('DIV'); // Change the input.
|
|
295
295
|
|
|
296
|
-
input = page.childNodes[1].childNodes[2];
|
|
296
|
+
input = page.childNodes[1].childNodes[0].childNodes[2];
|
|
297
297
|
NEW_VALUE = "".concat(VALUE, ".");
|
|
298
298
|
EVENT = {
|
|
299
299
|
target: {
|
|
@@ -327,7 +327,7 @@ describe('components.CollectionPage', function () {
|
|
|
327
327
|
})), container = _renderWithValidation4.container;
|
|
328
328
|
page = container.childNodes[0]; // Change the input.
|
|
329
329
|
|
|
330
|
-
input = page.childNodes[1].childNodes[2];
|
|
330
|
+
input = page.childNodes[1].childNodes[0].childNodes[2];
|
|
331
331
|
NEW_VALUE = "".concat(VALUE, ".");
|
|
332
332
|
CHANGE_EVENT = {
|
|
333
333
|
target: {
|
|
@@ -374,7 +374,7 @@ describe('components.CollectionPage', function () {
|
|
|
374
374
|
})), container = _renderWithValidation5.container;
|
|
375
375
|
page = container.childNodes[0]; // Change the input.
|
|
376
376
|
|
|
377
|
-
input = page.childNodes[1].childNodes[2];
|
|
377
|
+
input = page.childNodes[1].childNodes[0].childNodes[2];
|
|
378
378
|
NEW_VALUE = "".concat(VALUE, ".");
|
|
379
379
|
CHANGE_EVENT = {
|
|
380
380
|
target: {
|
|
@@ -88,16 +88,16 @@ describe('components.FormComponent.Collection', function () {
|
|
|
88
88
|
formGroup = itemContainer.childNodes[0];
|
|
89
89
|
expect(formGroup.tagName).toEqual('DIV');
|
|
90
90
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
91
|
-
label = formGroup.childNodes[0];
|
|
91
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
92
92
|
expect(label.tagName).toEqual('LABEL');
|
|
93
93
|
expect(label.classList).toContain('govuk-label');
|
|
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
|
-
hint = formGroup.childNodes[1];
|
|
96
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
97
97
|
expect(hint.tagName).toEqual('SPAN');
|
|
98
98
|
expect(hint.classList).toContain('govuk-hint');
|
|
99
99
|
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
100
|
-
input = formGroup.childNodes[2];
|
|
100
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
101
101
|
expect(input.tagName).toEqual('INPUT');
|
|
102
102
|
expect(input.classList).toContain('govuk-input');
|
|
103
103
|
expect(input.id).toEqual("".concat(ID, "[0].").concat(TEXT_ID));
|
|
@@ -144,7 +144,7 @@ describe('components.FormComponent.Collection', function () {
|
|
|
144
144
|
c = container.childNodes[0];
|
|
145
145
|
item = c.childNodes[0];
|
|
146
146
|
formGroup = item.childNodes[1].childNodes[0];
|
|
147
|
-
input = formGroup.childNodes[2];
|
|
147
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
148
148
|
NEW_TEXT_VALUE = 'bravo';
|
|
149
149
|
EVENT = {
|
|
150
150
|
target: {
|
|
@@ -354,16 +354,16 @@ describe('components.FormComponent.Collection', function () {
|
|
|
354
354
|
formGroup = itemContainer.childNodes[0];
|
|
355
355
|
expect(formGroup.tagName).toEqual('DIV');
|
|
356
356
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
357
|
-
label = formGroup.childNodes[0];
|
|
357
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
358
358
|
expect(label.tagName).toEqual('LABEL');
|
|
359
359
|
expect(label.classList).toContain('govuk-label');
|
|
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
|
-
hint = formGroup.childNodes[1];
|
|
362
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
363
363
|
expect(hint.tagName).toEqual('SPAN');
|
|
364
364
|
expect(hint.classList).toContain('govuk-hint');
|
|
365
365
|
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
366
|
-
input = formGroup.childNodes[2];
|
|
366
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
367
367
|
expect(input.tagName).toEqual('DIV'); // Now readonly, so a DIV.
|
|
368
368
|
|
|
369
369
|
expect(input.classList).toContain('hods-readonly'); // Now readonly, so hods-readonly
|
|
@@ -76,16 +76,16 @@ describe('components.FormComponent.Container', function () {
|
|
|
76
76
|
formGroup = c.childNodes[0];
|
|
77
77
|
expect(formGroup.tagName).toEqual('DIV');
|
|
78
78
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
79
|
-
label = formGroup.childNodes[0];
|
|
79
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
80
80
|
expect(label.tagName).toEqual('LABEL');
|
|
81
81
|
expect(label.classList).toContain('govuk-label');
|
|
82
82
|
expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
|
|
83
83
|
expect(label.getAttribute('for')).toEqual("".concat(ID, ".").concat(TEXT_ID));
|
|
84
|
-
hint = formGroup.childNodes[1];
|
|
84
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
85
85
|
expect(hint.tagName).toEqual('SPAN');
|
|
86
86
|
expect(hint.classList).toContain('govuk-hint');
|
|
87
87
|
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
88
|
-
input = formGroup.childNodes[2];
|
|
88
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
89
89
|
expect(input.tagName).toEqual('INPUT');
|
|
90
90
|
expect(input.classList).toContain('govuk-input');
|
|
91
91
|
expect(input.id).toEqual("".concat(ID, ".").concat(TEXT_ID));
|
|
@@ -133,16 +133,16 @@ describe('components.FormComponent.Container', function () {
|
|
|
133
133
|
formGroup = nested.childNodes[0];
|
|
134
134
|
expect(formGroup.tagName).toEqual('DIV');
|
|
135
135
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
136
|
-
label = formGroup.childNodes[0];
|
|
136
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
137
137
|
expect(label.tagName).toEqual('LABEL');
|
|
138
138
|
expect(label.classList).toContain('govuk-label');
|
|
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
|
-
hint = formGroup.childNodes[1];
|
|
141
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
142
142
|
expect(hint.tagName).toEqual('SPAN');
|
|
143
143
|
expect(hint.classList).toContain('govuk-hint');
|
|
144
144
|
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
145
|
-
input = formGroup.childNodes[2];
|
|
145
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
146
146
|
expect(input.tagName).toEqual('INPUT');
|
|
147
147
|
expect(input.classList).toContain('govuk-input');
|
|
148
148
|
expect(input.id).toEqual("".concat(ID, ".").concat(NESTED_ID, ".").concat(TEXT_ID));
|
|
@@ -188,7 +188,7 @@ describe('components.FormComponent.Container', function () {
|
|
|
188
188
|
|
|
189
189
|
c = container.childNodes[0];
|
|
190
190
|
formGroup = c.childNodes[0];
|
|
191
|
-
input = formGroup.childNodes[2];
|
|
191
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
192
192
|
NEW_TEXT_VALUE = 'bravo';
|
|
193
193
|
EVENT = {
|
|
194
194
|
target: {
|
|
@@ -253,7 +253,7 @@ describe('components.FormComponent.Container', function () {
|
|
|
253
253
|
|
|
254
254
|
c = container.childNodes[0];
|
|
255
255
|
formGroup = c.childNodes[0];
|
|
256
|
-
input = formGroup.childNodes[2].childNodes[0];
|
|
256
|
+
input = formGroup.childNodes[0].childNodes[2].childNodes[0];
|
|
257
257
|
FILE_EXTENSION = 'json';
|
|
258
258
|
FILE_NAME = "test.".concat(FILE_EXTENSION);
|
|
259
259
|
FILE_TYPE = 'application/JSON';
|
|
@@ -314,16 +314,16 @@ describe('components.FormComponent.Container', function () {
|
|
|
314
314
|
formGroup = c.childNodes[0];
|
|
315
315
|
expect(formGroup.tagName).toEqual('DIV');
|
|
316
316
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
317
|
-
label = formGroup.childNodes[0];
|
|
317
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
318
318
|
expect(label.tagName).toEqual('LABEL');
|
|
319
319
|
expect(label.classList).toContain('govuk-label');
|
|
320
320
|
expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
|
|
321
321
|
expect(label.getAttribute('for')).toEqual("".concat(ID, ".").concat(TEXT_ID));
|
|
322
|
-
hint = formGroup.childNodes[1];
|
|
322
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
323
323
|
expect(hint.tagName).toEqual('SPAN');
|
|
324
324
|
expect(hint.classList).toContain('govuk-hint');
|
|
325
325
|
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
326
|
-
input = formGroup.childNodes[2];
|
|
326
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
327
327
|
expect(input.tagName).toEqual('INPUT');
|
|
328
328
|
expect(input.classList).toContain('govuk-input');
|
|
329
329
|
expect(input.id).toEqual("".concat(ID, ".").concat(TEXT_ID));
|
|
@@ -396,16 +396,16 @@ describe('components.FormComponent.Container', function () {
|
|
|
396
396
|
formGroup = c.childNodes[0];
|
|
397
397
|
expect(formGroup.tagName).toEqual('DIV');
|
|
398
398
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
399
|
-
label = formGroup.childNodes[0];
|
|
399
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
400
400
|
expect(label.tagName).toEqual('LABEL');
|
|
401
401
|
expect(label.classList).toContain('govuk-label');
|
|
402
402
|
expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
|
|
403
403
|
expect(label.getAttribute('for')).toEqual("".concat(ID, ".").concat(TEXT_ID));
|
|
404
|
-
hint = formGroup.childNodes[1];
|
|
404
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
405
405
|
expect(hint.tagName).toEqual('SPAN');
|
|
406
406
|
expect(hint.classList).toContain('govuk-hint');
|
|
407
407
|
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
408
|
-
input = formGroup.childNodes[2];
|
|
408
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
409
409
|
expect(input.tagName).toEqual('DIV'); // Now readonly, so a DIV.
|
|
410
410
|
|
|
411
411
|
expect(input.classList).toContain('hods-readonly'); // Now readonly, so hods-readonly
|
|
@@ -43,16 +43,16 @@ describe('components', function () {
|
|
|
43
43
|
formGroup = container.childNodes[0];
|
|
44
44
|
expect(formGroup.tagName).toEqual('DIV');
|
|
45
45
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
46
|
-
label = formGroup.childNodes[0];
|
|
46
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
47
47
|
expect(label.tagName).toEqual('LABEL');
|
|
48
48
|
expect(label.classList).toContain('govuk-label');
|
|
49
49
|
expect(label.textContent).toEqual("".concat(COMPONENT.label, " (optional)"));
|
|
50
50
|
expect(label.getAttribute('for')).toEqual(ID);
|
|
51
|
-
hint = formGroup.childNodes[1];
|
|
51
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
52
52
|
expect(hint.tagName).toEqual('SPAN');
|
|
53
53
|
expect(hint.classList).toContain('govuk-hint');
|
|
54
54
|
expect(hint.textContent).toEqual(COMPONENT.hint);
|
|
55
|
-
input = formGroup.childNodes[2];
|
|
55
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
56
56
|
expect(input.tagName).toEqual('INPUT');
|
|
57
57
|
expect(input.classList).toContain('govuk-input');
|
|
58
58
|
expect(input.id).toEqual(ID);
|
|
@@ -238,16 +238,16 @@ describe('components', function () {
|
|
|
238
238
|
formGroup = container.childNodes[0];
|
|
239
239
|
expect(formGroup.tagName).toEqual('DIV');
|
|
240
240
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
241
|
-
label = formGroup.childNodes[0];
|
|
241
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
242
242
|
expect(label.tagName).toEqual('LABEL');
|
|
243
243
|
expect(label.classList).toContain('govuk-label');
|
|
244
244
|
expect(label.textContent).toEqual('Interpolated Text component (optional)');
|
|
245
245
|
expect(label.getAttribute('for')).toEqual(ID);
|
|
246
|
-
hint = formGroup.childNodes[1];
|
|
246
|
+
hint = formGroup.childNodes[0].childNodes[1];
|
|
247
247
|
expect(hint.tagName).toEqual('SPAN');
|
|
248
248
|
expect(hint.classList).toContain('govuk-hint');
|
|
249
249
|
expect(hint.textContent).toEqual(COMPONENT.hint);
|
|
250
|
-
input = formGroup.childNodes[2];
|
|
250
|
+
input = formGroup.childNodes[0].childNodes[2];
|
|
251
251
|
expect(input.tagName).toEqual('INPUT');
|
|
252
252
|
expect(input.classList).toContain('govuk-input');
|
|
253
253
|
expect(input.id).toEqual(ID);
|
|
@@ -135,16 +135,16 @@ describe('components.FormPage', function () {
|
|
|
135
135
|
var checkInputField = function checkInputField(formGroup, fieldId, lbl, hnt, val) {
|
|
136
136
|
expect(formGroup.tagName).toEqual('DIV');
|
|
137
137
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
138
|
-
var label = formGroup.childNodes[0];
|
|
138
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
139
139
|
expect(label.tagName).toEqual('LABEL');
|
|
140
140
|
expect(label.classList).toContain('govuk-label');
|
|
141
141
|
expect(label.textContent).toEqual(lbl);
|
|
142
142
|
expect(label.getAttribute('for')).toEqual(fieldId);
|
|
143
|
-
var hint = formGroup.childNodes[1];
|
|
143
|
+
var hint = formGroup.childNodes[0].childNodes[1];
|
|
144
144
|
expect(hint.tagName).toEqual('SPAN');
|
|
145
145
|
expect(hint.classList).toContain('govuk-hint');
|
|
146
146
|
expect(hint.textContent).toEqual(hnt);
|
|
147
|
-
var input = formGroup.childNodes[2];
|
|
147
|
+
var input = formGroup.childNodes[0].childNodes[2];
|
|
148
148
|
expect(input.tagName).toEqual('INPUT');
|
|
149
149
|
expect(input.classList).toContain('govuk-input');
|
|
150
150
|
expect(input.id).toEqual(fieldId);
|
|
@@ -155,16 +155,16 @@ describe('components.FormPage', function () {
|
|
|
155
155
|
var checkAutoCompleteField = function checkAutoCompleteField(formGroup, fieldId, lbl, hnt, val) {
|
|
156
156
|
expect(formGroup.tagName).toEqual('DIV');
|
|
157
157
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
158
|
-
var label = formGroup.childNodes[0];
|
|
158
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
159
159
|
expect(label.tagName).toEqual('LABEL');
|
|
160
160
|
expect(label.classList).toContain('govuk-label');
|
|
161
161
|
expect(label.textContent).toEqual(lbl);
|
|
162
162
|
expect(label.getAttribute('for')).toEqual(fieldId);
|
|
163
|
-
var hint = formGroup.childNodes[1];
|
|
163
|
+
var hint = formGroup.childNodes[0].childNodes[1];
|
|
164
164
|
expect(hint.tagName).toEqual('SPAN');
|
|
165
165
|
expect(hint.classList).toContain('govuk-hint');
|
|
166
166
|
expect(hint.textContent).toEqual(hnt);
|
|
167
|
-
var outerWrapper = formGroup.childNodes[2];
|
|
167
|
+
var outerWrapper = formGroup.childNodes[0].childNodes[2];
|
|
168
168
|
expect(outerWrapper.classList).toContain('hods-autocomplete__outer-wrapper');
|
|
169
169
|
var autocomplete = outerWrapper.childNodes[0];
|
|
170
170
|
expect(autocomplete.classList).toContain('hods-autocomplete__wrapper');
|
|
@@ -278,7 +278,7 @@ describe('components.FormPage', function () {
|
|
|
278
278
|
page = container.childNodes[0];
|
|
279
279
|
expect(page.tagName).toEqual('DIV'); // Change the input.
|
|
280
280
|
|
|
281
|
-
input = page.childNodes[1].childNodes[2];
|
|
281
|
+
input = page.childNodes[1].childNodes[0].childNodes[2];
|
|
282
282
|
NEW_VALUE = "".concat(VALUE, ".");
|
|
283
283
|
EVENT = {
|
|
284
284
|
target: {
|
|
@@ -312,7 +312,7 @@ describe('components.FormPage', function () {
|
|
|
312
312
|
})), container = _renderWithValidation4.container;
|
|
313
313
|
page = container.childNodes[0]; // Change the input.
|
|
314
314
|
|
|
315
|
-
input = page.childNodes[1].childNodes[2];
|
|
315
|
+
input = page.childNodes[1].childNodes[0].childNodes[2];
|
|
316
316
|
NEW_VALUE = "".concat(VALUE, ".");
|
|
317
317
|
CHANGE_EVENT = {
|
|
318
318
|
target: {
|
|
@@ -292,9 +292,10 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
292
292
|
}, [currentTask.fullPages, data, hubDetails === null || hubDetails === void 0 ? void 0 : hubDetails.sections, hubDetails === null || hubDetails === void 0 ? void 0 : hubDetails.nonSequential]);
|
|
293
293
|
|
|
294
294
|
var onPageChange = function onPageChange(newPageId) {
|
|
295
|
+
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
295
296
|
clearErrors();
|
|
296
297
|
setPageId(newPageId);
|
|
297
|
-
hooks.onPageChange(newPageId);
|
|
298
|
+
hooks.onPageChange(newPageId, state);
|
|
298
299
|
};
|
|
299
300
|
|
|
300
301
|
(0, _react.useEffect)(function () {
|
|
@@ -634,21 +634,21 @@ describe('components', function () {
|
|
|
634
634
|
newPage = container.childNodes[0].childNodes[0];
|
|
635
635
|
expect(newPage.childNodes[0].textContent).toEqual('Event Date');
|
|
636
636
|
|
|
637
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[1], {
|
|
637
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[1], {
|
|
638
638
|
target: {
|
|
639
639
|
name: 'date-day',
|
|
640
640
|
value: '7'
|
|
641
641
|
}
|
|
642
642
|
});
|
|
643
643
|
|
|
644
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[1].childNodes[1], {
|
|
644
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[1].childNodes[0].childNodes[1], {
|
|
645
645
|
target: {
|
|
646
646
|
name: 'date-month',
|
|
647
647
|
value: '7'
|
|
648
648
|
}
|
|
649
649
|
});
|
|
650
650
|
|
|
651
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[2].childNodes[1], {
|
|
651
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[2].childNodes[0].childNodes[1], {
|
|
652
652
|
target: {
|
|
653
653
|
name: 'date-year',
|
|
654
654
|
value: '2022'
|
|
@@ -663,7 +663,7 @@ describe('components', function () {
|
|
|
663
663
|
newPage = container.childNodes[0].childNodes[0];
|
|
664
664
|
expect(newPage.childNodes[0].textContent).toEqual('Event Mode');
|
|
665
665
|
|
|
666
|
-
_react.fireEvent.click(newPage.childNodes[1].childNodes[
|
|
666
|
+
_react.fireEvent.click(newPage.childNodes[1].childNodes[0].childNodes[1], {});
|
|
667
667
|
|
|
668
668
|
continueButton = newPage.childNodes[2].childNodes[0];
|
|
669
669
|
|
|
@@ -671,17 +671,17 @@ describe('components', function () {
|
|
|
671
671
|
|
|
672
672
|
|
|
673
673
|
cyaPageChange = container.childNodes[0].childNodes[0];
|
|
674
|
-
modeChangeLink = cyaPageChange.childNodes[
|
|
674
|
+
modeChangeLink = cyaPageChange.childNodes[0].childNodes[1].childNodes[0].childNodes[0];
|
|
675
675
|
|
|
676
676
|
_react.fireEvent.click(modeChangeLink, {});
|
|
677
677
|
|
|
678
678
|
changePage = container.childNodes[0].childNodes[0];
|
|
679
|
-
expect(changePage.childNodes[
|
|
679
|
+
expect(changePage.childNodes[1].textContent).toEqual('Event Mode'); // Click on radio for 'Air'
|
|
680
680
|
|
|
681
|
-
_react.fireEvent.click(changePage.childNodes[
|
|
681
|
+
_react.fireEvent.click(changePage.childNodes[2].childNodes[0].childNodes[3].childNodes[1].childNodes[0]); // Continue again to CYA page
|
|
682
682
|
|
|
683
683
|
|
|
684
|
-
continueButton = changePage.childNodes[
|
|
684
|
+
continueButton = changePage.childNodes[3].childNodes[0];
|
|
685
685
|
|
|
686
686
|
_react.fireEvent.click(continueButton, {}); //Continue on from CYA page
|
|
687
687
|
|
|
@@ -752,21 +752,21 @@ describe('components', function () {
|
|
|
752
752
|
|
|
753
753
|
newPage = container.childNodes[0].childNodes[0];
|
|
754
754
|
|
|
755
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[1], {
|
|
755
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[1], {
|
|
756
756
|
target: {
|
|
757
757
|
name: 'date-day',
|
|
758
758
|
value: '7'
|
|
759
759
|
}
|
|
760
760
|
});
|
|
761
761
|
|
|
762
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[1].childNodes[1], {
|
|
762
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[1].childNodes[0].childNodes[1], {
|
|
763
763
|
target: {
|
|
764
764
|
name: 'date-month',
|
|
765
765
|
value: '7'
|
|
766
766
|
}
|
|
767
767
|
});
|
|
768
768
|
|
|
769
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[2].childNodes[1], {
|
|
769
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[2].childNodes[0].childNodes[1], {
|
|
770
770
|
target: {
|
|
771
771
|
name: 'date-year',
|
|
772
772
|
value: '2022'
|
|
@@ -778,7 +778,7 @@ describe('components', function () {
|
|
|
778
778
|
|
|
779
779
|
newPage = container.childNodes[0].childNodes[0];
|
|
780
780
|
|
|
781
|
-
_react.fireEvent.click(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[0], {});
|
|
781
|
+
_react.fireEvent.click(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0], {});
|
|
782
782
|
|
|
783
783
|
_react.fireEvent.click(newPage.childNodes[2].childNodes[0], {}); //Continue on from CYA page
|
|
784
784
|
|
|
@@ -843,21 +843,21 @@ describe('components', function () {
|
|
|
843
843
|
|
|
844
844
|
newPage = container.childNodes[0].childNodes[0];
|
|
845
845
|
|
|
846
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[1], {
|
|
846
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[1], {
|
|
847
847
|
target: {
|
|
848
848
|
name: 'date-day',
|
|
849
849
|
value: '7'
|
|
850
850
|
}
|
|
851
851
|
});
|
|
852
852
|
|
|
853
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[1].childNodes[1], {
|
|
853
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[1].childNodes[0].childNodes[1], {
|
|
854
854
|
target: {
|
|
855
855
|
name: 'date-month',
|
|
856
856
|
value: '7'
|
|
857
857
|
}
|
|
858
858
|
});
|
|
859
859
|
|
|
860
|
-
_react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[2].childNodes[1], {
|
|
860
|
+
_react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[2].childNodes[0].childNodes[1], {
|
|
861
861
|
target: {
|
|
862
862
|
name: 'date-year',
|
|
863
863
|
value: '2022'
|
|
@@ -867,9 +867,9 @@ describe('components', function () {
|
|
|
867
867
|
_react.fireEvent.click(newPage.childNodes[2].childNodes[0], {}); // Fill second page
|
|
868
868
|
|
|
869
869
|
|
|
870
|
-
newPage = container.childNodes[0].childNodes[0];
|
|
870
|
+
newPage = container.childNodes[0].childNodes[0]; // expect(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0]).toEqual('');
|
|
871
871
|
|
|
872
|
-
_react.fireEvent.click(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[0], {});
|
|
872
|
+
_react.fireEvent.click(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0], {});
|
|
873
873
|
|
|
874
874
|
_react.fireEvent.click(newPage.childNodes[2].childNodes[0], {}); // Launch same task again
|
|
875
875
|
|
|
@@ -37,11 +37,12 @@ describe('utils.Component.get', function () {
|
|
|
37
37
|
var autocompleteWrapper = undefined;
|
|
38
38
|
var autocomplete = undefined;
|
|
39
39
|
var autocompleteInput = undefined;
|
|
40
|
-
formGroup.childNodes
|
|
40
|
+
var fieldSet = formGroup.childNodes[0];
|
|
41
|
+
fieldSet.childNodes.forEach(function (node) {
|
|
41
42
|
// Check if it's an element.
|
|
42
43
|
if (node instanceof Element) {
|
|
43
|
-
if (node.tagName === '
|
|
44
|
-
label = node;
|
|
44
|
+
if (node.tagName === 'LEGEND') {
|
|
45
|
+
label = node.childNodes[0];
|
|
45
46
|
} else if (node.classList.contains('hods-autocomplete__outer-wrapper')) {
|
|
46
47
|
autocompleteWrapper = node;
|
|
47
48
|
var autocompleteInner = node.childNodes[0];
|
|
@@ -154,7 +154,7 @@ describe('utils.Component.get', function () {
|
|
|
154
154
|
_getAllByTestId = (0, _react.getAllByTestId)(container, ID), _getAllByTestId2 = _slicedToArray(_getAllByTestId, 2), formGroup = _getAllByTestId2[0], input = _getAllByTestId2[1];
|
|
155
155
|
expect(formGroup.tagName).toEqual('DIV');
|
|
156
156
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
157
|
-
label = formGroup.childNodes[0];
|
|
157
|
+
label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
158
158
|
expect(label.tagName).toEqual('LABEL');
|
|
159
159
|
expect(label.classList).toContain('govuk-label');
|
|
160
160
|
expect(label.textContent).toContain(LABEL);
|
|
@@ -268,7 +268,7 @@ describe('utils.Component.get', function () {
|
|
|
268
268
|
|
|
269
269
|
expect(formGroup.tagName).toEqual('DIV');
|
|
270
270
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
271
|
-
var label = formGroup.childNodes[0];
|
|
271
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
272
272
|
expect(label.tagName).toEqual('LABEL');
|
|
273
273
|
expect(label.classList).toContain('govuk-label');
|
|
274
274
|
expect(label.textContent).toContain(LABEL);
|
|
@@ -60,12 +60,13 @@ describe('utils.Component.get', function () {
|
|
|
60
60
|
|
|
61
61
|
expect(formGroup.tagName).toEqual('DIV');
|
|
62
62
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
63
|
+
var fieldSet = formGroup.childNodes[0];
|
|
63
64
|
var label = undefined;
|
|
64
|
-
|
|
65
|
+
fieldSet.childNodes.forEach(function (node) {
|
|
65
66
|
// Check if it's an element.
|
|
66
67
|
if (node instanceof Element) {
|
|
67
|
-
if (node.tagName === '
|
|
68
|
-
label = node;
|
|
68
|
+
if (node.tagName === 'LEGEND') {
|
|
69
|
+
label = node.childNodes[0];
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
});
|
|
@@ -50,7 +50,7 @@ describe('utils.Component.get', function () {
|
|
|
50
50
|
|
|
51
51
|
expect(formGroup.tagName).toEqual('DIV');
|
|
52
52
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
53
|
-
var label = formGroup.childNodes[0];
|
|
53
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
54
54
|
expect(label.innerHTML).toContain(LABEL);
|
|
55
55
|
expect(label.getAttribute('for')).toEqual(ID);
|
|
56
56
|
expect(dateinput.tagName).toEqual('DIV');
|
|
@@ -59,31 +59,31 @@ describe('utils.Component.get', function () {
|
|
|
59
59
|
var dayitem = dateinput.childNodes[0];
|
|
60
60
|
expect(dayitem.tagName).toEqual('DIV');
|
|
61
61
|
expect(dayitem.classList).toContain('govuk-date-input__item');
|
|
62
|
-
var daylabel = dayitem.childNodes[0];
|
|
62
|
+
var daylabel = dayitem.childNodes[0].childNodes[0].childNodes[0];
|
|
63
63
|
expect(daylabel.tagName).toEqual('LABEL');
|
|
64
64
|
expect(daylabel.classList).toContain('govuk-label');
|
|
65
65
|
expect(daylabel.textContent).toEqual('Day');
|
|
66
|
-
var dayinput = dayitem.childNodes[1];
|
|
66
|
+
var dayinput = dayitem.childNodes[0].childNodes[1];
|
|
67
67
|
expect(dayinput.tagName).toEqual('INPUT');
|
|
68
68
|
expect(dayinput.id).toEqual("".concat(ID, "-day"));
|
|
69
69
|
var monthitem = dateinput.childNodes[1];
|
|
70
70
|
expect(monthitem.tagName).toEqual('DIV');
|
|
71
71
|
expect(monthitem.classList).toContain('govuk-date-input__item');
|
|
72
|
-
var monthlabel = monthitem.childNodes[0];
|
|
72
|
+
var monthlabel = monthitem.childNodes[0].childNodes[0].childNodes[0];
|
|
73
73
|
expect(monthlabel.tagName).toEqual('LABEL');
|
|
74
74
|
expect(monthlabel.classList).toContain('govuk-label');
|
|
75
75
|
expect(monthlabel.textContent).toEqual('Month');
|
|
76
|
-
var monthinput = monthitem.childNodes[1];
|
|
76
|
+
var monthinput = monthitem.childNodes[0].childNodes[1];
|
|
77
77
|
expect(monthinput.tagName).toEqual('INPUT');
|
|
78
78
|
expect(monthinput.id).toEqual("".concat(ID, "-month"));
|
|
79
79
|
var yearitem = dateinput.childNodes[2];
|
|
80
80
|
expect(yearitem.tagName).toEqual('DIV');
|
|
81
81
|
expect(yearitem.classList).toContain('govuk-date-input__item');
|
|
82
|
-
var yearlabel = yearitem.childNodes[0];
|
|
82
|
+
var yearlabel = yearitem.childNodes[0].childNodes[0].childNodes[0];
|
|
83
83
|
expect(yearlabel.tagName).toEqual('LABEL');
|
|
84
84
|
expect(yearlabel.classList).toContain('govuk-label');
|
|
85
85
|
expect(yearlabel.textContent).toEqual('Year');
|
|
86
|
-
var yearinput = yearitem.childNodes[1];
|
|
86
|
+
var yearinput = yearitem.childNodes[0].childNodes[1];
|
|
87
87
|
expect(yearinput.tagName).toEqual('INPUT');
|
|
88
88
|
expect(yearinput.id).toEqual("".concat(ID, "-year")); // Add something to the day and make sure it fires.
|
|
89
89
|
|
|
@@ -51,10 +51,10 @@ describe('utils.Component.get', function () {
|
|
|
51
51
|
expect(formGroup.tagName).toEqual('DIV');
|
|
52
52
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
53
53
|
var label = undefined;
|
|
54
|
-
formGroup.childNodes.forEach(function (node) {
|
|
54
|
+
formGroup.childNodes[0].childNodes.forEach(function (node) {
|
|
55
55
|
// Check if it's an element.
|
|
56
|
-
if (node instanceof Element && node.tagName === '
|
|
57
|
-
label = node;
|
|
56
|
+
if (node instanceof Element && node.tagName === 'LEGEND') {
|
|
57
|
+
label = node.childNodes[0];
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
expect(label).toBeDefined();
|
|
@@ -53,10 +53,10 @@ describe('utils.Component.get', function () {
|
|
|
53
53
|
expect(formGroup.tagName).toEqual('DIV');
|
|
54
54
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
55
55
|
var label = undefined;
|
|
56
|
-
formGroup.childNodes.forEach(function (node) {
|
|
56
|
+
formGroup.childNodes[0].childNodes.forEach(function (node) {
|
|
57
57
|
// Check if it's an element.
|
|
58
|
-
if (node instanceof Element && node.tagName === '
|
|
59
|
-
label = node;
|
|
58
|
+
if (node instanceof Element && node.tagName === 'LEGEND') {
|
|
59
|
+
label = node.childNodes[0];
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
expect(label).toBeDefined();
|
|
@@ -47,29 +47,29 @@ describe('utils.Component.get', function () {
|
|
|
47
47
|
}];
|
|
48
48
|
_renderWithValidation = (0, _setupTests.renderWithValidation)((0, _getComponent.getChildrenJsx)(PARENT_CONFIG, NESTED_CONFIG)), container = _renderWithValidation.container;
|
|
49
49
|
child = container.childNodes[0];
|
|
50
|
-
expect(child.childNodes.length).toEqual(3);
|
|
50
|
+
expect(child.childNodes[0].childNodes.length).toEqual(3);
|
|
51
51
|
expect(child.classList).toContain('govuk-form-group');
|
|
52
52
|
label = child.childNodes[0];
|
|
53
53
|
expect(label).toBeDefined();
|
|
54
54
|
expect(label.innerHTML).toContain(LABEL);
|
|
55
|
-
input = child.childNodes[2];
|
|
55
|
+
input = child.childNodes[0].childNodes[2];
|
|
56
56
|
expect(input.tagName).toEqual('INPUT');
|
|
57
57
|
expect(input.classList).toContain('govuk-input');
|
|
58
58
|
expect(input.id).toEqual(ID);
|
|
59
59
|
expect(input.value).toEqual(VALUE);
|
|
60
60
|
child2 = container.childNodes[1];
|
|
61
|
-
expect(child2.childNodes.length).toEqual(3);
|
|
61
|
+
expect(child2.childNodes[0].childNodes.length).toEqual(3);
|
|
62
62
|
expect(child2.classList).toContain('govuk-form-group');
|
|
63
63
|
label2 = child2.childNodes[0];
|
|
64
64
|
expect(label2).toBeDefined();
|
|
65
65
|
expect(label2.innerHTML).toContain(LABEL2);
|
|
66
|
-
input2 = child2.childNodes[2];
|
|
66
|
+
input2 = child2.childNodes[0].childNodes[2];
|
|
67
67
|
expect(input2.tagName).toEqual('DIV');
|
|
68
68
|
expect(input2.classList).toContain('govuk-date-input');
|
|
69
69
|
expect(input2.id).toEqual(ID2);
|
|
70
|
-
expect(input2.childNodes[0].childNodes[1].value).toEqual('1');
|
|
71
|
-
expect(input2.childNodes[1].childNodes[1].value).toEqual('2');
|
|
72
|
-
expect(input2.childNodes[2].childNodes[1].value).toEqual('2022');
|
|
70
|
+
expect(input2.childNodes[0].childNodes[0].childNodes[1].value).toEqual('1');
|
|
71
|
+
expect(input2.childNodes[1].childNodes[0].childNodes[1].value).toEqual('2');
|
|
72
|
+
expect(input2.childNodes[2].childNodes[0].childNodes[1].value).toEqual('2022');
|
|
73
73
|
|
|
74
74
|
case 35:
|
|
75
75
|
case "end":
|
|
@@ -137,12 +137,12 @@ describe('utils.Component.get', function () {
|
|
|
137
137
|
}];
|
|
138
138
|
_renderWithValidation2 = (0, _setupTests.renderWithValidation)((0, _getComponent.getChildrenJsx)(PARENT_CONFIG, NESTED_CONFIG)), container = _renderWithValidation2.container;
|
|
139
139
|
child = container.childNodes[0];
|
|
140
|
-
expect(child.childNodes.length).toEqual(3);
|
|
140
|
+
expect(child.childNodes[0].childNodes.length).toEqual(3);
|
|
141
141
|
expect(child.classList).toContain('govuk-form-group');
|
|
142
142
|
label = child.childNodes[0];
|
|
143
143
|
expect(label).toBeDefined();
|
|
144
144
|
expect(label.innerHTML).toContain(LABEL);
|
|
145
|
-
input = child.childNodes[2];
|
|
145
|
+
input = child.childNodes[0].childNodes[2];
|
|
146
146
|
expect(input.tagName).toEqual('INPUT');
|
|
147
147
|
expect(input.classList).toContain('govuk-input');
|
|
148
148
|
expect(input.id).toEqual("".concat(CONTAINER_ID, ".").concat(FIELD_ID));
|
|
@@ -180,12 +180,12 @@ describe('utils.Component.get', function () {
|
|
|
180
180
|
}];
|
|
181
181
|
_renderWithValidation3 = (0, _setupTests.renderWithValidation)((0, _getComponent.getChildrenJsx)(PARENT_CONFIG, NESTED_CONFIG)), container = _renderWithValidation3.container;
|
|
182
182
|
child = container.childNodes[0];
|
|
183
|
-
expect(child.childNodes.length).toEqual(3);
|
|
183
|
+
expect(child.childNodes[0].childNodes.length).toEqual(3);
|
|
184
184
|
expect(child.classList).toContain('govuk-form-group');
|
|
185
185
|
label = child.childNodes[0];
|
|
186
186
|
expect(label).toBeDefined();
|
|
187
187
|
expect(label.innerHTML).toContain(LABEL);
|
|
188
|
-
input = child.childNodes[2];
|
|
188
|
+
input = child.childNodes[0].childNodes[2];
|
|
189
189
|
expect(input.tagName).toEqual('INPUT');
|
|
190
190
|
expect(input.classList).toContain('govuk-input');
|
|
191
191
|
expect(input.id).toEqual("".concat(COLLECTION_ID, "[0].").concat(FIELD_ID));
|
|
@@ -51,10 +51,10 @@ describe('utils.Component.get', function () {
|
|
|
51
51
|
expect(formGroup.tagName).toEqual('DIV');
|
|
52
52
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
53
53
|
var label = undefined;
|
|
54
|
-
formGroup.childNodes.forEach(function (node) {
|
|
54
|
+
formGroup.childNodes[0].childNodes.forEach(function (node) {
|
|
55
55
|
// Check if it's an element.
|
|
56
|
-
if (node instanceof Element && node.tagName === '
|
|
57
|
-
label = node;
|
|
56
|
+
if (node instanceof Element && node.tagName === 'LEGEND') {
|
|
57
|
+
label = node.childNodes[0];
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
expect(label).toBeDefined();
|
|
@@ -61,11 +61,11 @@ describe('utils.Component.get', function () {
|
|
|
61
61
|
expect(formGroup.tagName).toEqual('DIV');
|
|
62
62
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
63
63
|
var label = undefined;
|
|
64
|
-
formGroup.childNodes.forEach(function (node) {
|
|
64
|
+
formGroup.childNodes[0].childNodes.forEach(function (node) {
|
|
65
65
|
// Check if it's an element.
|
|
66
66
|
if (node instanceof Element) {
|
|
67
|
-
if (node.tagName === '
|
|
68
|
-
label = node;
|
|
67
|
+
if (node.tagName === 'LEGEND') {
|
|
68
|
+
label = node.childNodes[0];
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
});
|
|
@@ -58,13 +58,7 @@ describe('utils.Component.get', function () {
|
|
|
58
58
|
|
|
59
59
|
expect(formGroup.tagName).toEqual('DIV');
|
|
60
60
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
61
|
-
var label =
|
|
62
|
-
formGroup.childNodes.forEach(function (node) {
|
|
63
|
-
// Check if it's an element.
|
|
64
|
-
if (node instanceof Element && node.tagName === 'LABEL') {
|
|
65
|
-
label = node;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
61
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
68
62
|
expect(label).toBeDefined();
|
|
69
63
|
expect(label.innerHTML).toContain(LABEL);
|
|
70
64
|
expect(label.getAttribute('for')).toEqual(ID);
|
|
@@ -51,10 +51,10 @@ describe('utils.Component.get', function () {
|
|
|
51
51
|
expect(formGroup.tagName).toEqual('DIV');
|
|
52
52
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
53
53
|
var label = undefined;
|
|
54
|
-
formGroup.childNodes.forEach(function (node) {
|
|
54
|
+
formGroup.childNodes[0].childNodes.forEach(function (node) {
|
|
55
55
|
// Check if it's an element.
|
|
56
|
-
if (node instanceof Element && node.tagName === '
|
|
57
|
-
label = node;
|
|
56
|
+
if (node instanceof Element && node.tagName === 'LEGEND') {
|
|
57
|
+
label = node.childNodes[0];
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
expect(label).toBeDefined();
|
|
@@ -52,7 +52,7 @@ describe('utils.Component.get', function () {
|
|
|
52
52
|
|
|
53
53
|
expect(formGroup.tagName).toEqual('DIV');
|
|
54
54
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
55
|
-
var label = formGroup.childNodes[0];
|
|
55
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
56
56
|
expect(label.innerHTML).toContain(LABEL);
|
|
57
57
|
expect(label.getAttribute('for')).toEqual(ID);
|
|
58
58
|
expect(textarea.tagName).toEqual('TEXTAREA');
|
|
@@ -50,7 +50,7 @@ describe('utils.Component.get', function () {
|
|
|
50
50
|
|
|
51
51
|
expect(formGroup.tagName).toEqual('DIV');
|
|
52
52
|
expect(formGroup.classList).toContain('govuk-form-group');
|
|
53
|
-
var label = formGroup.childNodes[0];
|
|
53
|
+
var label = formGroup.childNodes[0].childNodes[0].childNodes[0];
|
|
54
54
|
expect(label.innerHTML).toContain(LABEL);
|
|
55
55
|
expect(label.getAttribute('for')).toEqual(ID);
|
|
56
56
|
expect(timeInput.tagName).toEqual('DIV');
|
|
@@ -78,12 +78,12 @@ describe('utils.Component.get', function () {
|
|
|
78
78
|
expect(part.item.tagName).toEqual('DIV');
|
|
79
79
|
expect(part.item.classList).toContain('govuk-date-input__item');
|
|
80
80
|
|
|
81
|
-
var _part$item$childNodes = _slicedToArray(part.item.childNodes, 2),
|
|
81
|
+
var _part$item$childNodes = _slicedToArray(part.item.childNodes[0].childNodes, 2),
|
|
82
82
|
label = _part$item$childNodes[0],
|
|
83
83
|
input = _part$item$childNodes[1];
|
|
84
84
|
|
|
85
|
-
expect(label.tagName).toEqual('LABEL');
|
|
86
|
-
expect(label.classList).toContain('govuk-label');
|
|
85
|
+
expect(label.childNodes[0].tagName).toEqual('LABEL');
|
|
86
|
+
expect(label.childNodes[0].classList).toContain('govuk-label');
|
|
87
87
|
expect(label.textContent).toEqual(part.label);
|
|
88
88
|
expect(input.tagName).toEqual('INPUT');
|
|
89
89
|
expect(input.id).toEqual("".concat(ID, "-").concat(part.id)); // Put something in the input and make sure it fires.
|
|
@@ -28,7 +28,7 @@ var validateEmail = function validateEmail(value) {
|
|
|
28
28
|
|
|
29
29
|
if (typeof value === 'string') {
|
|
30
30
|
// The following is an interim fix pending a mechanism for validating against specific values
|
|
31
|
-
if (['Line manager email', 'Delegate email address'].includes(label) && value === userEmail) {
|
|
31
|
+
if (['Line manager email', 'Delegate email address'].includes(label) && value.toLowerCase() === userEmail) {
|
|
32
32
|
return "".concat(label, " cannot be the same as the user email address");
|
|
33
33
|
}
|
|
34
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.31.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.
|
|
19
|
+
"@ukhomeoffice/cop-react-components": "2.5.0",
|
|
20
20
|
"axios": "^0.23.0",
|
|
21
21
|
"dayjs": "^1.11.0",
|
|
22
22
|
"govuk-frontend": "^4.3.1",
|