@ukhomeoffice/cop-react-form-renderer 3.16.1-alpha → 3.17.2
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/FormRenderer/FormRenderer.js +1 -1
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +1 -1
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +1 -1
- package/dist/models/FormTypes.js +7 -5
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +6 -6
- package/dist/utils/Hub/getFormHub.js +1 -1
- package/package.json +2 -2
|
@@ -437,7 +437,7 @@ FormRenderer.propTypes = InternalFormRenderer.propTypes = {
|
|
|
437
437
|
title: _propTypes.default.string,
|
|
438
438
|
|
|
439
439
|
/** See <a href="/?path=/docs/f-json--page#formtypes">FormTypes</a>. */
|
|
440
|
-
type: _propTypes.default.oneOf([_models.FormTypes.CYA, _models.FormTypes.FORM, _models.FormTypes.HUB, _models.FormTypes.TASK, _models.FormTypes.WIZARD, _models.FormTypes.
|
|
440
|
+
type: _propTypes.default.oneOf([_models.FormTypes.CYA, _models.FormTypes.FORM, _models.FormTypes.HUB, _models.FormTypes.TASK, _models.FormTypes.WIZARD, _models.FormTypes.TASK_CYA, _models.FormTypes.FORM_WITH_TASK]).isRequired,
|
|
441
441
|
components: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
442
442
|
pages: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
443
443
|
hub: _propTypes.default.object,
|
|
@@ -12,7 +12,7 @@ var _getNextPageId = _interopRequireDefault(require("./getNextPageId"));
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
13
|
|
|
14
14
|
var getSubmissionStatus = function getSubmissionStatus(formType, pages, currentPageId, action, formData, currentTask, isCompleted) {
|
|
15
|
-
if (formType === _models.FormTypes.TASK) {
|
|
15
|
+
if (formType === _models.FormTypes.TASK || formType === _models.FormTypes.FORM_WITH_TASK) {
|
|
16
16
|
var formStatus = formData.formStatus || {};
|
|
17
17
|
formStatus.tasks = formStatus.tasks || {};
|
|
18
18
|
formStatus.tasks[currentTask.name] = formStatus.tasks[currentTask.name] || {};
|
|
@@ -103,7 +103,7 @@ describe('components', function () {
|
|
|
103
103
|
});
|
|
104
104
|
describe("when the action type is '".concat(_models.PageAction.TYPES.SAVE_AND_RETURN, "'"), function () {
|
|
105
105
|
Object.values(_models.FormTypes).forEach(function (formType) {
|
|
106
|
-
if (formType !== _models.FormTypes.TASK) {
|
|
106
|
+
if (formType !== _models.FormTypes.TASK && formType !== _models.FormTypes.FORM_WITH_TASK) {
|
|
107
107
|
it("should return the current page if the form type is '".concat(formType, "'"), function () {
|
|
108
108
|
var ACTION = _models.PageAction.DEFAULTS.saveAndReturn;
|
|
109
109
|
expect((0, _getSubmissionStatus.default)(formType, PAGES, PAGES[0].id, ACTION, FORM_DATA)).toMatchObject({
|
package/dist/models/FormTypes.js
CHANGED
|
@@ -4,19 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var TYPE_FORM = 'form';
|
|
8
7
|
var TYPE_CHECK_YOUR_ANSWERS = 'cya';
|
|
8
|
+
var TYPE_FORM = 'form';
|
|
9
|
+
var TYPE_FORM_WITH_TASK_LIST = 'form-with-task-list';
|
|
9
10
|
var TYPE_HUB_AND_SPOKE = 'hub-and-spoke';
|
|
10
11
|
var TYPE_TASK_LIST = 'task-list';
|
|
11
|
-
var TYPE_WIZARD = 'wizard';
|
|
12
12
|
var TYPE_TASK_LIST_CYA = 'task-list-cya';
|
|
13
|
+
var TYPE_WIZARD = 'wizard';
|
|
13
14
|
var FormTypes = {
|
|
14
|
-
FORM: TYPE_FORM,
|
|
15
15
|
CYA: TYPE_CHECK_YOUR_ANSWERS,
|
|
16
|
+
FORM: TYPE_FORM,
|
|
17
|
+
FORM_WITH_TASK: TYPE_FORM_WITH_TASK_LIST,
|
|
16
18
|
HUB: TYPE_HUB_AND_SPOKE,
|
|
17
19
|
TASK: TYPE_TASK_LIST,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
TASK_CYA: TYPE_TASK_LIST_CYA,
|
|
21
|
+
WIZARD: TYPE_WIZARD
|
|
20
22
|
};
|
|
21
23
|
var _default = FormTypes;
|
|
22
24
|
exports.default = _default;
|
|
@@ -102,8 +102,8 @@ describe('utils.Component.get', function () {
|
|
|
102
102
|
_react.fireEvent.click(checkboxItems[0].childNodes[0]); // alpha
|
|
103
103
|
|
|
104
104
|
|
|
105
|
-
expect(ON_CHANGE_CALLS.length).toEqual(
|
|
106
|
-
expect(ON_CHANGE_CALLS[
|
|
105
|
+
expect(ON_CHANGE_CALLS.length).toEqual(1);
|
|
106
|
+
expect(ON_CHANGE_CALLS[0]).toMatchObject({
|
|
107
107
|
name: FIELD_ID,
|
|
108
108
|
value: [OPTIONS[0].value]
|
|
109
109
|
});
|
|
@@ -111,8 +111,8 @@ describe('utils.Component.get', function () {
|
|
|
111
111
|
_react.fireEvent.click(checkboxItems[1].childNodes[0]); // beta
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
expect(ON_CHANGE_CALLS.length).toEqual(
|
|
115
|
-
expect(ON_CHANGE_CALLS[
|
|
114
|
+
expect(ON_CHANGE_CALLS.length).toEqual(2);
|
|
115
|
+
expect(ON_CHANGE_CALLS[1]).toMatchObject({
|
|
116
116
|
name: FIELD_ID,
|
|
117
117
|
value: [OPTIONS[0].value, OPTIONS[1].value]
|
|
118
118
|
});
|
|
@@ -120,8 +120,8 @@ describe('utils.Component.get', function () {
|
|
|
120
120
|
_react.fireEvent.click(checkboxItems[0].childNodes[0]); // alpha (unchecked this time)
|
|
121
121
|
|
|
122
122
|
|
|
123
|
-
expect(ON_CHANGE_CALLS.length).toEqual(
|
|
124
|
-
expect(ON_CHANGE_CALLS[
|
|
123
|
+
expect(ON_CHANGE_CALLS.length).toEqual(3);
|
|
124
|
+
expect(ON_CHANGE_CALLS[2]).toMatchObject({
|
|
125
125
|
name: FIELD_ID,
|
|
126
126
|
value: [OPTIONS[1].value]
|
|
127
127
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.2",
|
|
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": "1.
|
|
19
|
+
"@ukhomeoffice/cop-react-components": "1.13.1",
|
|
20
20
|
"axios": "^0.23.0",
|
|
21
21
|
"dayjs": "^1.11.0",
|
|
22
22
|
"govuk-frontend": "^3.13.0",
|