@ukhomeoffice/cop-react-form-renderer 4.28.0 → 4.29.0-beta

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.
Files changed (30) hide show
  1. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +23 -5
  2. package/dist/components/CollectionPage/CollectionPage.test.js +9 -9
  3. package/dist/components/FormComponent/Collection.test.js +7 -7
  4. package/dist/components/FormComponent/Container.test.js +14 -14
  5. package/dist/components/FormComponent/FormComponent.test.js +6 -6
  6. package/dist/components/FormPage/FormPage.js +6 -1
  7. package/dist/components/FormPage/FormPage.test.js +8 -8
  8. package/dist/components/FormRenderer/FormRenderer.js +64 -7
  9. package/dist/components/FormRenderer/FormRenderer.test.js +71 -13
  10. package/dist/components/FormRenderer/handlers/navigate.js +2 -2
  11. package/dist/json/multiQuestionTaskList.json +275 -0
  12. package/dist/json/multiQuestionTaskListData.json +39 -0
  13. package/dist/models/PageAction.js +7 -1
  14. package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +4 -3
  15. package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +2 -2
  16. package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +4 -3
  17. package/dist/utils/Component/getComponentTests/getComponent.date.test.js +7 -7
  18. package/dist/utils/Component/getComponentTests/getComponent.email.test.js +3 -3
  19. package/dist/utils/Component/getComponentTests/getComponent.file.test.js +3 -3
  20. package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +11 -11
  21. package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +3 -3
  22. package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +3 -3
  23. package/dist/utils/Component/getComponentTests/getComponent.select.test.js +1 -7
  24. package/dist/utils/Component/getComponentTests/getComponent.text.test.js +3 -3
  25. package/dist/utils/Component/getComponentTests/getComponent.textarea.test.js +1 -1
  26. package/dist/utils/Component/getComponentTests/getComponent.time.test.js +4 -4
  27. package/dist/utils/Validate/validateComponent.js +3 -2
  28. package/dist/utils/Validate/validateEmail.js +9 -1
  29. package/dist/utils/Validate/validateEmail.test.js +8 -0
  30. package/package.json +2 -2
@@ -36,6 +36,10 @@ var _taskList = _interopRequireDefault(require("../../json/taskList.json"));
36
36
 
37
37
  var _firstForm = _interopRequireDefault(require("../../json/firstForm.json"));
38
38
 
39
+ var _multiQuestionTaskListData = _interopRequireDefault(require("../../json/multiQuestionTaskListData.json"));
40
+
41
+ var _multiQuestionTaskList = _interopRequireDefault(require("../../json/multiQuestionTaskList.json"));
42
+
39
43
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
40
44
 
