@ukhomeoffice/cop-react-form-renderer 3.32.4 → 3.32.5
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.
|
@@ -17,7 +17,15 @@ var getNextHubPageId = function getNextHubPageId(action, currentPageId, pages, f
|
|
|
17
17
|
if (!currentPageId && formType === _models.FormTypes.FORM_WITH_TASK) {
|
|
18
18
|
var _formData$formStatus;
|
|
19
19
|
|
|
20
|
-
if (formData !== null && formData !== void 0 && (_formData$formStatus = formData.formStatus) !== null && _formData$formStatus !== void 0 && _formData$formStatus.
|
|
20
|
+
if (formData !== null && formData !== void 0 && (_formData$formStatus = formData.formStatus) !== null && _formData$formStatus !== void 0 && _formData$formStatus.taskPage) {
|
|
21
|
+
var currentPage = pages.find(function (page) {
|
|
22
|
+
return page.id === formData.formStatus.taskPage;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if ((currentPage === null || currentPage === void 0 ? void 0 : currentPage.type) === 'pre-task-list') {
|
|
26
|
+
return currentPage.id;
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
return _models.FormPages.HUB;
|
|
22
30
|
}
|
|
23
31
|
|
|
@@ -233,6 +233,60 @@ describe('components', function () {
|
|
|
233
233
|
fieldOne: 'valueTwo'
|
|
234
234
|
})).toEqual(FORM_WITH_TASK_PAGES[3].id);
|
|
235
235
|
});
|
|
236
|
+
it("should take the user to the hub if they saved and returned mid task", function () {
|
|
237
|
+
var EXIT_MID_TASK_PAGES = [{
|
|
238
|
+
id: 'alpha',
|
|
239
|
+
type: 'pre-task-list'
|
|
240
|
+
}, {
|
|
241
|
+
id: 'bravo',
|
|
242
|
+
type: 'pre-task-list'
|
|
243
|
+
}, {
|
|
244
|
+
id: 'charlie',
|
|
245
|
+
components: [RADIOS]
|
|
246
|
+
}, {
|
|
247
|
+
id: 'delta',
|
|
248
|
+
components: [TEXT]
|
|
249
|
+
}, {
|
|
250
|
+
id: 'echo',
|
|
251
|
+
components: [HTML]
|
|
252
|
+
}, {
|
|
253
|
+
id: 'foxtrot',
|
|
254
|
+
components: [TEXT]
|
|
255
|
+
}];
|
|
256
|
+
var EXIT_MID_TASK_DATA = {
|
|
257
|
+
formStatus: {
|
|
258
|
+
taskPage: 'charlie'
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
expect((0, _getNextPageId.default)(FORM_TYPE, EXIT_MID_TASK_PAGES, undefined, undefined, EXIT_MID_TASK_DATA)).toEqual(_models.FormPages.HUB);
|
|
262
|
+
});
|
|
263
|
+
it('should take the user to the pre task page if they saved and exited before reaching the task list', function () {
|
|
264
|
+
var EXIT_MID_TASK_PAGES = [{
|
|
265
|
+
id: 'alpha',
|
|
266
|
+
type: 'pre-task-list'
|
|
267
|
+
}, {
|
|
268
|
+
id: 'bravo',
|
|
269
|
+
type: 'pre-task-list'
|
|
270
|
+
}, {
|
|
271
|
+
id: 'charlie',
|
|
272
|
+
components: [RADIOS]
|
|
273
|
+
}, {
|
|
274
|
+
id: 'delta',
|
|
275
|
+
components: [TEXT]
|
|
276
|
+
}, {
|
|
277
|
+
id: 'echo',
|
|
278
|
+
components: [HTML]
|
|
279
|
+
}, {
|
|
280
|
+
id: 'foxtrot',
|
|
281
|
+
components: [TEXT]
|
|
282
|
+
}];
|
|
283
|
+
var EXIT_PRE_TASK_DATA = {
|
|
284
|
+
formStatus: {
|
|
285
|
+
taskPage: 'bravo'
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
expect((0, _getNextPageId.default)(FORM_TYPE, EXIT_MID_TASK_PAGES, undefined, undefined, EXIT_PRE_TASK_DATA)).toEqual('bravo');
|
|
289
|
+
});
|
|
236
290
|
});
|
|
237
291
|
});
|
|
238
292
|
});
|