@ukhomeoffice/cop-react-form-renderer 2.7.1 → 2.7.3
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.test.js +7 -7
- package/dist/components/TaskList/TaskList.js +4 -2
- package/dist/components/TaskList/TaskList.scss +11 -3
- package/dist/components/TaskList/TaskList.test.js +21 -15
- package/dist/json/groupOfRow.json +17 -38
- package/dist/json/taskList.json +18 -8
- package/dist/models/PageAction.js +2 -1
- package/dist/models/TaskStates.js +4 -4
- package/package.json +2 -2
|
@@ -581,12 +581,12 @@ describe('components', function () {
|
|
|
581
581
|
case 5:
|
|
582
582
|
taskList = container.childNodes[0].childNodes[1]; //Check status's are correct
|
|
583
583
|
|
|
584
|
-
firstTaskStatus = taskList.childNodes[
|
|
584
|
+
firstTaskStatus = taskList.childNodes[5].childNodes[0].childNodes[1];
|
|
585
585
|
expect(firstTaskStatus.textContent).toEqual(_models.TaskStates.DETAILS[_models.TaskStates.TYPES.NOT_STARTED].label);
|
|
586
|
-
secondTaskStatus = taskList.childNodes[
|
|
586
|
+
secondTaskStatus = taskList.childNodes[5].childNodes[1].childNodes[1];
|
|
587
587
|
expect(secondTaskStatus.textContent).toEqual(_models.TaskStates.DETAILS[_models.TaskStates.TYPES.CANNOT_START_YET].label); //Launch first task
|
|
588
588
|
|
|
589
|
-
firstTask = taskList.childNodes[
|
|
589
|
+
firstTask = taskList.childNodes[5].childNodes[0].childNodes[0].childNodes[0];
|
|
590
590
|
expect(firstTask.textContent).toEqual('Date, location and mode details');
|
|
591
591
|
|
|
592
592
|
_react.fireEvent.click(firstTask, {}); //Fill first page and navigate
|
|
@@ -640,9 +640,9 @@ describe('components', function () {
|
|
|
640
640
|
|
|
641
641
|
expect(container.childNodes[0].childNodes[0].textContent).toEqual('Event at the border'); //Check status's are correct
|
|
642
642
|
|
|
643
|
-
firstTaskStatus = container.childNodes[0].childNodes[1].childNodes[
|
|
643
|
+
firstTaskStatus = container.childNodes[0].childNodes[1].childNodes[5].childNodes[0].childNodes[1];
|
|
644
644
|
expect(firstTaskStatus.textContent).toEqual(_models.TaskStates.DETAILS[_models.TaskStates.TYPES.COMPLETE].label);
|
|
645
|
-
secondTaskStatus = container.childNodes[0].childNodes[1].childNodes[
|
|
645
|
+
secondTaskStatus = container.childNodes[0].childNodes[1].childNodes[5].childNodes[1].childNodes[1];
|
|
646
646
|
expect(secondTaskStatus.textContent).toEqual(_models.TaskStates.DETAILS[_models.TaskStates.TYPES.NOT_STARTED].label); //Check final data submitted to backend is as expected
|
|
647
647
|
|
|
648
648
|
finalSubmit = ON_SUBMIT_CALLS[ON_SUBMIT_CALLS.length - 1];
|
|
@@ -691,7 +691,7 @@ describe('components', function () {
|
|
|
691
691
|
case 4:
|
|
692
692
|
taskList = container.childNodes[0].childNodes[1]; //Launch first task
|
|
693
693
|
|
|
694
|
-
_react.fireEvent.click(taskList.childNodes[
|
|
694
|
+
_react.fireEvent.click(taskList.childNodes[5].childNodes[0].childNodes[0].childNodes[0], {}); //Fill first page and navigate
|
|
695
695
|
|
|
696
696
|
|
|
697
697
|
newPage = container.childNodes[0].childNodes[0];
|
|
@@ -730,7 +730,7 @@ describe('components', function () {
|
|
|
730
730
|
_react.fireEvent.click(container.childNodes[0].childNodes[0].childNodes[5].childNodes[0], {}); //Launch same task again
|
|
731
731
|
|
|
732
732
|
|
|
733
|
-
_react.fireEvent.click(container.childNodes[0].childNodes[1].childNodes[
|
|
733
|
+
_react.fireEvent.click(container.childNodes[0].childNodes[1].childNodes[5].childNodes[0].childNodes[0].childNodes[0], {}); //Should be at CYA page
|
|
734
734
|
|
|
735
735
|
|
|
736
736
|
expect(container.childNodes[0].childNodes[0].childNodes[0].textContent).toEqual('Check your answers');
|
|
@@ -68,8 +68,10 @@ var TaskList = function TaskList(_ref) {
|
|
|
68
68
|
return /*#__PURE__*/_react.default.createElement("div", _extends({}, attrs, {
|
|
69
69
|
className: classes()
|
|
70
70
|
}), /*#__PURE__*/_react.default.createElement("h2", {
|
|
71
|
-
className: "govuk-heading-s govuk-!-margin-bottom-2"
|
|
72
|
-
}, "".concat(refTitle
|
|
71
|
+
className: "hods-task-reference-description govuk-heading-s govuk-!-margin-bottom-2 govuk-!-padding-right-1"
|
|
72
|
+
}, "".concat(refTitle)), /*#__PURE__*/_react.default.createElement("h2", {
|
|
73
|
+
className: "govuk-heading-s hods-task-reference"
|
|
74
|
+
}, "".concat(refNumber)), numberOfSections !== numberOfCompleteSections && /*#__PURE__*/_react.default.createElement("h2", {
|
|
73
75
|
className: "govuk-heading-s govuk-!-margin-bottom-2"
|
|
74
76
|
}, "Incomplete form"), /*#__PURE__*/_react.default.createElement("p", {
|
|
75
77
|
className: "govuk-body govuk-!-margin-bottom-7"
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
@include govuk-responsive-margin(9, 'bottom');
|
|
16
16
|
list-style: none;
|
|
17
17
|
padding-left: 0;
|
|
18
|
-
|
|
19
|
-
padding-left: govuk-spacing(6);
|
|
20
|
-
}
|
|
18
|
+
padding-left: govuk-spacing(4);
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
|
|
@@ -54,6 +52,16 @@
|
|
|
54
52
|
}
|
|
55
53
|
}
|
|
56
54
|
|
|
55
|
+
.hods-task-reference-description{
|
|
56
|
+
@include govuk-media-query($from: 450px) {
|
|
57
|
+
float: left;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.hods-task-reference{
|
|
62
|
+
font-weight: normal;
|
|
63
|
+
}
|
|
64
|
+
|
|
57
65
|
// The `hods-task-list__task-completed` class was previously used on the task
|
|
58
66
|
// list for the completed tag (changed in 86c90ec) – it's still included here to
|
|
59
67
|
// avoid breaking task lists in existing prototypes.
|
|
@@ -57,23 +57,26 @@ describe('components', function () {
|
|
|
57
57
|
expect(container.childNodes.length).toEqual(1);
|
|
58
58
|
var referenceHeading = container.childNodes[0].childNodes[0];
|
|
59
59
|
expect(referenceHeading.tagName).toEqual('H2');
|
|
60
|
-
expect(referenceHeading.textContent).toEqual('COP reference number
|
|
61
|
-
var
|
|
60
|
+
expect(referenceHeading.textContent).toEqual('COP reference number');
|
|
61
|
+
var referenceNumber = container.childNodes[0].childNodes[1];
|
|
62
|
+
expect(referenceNumber.tagName).toEqual('H2');
|
|
63
|
+
expect(referenceNumber.textContent).toEqual('123');
|
|
64
|
+
var incompleteForm = container.childNodes[0].childNodes[2];
|
|
62
65
|
expect(incompleteForm.tagName).toEqual('H2');
|
|
63
66
|
expect(incompleteForm.textContent).toEqual('Incomplete form');
|
|
64
|
-
var numComplete = container.childNodes[0].childNodes[
|
|
67
|
+
var numComplete = container.childNodes[0].childNodes[3];
|
|
65
68
|
expect(numComplete.tagName).toEqual('P');
|
|
66
69
|
expect(numComplete.textContent).toEqual('You have completed 2 of 6 sections');
|
|
67
|
-
expect(container.childNodes[0].childNodes.length).toEqual(
|
|
68
|
-
var subSectionOneHeading = container.childNodes[0].childNodes[
|
|
70
|
+
expect(container.childNodes[0].childNodes.length).toEqual(8);
|
|
71
|
+
var subSectionOneHeading = container.childNodes[0].childNodes[4];
|
|
69
72
|
expect(subSectionOneHeading.tagName).toEqual('H2');
|
|
70
73
|
expect(subSectionOneHeading.textContent).toEqual('1. These are your tasks');
|
|
71
|
-
var subSectionOneList = container.childNodes[0].childNodes[
|
|
74
|
+
var subSectionOneList = container.childNodes[0].childNodes[5];
|
|
72
75
|
expect(subSectionOneList.childNodes.length).toEqual(3);
|
|
73
|
-
var subSectionTwoHeading = container.childNodes[0].childNodes[
|
|
76
|
+
var subSectionTwoHeading = container.childNodes[0].childNodes[6];
|
|
74
77
|
expect(subSectionTwoHeading.tagName).toEqual('H2');
|
|
75
78
|
expect(subSectionTwoHeading.textContent).toEqual('2. These are your extra bonus tasks');
|
|
76
|
-
var subSectionTwoList = container.childNodes[0].childNodes[
|
|
79
|
+
var subSectionTwoList = container.childNodes[0].childNodes[7];
|
|
77
80
|
expect(subSectionTwoList.childNodes.length).toEqual(3);
|
|
78
81
|
});
|
|
79
82
|
it('should not show incomplete form if form is complete', function () {
|
|
@@ -118,11 +121,14 @@ describe('components', function () {
|
|
|
118
121
|
})),
|
|
119
122
|
container = _render2.container;
|
|
120
123
|
|
|
121
|
-
expect(container.childNodes[0].childNodes.length).toEqual(
|
|
124
|
+
expect(container.childNodes[0].childNodes.length).toEqual(7);
|
|
122
125
|
var referenceHeading = container.childNodes[0].childNodes[0];
|
|
123
126
|
expect(referenceHeading.tagName).toEqual('H2');
|
|
124
|
-
expect(referenceHeading.textContent).toEqual('COP reference number
|
|
125
|
-
var
|
|
127
|
+
expect(referenceHeading.textContent).toEqual('COP reference number');
|
|
128
|
+
var referenceNumber = container.childNodes[0].childNodes[1];
|
|
129
|
+
expect(referenceNumber.tagName).toEqual('H2');
|
|
130
|
+
expect(referenceNumber.textContent).toEqual('123');
|
|
131
|
+
var numComplete = container.childNodes[0].childNodes[2];
|
|
126
132
|
expect(numComplete.tagName).toEqual('P');
|
|
127
133
|
expect(numComplete.textContent).toEqual('You have completed 6 of 6 sections');
|
|
128
134
|
});
|
|
@@ -153,7 +159,7 @@ describe('components', function () {
|
|
|
153
159
|
})),
|
|
154
160
|
container = _render3.container;
|
|
155
161
|
|
|
156
|
-
var subSectionOne = container.childNodes[0].childNodes[
|
|
162
|
+
var subSectionOne = container.childNodes[0].childNodes[4];
|
|
157
163
|
expect(subSectionOne.childNodes[0].textContent).toEqual('');
|
|
158
164
|
expect(subSectionOne.childNodes[1].textContent).toEqual('These are your tasks');
|
|
159
165
|
});
|
|
@@ -192,9 +198,9 @@ describe('components', function () {
|
|
|
192
198
|
})),
|
|
193
199
|
container = _render4.container;
|
|
194
200
|
|
|
195
|
-
var firstTask = container.childNodes[0].childNodes[
|
|
196
|
-
var secondTask = container.childNodes[0].childNodes[
|
|
197
|
-
var thirdTask = container.childNodes[0].childNodes[
|
|
201
|
+
var firstTask = container.childNodes[0].childNodes[5].childNodes[0].childNodes[0].childNodes[0];
|
|
202
|
+
var secondTask = container.childNodes[0].childNodes[5].childNodes[1].childNodes[0].childNodes[0];
|
|
203
|
+
var thirdTask = container.childNodes[0].childNodes[5].childNodes[2].childNodes[0].childNodes[0];
|
|
198
204
|
|
|
199
205
|
_react.fireEvent.click(firstTask.childNodes[0]);
|
|
200
206
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"id": "
|
|
2
|
+
"id": "cop-secondForm",
|
|
3
3
|
"version": "1",
|
|
4
|
-
"name": "
|
|
5
|
-
"title": "
|
|
4
|
+
"name": "cop-secondForm",
|
|
5
|
+
"title": "Cop - Second Form",
|
|
6
6
|
"type": "cya",
|
|
7
7
|
"components": [
|
|
8
8
|
{
|
|
@@ -10,20 +10,14 @@
|
|
|
10
10
|
"fieldId": "firstName",
|
|
11
11
|
"label": "First name",
|
|
12
12
|
"type": "text",
|
|
13
|
-
"readonly": false
|
|
14
|
-
"source": {
|
|
15
|
-
"field": "currentUser.givenName"
|
|
16
|
-
}
|
|
13
|
+
"readonly": false
|
|
17
14
|
},
|
|
18
15
|
{
|
|
19
16
|
"id": "surname",
|
|
20
17
|
"fieldId": "surname",
|
|
21
18
|
"label": "Last name",
|
|
22
19
|
"type": "text",
|
|
23
|
-
"readonly": false
|
|
24
|
-
"source": {
|
|
25
|
-
"field": "currentUser.familyName"
|
|
26
|
-
}
|
|
20
|
+
"readonly": false
|
|
27
21
|
},
|
|
28
22
|
{
|
|
29
23
|
"id": "dateGroup",
|
|
@@ -31,10 +25,7 @@
|
|
|
31
25
|
"label": "Date",
|
|
32
26
|
"type": "date",
|
|
33
27
|
"required": true,
|
|
34
|
-
"readonly": false
|
|
35
|
-
"source": {
|
|
36
|
-
"field": "dateGroupField"
|
|
37
|
-
}
|
|
28
|
+
"readonly": false
|
|
38
29
|
},
|
|
39
30
|
{
|
|
40
31
|
"id": "timeGroup",
|
|
@@ -42,10 +33,7 @@
|
|
|
42
33
|
"label": "Time",
|
|
43
34
|
"type": "time",
|
|
44
35
|
"required": true,
|
|
45
|
-
"readonly": false
|
|
46
|
-
"source": {
|
|
47
|
-
"field": "timeGroupField"
|
|
48
|
-
}
|
|
36
|
+
"readonly": false
|
|
49
37
|
},
|
|
50
38
|
{
|
|
51
39
|
"id": "portGroup",
|
|
@@ -53,10 +41,7 @@
|
|
|
53
41
|
"label": "Port",
|
|
54
42
|
"type": "text",
|
|
55
43
|
"required": true,
|
|
56
|
-
"readonly": false
|
|
57
|
-
"source": {
|
|
58
|
-
"field": "portGroupField"
|
|
59
|
-
}
|
|
44
|
+
"readonly": false
|
|
60
45
|
},
|
|
61
46
|
{
|
|
62
47
|
"id": "whereGroup",
|
|
@@ -64,10 +49,7 @@
|
|
|
64
49
|
"label": "Where did you see the incident take place",
|
|
65
50
|
"type": "text",
|
|
66
51
|
"required": true,
|
|
67
|
-
"readonly": false
|
|
68
|
-
"source": {
|
|
69
|
-
"field": "whereGroupField"
|
|
70
|
-
}
|
|
52
|
+
"readonly": false
|
|
71
53
|
},
|
|
72
54
|
{
|
|
73
55
|
"id": "extraDetails",
|
|
@@ -94,9 +76,7 @@
|
|
|
94
76
|
"page": "names",
|
|
95
77
|
"aria_suffix": "names"
|
|
96
78
|
},
|
|
97
|
-
"actions": [
|
|
98
|
-
"submit"
|
|
99
|
-
]
|
|
79
|
+
"actions": [ "saveAndContinue", "saveAndReturn" ]
|
|
100
80
|
},
|
|
101
81
|
{
|
|
102
82
|
"id": "dateLocDet",
|
|
@@ -120,9 +100,7 @@
|
|
|
120
100
|
"page": "dateLocDet",
|
|
121
101
|
"aria_suffix": "Date and location details"
|
|
122
102
|
},
|
|
123
|
-
"actions": [
|
|
124
|
-
"submit"
|
|
125
|
-
]
|
|
103
|
+
"actions": [ "saveAndContinue", "saveAndReturn" ]
|
|
126
104
|
},
|
|
127
105
|
{
|
|
128
106
|
"id": "additional-info",
|
|
@@ -137,14 +115,12 @@
|
|
|
137
115
|
"page": "additional-info",
|
|
138
116
|
"aria_suffix": "Additional Information"
|
|
139
117
|
},
|
|
140
|
-
"actions": [
|
|
141
|
-
"submit"
|
|
142
|
-
]
|
|
118
|
+
"actions": [ "saveAndContinue", "saveAndReturn" ]
|
|
143
119
|
}
|
|
144
120
|
],
|
|
145
121
|
"cya": {
|
|
146
|
-
"hide_page_titles":
|
|
147
|
-
"hide_actions":
|
|
122
|
+
"hide_page_titles": false,
|
|
123
|
+
"hide_actions": false,
|
|
148
124
|
"groups": [
|
|
149
125
|
{
|
|
150
126
|
"pageId": "dateLocDet"
|
|
@@ -153,6 +129,9 @@
|
|
|
153
129
|
"pageId": "names",
|
|
154
130
|
"title": "Names"
|
|
155
131
|
}
|
|
132
|
+
],
|
|
133
|
+
"actions": [
|
|
134
|
+
{ "type": "submit", "label": "Submit", "validate": true }
|
|
156
135
|
]
|
|
157
136
|
}
|
|
158
137
|
}
|
package/dist/json/taskList.json
CHANGED
|
@@ -72,8 +72,10 @@
|
|
|
72
72
|
"actions": [
|
|
73
73
|
{
|
|
74
74
|
"type": "saveAndNavigate",
|
|
75
|
-
"page": "eventMode"
|
|
76
|
-
|
|
75
|
+
"page": "eventMode",
|
|
76
|
+
"label": "Save and continue"
|
|
77
|
+
},
|
|
78
|
+
"saveAndReturn"
|
|
77
79
|
],
|
|
78
80
|
"cya_link": {
|
|
79
81
|
"page": "eventDate",
|
|
@@ -93,7 +95,8 @@
|
|
|
93
95
|
{
|
|
94
96
|
"type": "saveAndNavigate",
|
|
95
97
|
"page": "cya"
|
|
96
|
-
}
|
|
98
|
+
},
|
|
99
|
+
"saveAndReturn"
|
|
97
100
|
],
|
|
98
101
|
"cya_link": {
|
|
99
102
|
"page": "eventMode",
|
|
@@ -113,7 +116,8 @@
|
|
|
113
116
|
{
|
|
114
117
|
"type": "saveAndNavigate",
|
|
115
118
|
"page": "cya"
|
|
116
|
-
}
|
|
119
|
+
},
|
|
120
|
+
"saveAndReturn"
|
|
117
121
|
],
|
|
118
122
|
"cya_link": {
|
|
119
123
|
"page": "officeDetails",
|
|
@@ -133,7 +137,8 @@
|
|
|
133
137
|
{
|
|
134
138
|
"type": "saveAndNavigate",
|
|
135
139
|
"page": "cya"
|
|
136
|
-
}
|
|
140
|
+
},
|
|
141
|
+
"saveAndReturn"
|
|
137
142
|
],
|
|
138
143
|
"cya_link": {
|
|
139
144
|
"page": "immigrationDate",
|
|
@@ -153,7 +158,8 @@
|
|
|
153
158
|
{
|
|
154
159
|
"type": "saveAndNavigate",
|
|
155
160
|
"page": "surname"
|
|
156
|
-
}
|
|
161
|
+
},
|
|
162
|
+
"saveAndReturn"
|
|
157
163
|
],
|
|
158
164
|
"cya_link": {
|
|
159
165
|
"page": "firstName",
|
|
@@ -173,7 +179,8 @@
|
|
|
173
179
|
{
|
|
174
180
|
"type": "saveAndNavigate",
|
|
175
181
|
"page": "cya"
|
|
176
|
-
}
|
|
182
|
+
},
|
|
183
|
+
"saveAndReturn"
|
|
177
184
|
],
|
|
178
185
|
"cya_link": {
|
|
179
186
|
"page": "surname",
|
|
@@ -223,6 +230,9 @@
|
|
|
223
230
|
]
|
|
224
231
|
},
|
|
225
232
|
"cya": {
|
|
226
|
-
"hide_page_titles": false
|
|
233
|
+
"hide_page_titles": false,
|
|
234
|
+
"actions": [
|
|
235
|
+
{ "type": "saveAndContinue", "label": "save cont", "validate": true }
|
|
236
|
+
]
|
|
227
237
|
}
|
|
228
238
|
}
|
|
@@ -28,7 +28,8 @@ var DefaultPageActions = (_DefaultPageActions = {}, _defineProperty(_DefaultPage
|
|
|
28
28
|
label: 'Save and continue'
|
|
29
29
|
}), _defineProperty(_DefaultPageActions, TYPE_SAVE_AND_NAVIGATE, {
|
|
30
30
|
type: TYPE_SAVE_AND_NAVIGATE,
|
|
31
|
-
validate: true
|
|
31
|
+
validate: true,
|
|
32
|
+
label: 'Save and continue'
|
|
32
33
|
}), _defineProperty(_DefaultPageActions, TYPE_SAVE_AND_RETURN, {
|
|
33
34
|
type: TYPE_SAVE_AND_RETURN,
|
|
34
35
|
validate: false,
|
|
@@ -22,16 +22,16 @@ var StateTypes = {
|
|
|
22
22
|
exports.StateTypes = StateTypes;
|
|
23
23
|
var StateDetails = (_StateDetails = {}, _defineProperty(_StateDetails, TYPE_COMPLETE, {
|
|
24
24
|
label: 'Completed',
|
|
25
|
-
colour: ''
|
|
25
|
+
colour: 'dark-blue'
|
|
26
26
|
}), _defineProperty(_StateDetails, TYPE_IN_PROGRESS, {
|
|
27
27
|
label: 'In Progress',
|
|
28
|
-
colour: '
|
|
28
|
+
colour: 'white'
|
|
29
29
|
}), _defineProperty(_StateDetails, TYPE_NOT_STARTED, {
|
|
30
30
|
label: 'Not Started',
|
|
31
|
-
colour: 'grey'
|
|
31
|
+
colour: 'dark-grey'
|
|
32
32
|
}), _defineProperty(_StateDetails, TYPE_CANNOT_START_YET, {
|
|
33
33
|
label: 'Cannot Start Yet',
|
|
34
|
-
colour: 'grey'
|
|
34
|
+
colour: 'dark-grey'
|
|
35
35
|
}), _StateDetails);
|
|
36
36
|
var TaskStates = {
|
|
37
37
|
TYPES: StateTypes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.3",
|
|
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.5.1",
|
|
20
20
|
"axios": "^0.21.1",
|
|
21
21
|
"dayjs": "^1.11.0",
|
|
22
22
|
"govuk-frontend": "^3.13.0",
|