41
45
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -634,21 +638,21 @@ describe('components', function () {
634
638
  newPage = container.childNodes[0].childNodes[0];
635
639
  expect(newPage.childNodes[0].textContent).toEqual('Event Date');
636
640
 
637
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[1], {
641
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[1], {
638
642
  target: {
639
643
  name: 'date-day',
640
644
  value: '7'
641
645
  }
642
646
  });
643
647
 
644
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[1].childNodes[1], {
648
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[1].childNodes[0].childNodes[1], {
645
649
  target: {
646
650
  name: 'date-month',
647
651
  value: '7'
648
652
  }
649
653
  });
650
654
 
651
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[2].childNodes[1], {
655
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[2].childNodes[0].childNodes[1], {
652
656
  target: {
653
657
  name: 'date-year',
654
658
  value: '2022'
@@ -663,7 +667,7 @@ describe('components', function () {
663
667
  newPage = container.childNodes[0].childNodes[0];
664
668
  expect(newPage.childNodes[0].textContent).toEqual('Event Mode');
665
669
 
666
- _react.fireEvent.click(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[0], {});
670
+ _react.fireEvent.click(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0], {});
667
671
 
668
672
  continueButton = newPage.childNodes[2].childNodes[0];
669
673
 
@@ -678,7 +682,7 @@ describe('components', function () {
678
682
  changePage = container.childNodes[0].childNodes[0];
679
683
  expect(changePage.childNodes[0].textContent).toEqual('Event Mode'); // Click on radio for 'Air'
680
684
 
681
- _react.fireEvent.click(changePage.childNodes[1].childNodes[2].childNodes[1].childNodes[0], {}); // Continue again to CYA page
685
+ _react.fireEvent.click(changePage.childNodes[1].childNodes[0].childNodes[2].childNodes[1].childNodes[0], {}); // Continue again to CYA page
682
686
 
683
687
 
684
688
  continueButton = changePage.childNodes[2].childNodes[0];
@@ -752,21 +756,21 @@ describe('components', function () {
752
756
 
753
757
  newPage = container.childNodes[0].childNodes[0];
754
758
 
755
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[1], {
759
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[1], {
756
760
  target: {
757
761
  name: 'date-day',
758
762
  value: '7'
759
763
  }
760
764
  });
761
765
 
762
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[1].childNodes[1], {
766
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[1].childNodes[0].childNodes[1], {
763
767
  target: {
764
768
  name: 'date-month',
765
769
  value: '7'
766
770
  }
767
771
  });
768
772
 
769
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[2].childNodes[1], {
773
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[2].childNodes[0].childNodes[1], {
770
774
  target: {
771
775
  name: 'date-year',
772
776
  value: '2022'
@@ -778,7 +782,7 @@ describe('components', function () {
778
782
 
779
783
  newPage = container.childNodes[0].childNodes[0];
780
784
 
781
- _react.fireEvent.click(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[0], {});
785
+ _react.fireEvent.click(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0], {});
782
786
 
783
787
  _react.fireEvent.click(newPage.childNodes[2].childNodes[0], {}); //Continue on from CYA page
784
788
 
@@ -843,21 +847,21 @@ describe('components', function () {
843
847
 
844
848
  newPage = container.childNodes[0].childNodes[0];
845
849
 
846
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[1], {
850
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0].childNodes[1], {
847
851
  target: {
848
852
  name: 'date-day',
849
853
  value: '7'
850
854
  }
851
855
  });
852
856
 
853
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[1].childNodes[1], {
857
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[1].childNodes[0].childNodes[1], {
854
858
  target: {
855
859
  name: 'date-month',
856
860
  value: '7'
857
861
  }
858
862
  });
859
863
 
860
- _react.fireEvent.change(newPage.childNodes[1].childNodes[2].childNodes[2].childNodes[1], {
864
+ _react.fireEvent.change(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[2].childNodes[0].childNodes[1], {
861
865
  target: {
862
866
  name: 'date-year',
863
867
  value: '2022'
@@ -869,7 +873,7 @@ describe('components', function () {
869
873
 
870
874
  newPage = container.childNodes[0].childNodes[0];
871
875
 
872
- _react.fireEvent.click(newPage.childNodes[1].childNodes[2].childNodes[0].childNodes[0], {});
876
+ _react.fireEvent.click(newPage.childNodes[1].childNodes[0].childNodes[2].childNodes[0].childNodes[0], {});
873
877
 
874
878
  _react.fireEvent.click(newPage.childNodes[2].childNodes[0], {}); // Launch same task again
875
879
 
@@ -1002,5 +1006,59 @@ describe('components', function () {
1002
1006
  }
1003
1007
  }, _callee28);
1004
1008
  })));
1009
+ it('should display CYSA page when resuming an in-progress form, with Action buttons replaced with a single Continue button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30() {
1010
+ var ON_SUBMIT, HOOKS, taskList;
1011
+ return regeneratorRuntime.wrap(function _callee30$(_context30) {
1012
+ while (1) {
1013
+ switch (_context30.prev = _context30.next) {
1014
+ case 0:
1015
+ ON_SUBMIT = function ON_SUBMIT(type, payload, onSuccess, onError) {
1016
+ onSuccess();
1017
+ };
1018
+
1019
+ HOOKS = {
1020
+ onSubmit: ON_SUBMIT
1021
+ };
1022
+ _context30.next = 4;
1023
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29() {
1024
+ return regeneratorRuntime.wrap(function _callee29$(_context29) {
1025
+ while (1) {
1026
+ switch (_context29.prev = _context29.next) {
1027
+ case 0:
1028
+ (0, _reactDom.render)( /*#__PURE__*/_react2.default.createElement(_FormRenderer.default, _extends({}, _multiQuestionTaskList.default, {
1029
+ data: _multiQuestionTaskListData.default,
1030
+ hooks: HOOKS
1031
+ })), container);
1032
+
1033
+ case 1:
1034
+ case "end":
1035
+ return _context29.stop();
1036
+ }
1037
+ }
1038
+ }, _callee29);
1039
+ })));
1040
+
1041
+ case 4:
1042
+ taskList = container.childNodes[0].childNodes[1]; //Resume the first task
1043
+
1044
+ _react.fireEvent.click(taskList.childNodes[5].childNodes[1].childNodes[0].childNodes[0], {}); // Verify the correct title has been rendered, and the Action buttons have been changed to Continue Only
1045
+
1046
+
1047
+ expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Check your saved answers');
1048
+ expect(container.childNodes[0].childNodes[0].childNodes[5].childNodes[0].childNodes[0].textContent).toEqual('Continue'); // Click Continue
1049
+
1050
+ _react.fireEvent.click(container.childNodes[0].childNodes[0].childNodes[5].childNodes[0].childNodes[0], {}); // Verify that Save & Continue / Save and Return Later buttons are restored on the next screen
1051
+
1052
+
1053
+ expect(container.childNodes[0].childNodes[0].childNodes[6].childNodes[0].textContent).toEqual('Save and continue');
1054
+ expect(container.childNodes[0].childNodes[0].childNodes[6].childNodes[1].textContent).toEqual('Save and return later');
1055
+
1056
+ case 11:
1057
+ case "end":
1058
+ return _context30.stop();
1059
+ }
1060
+ }
1061
+ }, _callee30);
1062
+ })));
1005
1063
  });
1006
1064
  });
@@ -16,11 +16,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
16
16
  * @param {string} currentPageId The current pageId.
17
17
  * @param {Function} onNavigate The handler to call if the pageId is different to the currentPageId.
18
18
  */
19
- var navigate = function navigate(action, currentPageId, onNavigate) {
19
+ var navigate = function navigate(action, currentPageId, onNavigate, state) {
20
20
  var pageId = (0, _getPageId.default)(action, currentPageId);
21
21
 
22
22
  if (pageId !== currentPageId) {
23
- onNavigate(pageId);
23
+ onNavigate(pageId, state);
24
24
  }
25
25
  };
26
26
 
@@ -0,0 +1,275 @@
1
+ {
2
+ "id": "cop-multiTaskList",
3
+ "cya": {
4
+ "actions": [
5
+ { "type": "saveAndContinue", "label": "save cont", "validate": true }
6
+ ],
7
+ "hide_page_titles": false
8
+ },
9
+ "hub": {
10
+ "format": "CYA",
11
+ "refTitle": "COP reference number",
12
+ "sections": [
13
+ {
14
+ "name": "Add passenger details",
15
+ "tasks": [
16
+ {
17
+ "name": "Passenger 1",
18
+ "pages": ["officer", "p1Name", "p1details"],
19
+ "state": "complete"
20
+ },
21
+ {
22
+ "name": "Passenger 2",
23
+ "pages": ["relationship", "p2Name", "p2details"],
24
+ "state": "inProgress"
25
+ }
26
+ ]
27
+ },
28
+ {
29
+ "name": "Submit form",
30
+ "tasks": [
31
+ {
32
+ "name": "Accept and submit",
33
+ "pages": ["submitForm"],
34
+ "state": "inProgress"
35
+ }
36
+ ]
37
+ }
38
+ ]
39
+ },
40
+ "name": "cop-multiTaskList",
41
+ "type": "task-list",
42
+ "pages": [
43
+ {
44
+ "id": "officer",
45
+ "name": "officer",
46
+ "title": "Officer Details",
47
+ "actions": [
48
+ { "page": "p1Name", "type": "saveAndNavigate" },
49
+ "saveAndReturn"
50
+ ],
51
+ "cya_link": { "page": "officer", "aria_suffix": "Officer Details" },
52
+ "components": [{ "use": "officerName" }]
53
+ },
54
+ {
55
+ "id": "p1Name",
56
+ "name": "p1Name",
57
+ "title": "Passenger 1 Names",
58
+ "actions": [
59
+ { "page": "p1details", "type": "saveAndNavigate" },
60
+ "saveAndReturn"
61
+ ],
62
+ "cya_link": { "page": "p1Name", "aria_suffix": "Passenger 1 name" },
63
+ "components": [
64
+ { "use": "passenger1firstname" },
65
+ { "use": "passenger1surname" }
66
+ ]
67
+ },
68
+ {
69
+ "id": "p1details",
70
+ "name": "p1details",
71
+ "title": "Passenger 1 Details",
72
+ "actions": [
73
+ { "page": "cya", "type": "saveAndNavigate" },
74
+ "saveAndReturn"
75
+ ],
76
+ "cya_link": { "page": "p1details", "aria_suffix": "Passenger 1 Details" },
77
+ "components": [
78
+ { "use": "dateofarrivalp1" },
79
+ { "use": "dateofdeparturep1" },
80
+ { "use": "doesp1havevisa" },
81
+ { "use": "p1flightNo" },
82
+ { "use": "p1extraDetails" }
83
+ ]
84
+ },
85
+ {
86
+ "id": "relationship",
87
+ "name": "relationship",
88
+ "title": "Passenger relationship",
89
+ "actions": [
90
+ { "page": "p2Name", "type": "saveAndNavigate" },
91
+ "saveAndReturn"
92
+ ],
93
+ "cya_link": {
94
+ "page": "relationship",
95
+ "aria_suffix": "Passenger Relationship"
96
+ },
97
+ "components": [{ "use": "p2relationship" }]
98
+ },
99
+ {
100
+ "id": "p2Name",
101
+ "name": "p2Name",
102
+ "title": "Passenger 2 Names",
103
+ "actions": [
104
+ { "page": "p2details", "type": "saveAndNavigate" },
105
+ "saveAndReturn"
106
+ ],
107
+ "cya_link": { "page": "p2Name", "aria_suffix": "Passenger 2 name" },
108
+ "components": [
109
+ { "use": "passenger2firstname" },
110
+ { "use": "passenger2surname" }
111
+ ]
112
+ },
113
+ {
114
+ "id": "p2details",
115
+ "name": "p2details",
116
+ "title": "Passenger 2 Details",
117
+ "actions": [
118
+ { "page": "cya", "type": "saveAndNavigate" },
119
+ "saveAndReturn"
120
+ ],
121
+ "cya_link": { "page": "p2details", "aria_suffix": "Passenger 2 Details" },
122
+ "components": [
123
+ { "use": "dateofarrivalp2" },
124
+ { "use": "dateofdeparturep2" },
125
+ { "use": "doesp2havevisa" },
126
+ { "use": "p2flightNo" },
127
+ { "use": "p2extraDetails" }
128
+ ]
129
+ },
130
+ {
131
+ "id": "submitForm",
132
+ "name": "submitForm",
133
+ "title": "Submit",
134
+ "actions": [
135
+ { "type": "submit", "label": "Submit", "validate": true },
136
+ "saveAndReturn"
137
+ ],
138
+ "components": []
139
+ }
140
+ ],
141
+ "title": "Task List Multi Question Form",
142
+ "version": "1",
143
+ "components": [
144
+ {
145
+ "id": "officerName",
146
+ "type": "text",
147
+ "label": "Officer name",
148
+ "fieldId": "officerName",
149
+ "required": true
150
+ },
151
+ {
152
+ "id": "passenger1firstname",
153
+ "type": "text",
154
+ "label": "Passenger 1 first name",
155
+ "fieldId": "passenger1firstname",
156
+ "required": true
157
+ },
158
+ {
159
+ "id": "passenger1surname",
160
+ "type": "text",
161
+ "label": "Passenger 1 last name",
162
+ "fieldId": "passenger1surname",
163
+ "required": true
164
+ },
165
+ {
166
+ "id": "dateofarrivalp1",
167
+ "type": "date",
168
+ "label": "Date of Arrival for passenger 1",
169
+ "fieldId": "dateofarrivalp1",
170
+ "required": true
171
+ },
172
+ {
173
+ "id": "dateofdeparturep1",
174
+ "type": "date",
175
+ "label": "Date of Departure for passenger 1",
176
+ "fieldId": "dateofdeparturep1",
177
+ "required": true
178
+ },
179
+ {
180
+ "id": "doesp1havevisa",
181
+ "data": {
182
+ "options": [
183
+ { "label": "Yes, passenger 1 has a valid visa", "value": "yes" },
184
+ {
185
+ "label": "No, passenger 1 does not have a valid visa",
186
+ "value": "no"
187
+ }
188
+ ]
189
+ },
190
+ "type": "radios",
191
+ "label": "Valid visa",
192
+ "fieldId": "doesp1havevisa",
193
+ "required": true
194
+ },
195
+ {
196
+ "id": "p1flightNo",
197
+ "type": "text",
198
+ "label": "Passenger 1 outbound flight number",
199
+ "fieldId": "p1flightNo",
200
+ "required": true
201
+ },
202
+ {
203
+ "id": "p2relationship",
204
+ "type": "text",
205
+ "label": "What is the relationship of passenger 2 to passenger 1",
206
+ "fieldId": "p2relationship",
207
+ "required": true
208
+ },
209
+ {
210
+ "id": "p1extraDetails",
211
+ "type": "textarea",
212
+ "label": "Enter any extra details about journey for passenger 1",
213
+ "fieldId": "p1extraDetails",
214
+ "required": true
215
+ },
216
+ {
217
+ "id": "passenger2firstname",
218
+ "type": "text",
219
+ "label": "Passenger 2 first name",
220
+ "fieldId": "passenger2firstname",
221
+ "required": true
222
+ },
223
+ {
224
+ "id": "passenger2surname",
225
+ "type": "text",
226
+ "label": "Passenger 2 last name",
227
+ "fieldId": "passenger2surname",
228
+ "required": true
229
+ },
230
+ {
231
+ "id": "dateofarrivalp2",
232
+ "type": "date",
233
+ "label": "Date of Arrival for passenger 2",
234
+ "fieldId": "dateofarrivalp2",
235
+ "required": true
236
+ },
237
+ {
238
+ "id": "dateofdeparturep2",
239
+ "type": "date",
240
+ "label": "Date of Departure for passenger 2",
241
+ "fieldId": "dateofdeparturep2",
242
+ "required": true
243
+ },
244
+ {
245
+ "id": "doesp2havevisa",
246
+ "data": {
247
+ "options": [
248
+ { "label": "Yes, passenger 2 has a valid visa", "value": "yes" },
249
+ {
250
+ "label": "No, passenger 2 does not have a valid visa",
251
+ "value": "no"
252
+ }
253
+ ]
254
+ },
255
+ "type": "radios",
256
+ "label": "Valid visa",
257
+ "fieldId": "doesp2havevisa",
258
+ "required": true
259
+ },
260
+ {
261
+ "id": "p2flightNo",
262
+ "type": "text",
263
+ "label": "Passenger 2 outbound flight number",
264
+ "fieldId": "p2flightNo",
265
+ "required": true
266
+ },
267
+ {
268
+ "id": "p2extraDetails",
269
+ "type": "textarea",
270
+ "label": "Enter any extra details about journey for passenger 2",
271
+ "fieldId": "p2extraDetails",
272
+ "required": true
273
+ }
274
+ ]
275
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "id": "695735b6-7187-11ed-a74f-4a1f833894ff",
3
+ "businessKey": "DEV-20221201-1250",
4
+ "officerName": "Bob Smith",
5
+ "formStatus": {
6
+ "tasks": {
7
+ "Passenger 1": { "complete": false, "currentPage": "p1details" }
8
+ },
9
+ "taskPage": "p1details"
10
+ },
11
+ "links": [
12
+ {
13
+ "method": "GET",
14
+ "href": "https://workflow-service-green.dev.cop.homeoffice.gov.uk/camunda/engine-rest/process-instance/695735b6-7187-11ed-a74f-4a1f833894ff",
15
+ "rel": "self"
16
+ }
17
+ ],
18
+ "definitionId": "cop-multiTaskList:2:04acd47e-6a95-11ed-89dc-8e447b30f638",
19
+ "caseInstanceId": null,
20
+ "ended": false,
21
+ "suspended": false,
22
+ "tenantId": null,
23
+ "passenger1firstname": "James",
24
+ "passenger1surname": "Jones",
25
+ "dateofarrivalp1": "1-1-2022",
26
+ "dateofdeparturep1": "3-2-2022",
27
+ "doesp1havevisa": "yes",
28
+ "p1flightNo": "564131946",
29
+ "p1extraDetails": "N/A",
30
+ "form": {
31
+ "formId": "cop-multiTaskList",
32
+ "formVersionId": "1",
33
+ "title": "Task List Multi Question Form",
34
+ "name": "cop-multiTaskList",
35
+ "submissionDate": "2022-12-01T14:50:58.363Z",
36
+ "submittedBy": "james.bowers@digital.homeoffice.gov.uk",
37
+ "draftForm": true
38
+ }
39
+ }
@@ -14,6 +14,7 @@ var TYPE_COLLECTION_ADD = 'collectionAdd';
14
14
  var TYPE_COLLECTION_DUPLICATE = 'collectionDuplicate';
15
15
  var TYPE_COLLECTION_REMOVE = 'collectionRemove';
16
16
  var TYPE_NAVIGATE = 'navigate';
17
+ var TYPE_CONTINUE = 'continue';
17
18
  var TYPE_SAVE_AND_CONTINUE = 'saveAndContinue';
18
19
  var TYPE_SAVE_AND_NAVIGATE = 'saveAndNavigate';
19
20
  var TYPE_SAVE_AND_RETURN = 'saveAndReturn';
@@ -24,6 +25,7 @@ var PageActionTypes = {
24
25
  COLLECTION_DUPLICATE: TYPE_COLLECTION_DUPLICATE,
25
26
  COLLECTION_REMOVE: TYPE_COLLECTION_REMOVE,
26
27
  NAVIGATE: TYPE_NAVIGATE,
28
+ CONTINUE: TYPE_CONTINUE,
27
29
  SAVE_AND_CONTINUE: TYPE_SAVE_AND_CONTINUE,
28
30
  SAVE_AND_NAVIGATE: TYPE_SAVE_AND_NAVIGATE,
29
31
  SAVE_AND_RETURN: TYPE_SAVE_AND_RETURN,
@@ -35,7 +37,11 @@ var DefaultPageActions = (_DefaultPageActions = {}, _defineProperty(_DefaultPage
35
37
  validate: false,
36
38
  label: 'Cancel',
37
39
  classModifiers: 'secondary'
38
- }), _defineProperty(_DefaultPageActions, TYPE_COLLECTION_ADD, undefined), _defineProperty(_DefaultPageActions, TYPE_COLLECTION_DUPLICATE, undefined), _defineProperty(_DefaultPageActions, TYPE_COLLECTION_REMOVE, undefined), _defineProperty(_DefaultPageActions, TYPE_NAVIGATE, undefined), _defineProperty(_DefaultPageActions, TYPE_SAVE_AND_CONTINUE, {
40
+ }), _defineProperty(_DefaultPageActions, TYPE_COLLECTION_ADD, undefined), _defineProperty(_DefaultPageActions, TYPE_COLLECTION_DUPLICATE, undefined), _defineProperty(_DefaultPageActions, TYPE_COLLECTION_REMOVE, undefined), _defineProperty(_DefaultPageActions, TYPE_NAVIGATE, undefined), _defineProperty(_DefaultPageActions, TYPE_CONTINUE, {
41
+ type: TYPE_CONTINUE,
42
+ validate: true,
43
+ label: 'Continue'
44
+ }), _defineProperty(_DefaultPageActions, TYPE_SAVE_AND_CONTINUE, {
39
45
  type: TYPE_SAVE_AND_CONTINUE,
40
46
  validate: true,
41
47
  label: 'Save and continue'
@@ -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.forEach(function (node) {
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 === 'LABEL') {
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
- formGroup.childNodes.forEach(function (node) {
65
+ fieldSet.childNodes.forEach(function (node) {
65
66
  // Check if it's an element.
66
67
  if (node instanceof Element) {
67
- if (node.tagName === 'LABEL') {
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 === 'LABEL') {
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 === 'LABEL') {
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();