@ukhomeoffice/cop-react-form-renderer 2.7.4 → 2.8.1
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/CheckYourAnswers/CheckYourAnswers.stories.mdx +392 -331
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +66 -7
- package/dist/components/FormRenderer/FormRenderer.test.js +7 -7
- package/dist/components/TaskList/TaskList.js +3 -3
- package/dist/components/TaskList/TaskList.scss +0 -3
- package/dist/json/group.data.json +21 -0
- package/dist/json/group.json +418 -0
- package/dist/json/userProfile.data.json +6 -0
- package/dist/utils/CheckYourAnswers/getCYARow.js +1 -0
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +2 -0
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +82 -0
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +78 -0
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +29 -3
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +61 -0
- package/package.json +1 -1
|
@@ -22,6 +22,10 @@ var _userProfileData = _interopRequireDefault(require("../../json/userProfile.da
|
|
|
22
22
|
|
|
23
23
|
var _userProfile = _interopRequireDefault(require("../../json/userProfile.json"));
|
|
24
24
|
|
|
25
|
+
var _groupData = _interopRequireDefault(require("../../json/group.data.json"));
|
|
26
|
+
|
|
27
|
+
var _group = _interopRequireDefault(require("../../json/group.json"));
|
|
28
|
+
|
|
25
29
|
var _groupOfRow = _interopRequireDefault(require("../../json/groupOfRow.json"));
|
|
26
30
|
|
|
27
31
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
@@ -378,14 +382,15 @@ describe('components', function () {
|
|
|
378
382
|
}
|
|
379
383
|
}, _callee12);
|
|
380
384
|
})));
|
|
381
|
-
it('
|
|
382
|
-
var GROUP_PAGES, cya,
|
|
385
|
+
it('Show answers from multiple address fields into in one DL', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14() {
|
|
386
|
+
var DATA, GROUP_PAGES, cya, groupedComponent, keyGroup, valueGroup, changeButtonDiv, changeButton;
|
|
383
387
|
return regeneratorRuntime.wrap(function _callee14$(_context14) {
|
|
384
388
|
while (1) {
|
|
385
389
|
switch (_context14.prev = _context14.next) {
|
|
386
390
|
case 0:
|
|
387
|
-
|
|
388
|
-
|
|
391
|
+
DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
|
|
392
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, DATA));
|
|
393
|
+
_context14.next = 4;
|
|
389
394
|
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13() {
|
|
390
395
|
return regeneratorRuntime.wrap(function _callee13$(_context13) {
|
|
391
396
|
while (1) {
|
|
@@ -395,7 +400,7 @@ describe('components', function () {
|
|
|
395
400
|
pages: GROUP_PAGES,
|
|
396
401
|
onRowAction: ON_ROW_ACTION,
|
|
397
402
|
onAction: ON_ACTION,
|
|
398
|
-
|
|
403
|
+
hide_title: true
|
|
399
404
|
}), container);
|
|
400
405
|
|
|
401
406
|
case 1:
|
|
@@ -406,6 +411,60 @@ describe('components', function () {
|
|
|
406
411
|
}, _callee13);
|
|
407
412
|
})));
|
|
408
413
|
|
|
414
|
+
case 4:
|
|
415
|
+
cya = checkCYA(container);
|
|
416
|
+
groupedComponent = cya.childNodes[10];
|
|
417
|
+
keyGroup = groupedComponent.childNodes[0].childNodes[0].childNodes[0];
|
|
418
|
+
expect(keyGroup.tagName).toEqual('DT');
|
|
419
|
+
expect(keyGroup.textContent).toEqual('Address details (optional)');
|
|
420
|
+
valueGroup = groupedComponent.childNodes[0].childNodes[0].childNodes[1];
|
|
421
|
+
expect(valueGroup.childNodes.length).toEqual(4);
|
|
422
|
+
expect(valueGroup.tagName).toEqual('DD');
|
|
423
|
+
expect(valueGroup.childNodes[0].textContent).toContain('10 Downing Street');
|
|
424
|
+
expect(valueGroup.childNodes[1].textContent).toContain('City of Westminster');
|
|
425
|
+
expect(valueGroup.childNodes[2].textContent).toContain('London');
|
|
426
|
+
expect(valueGroup.childNodes[3].textContent).toContain('SW1A 2AA');
|
|
427
|
+
changeButtonDiv = groupedComponent.childNodes[0].childNodes[0].childNodes[2];
|
|
428
|
+
expect(changeButtonDiv.classList).toContain('govuk-summary-list__actions');
|
|
429
|
+
changeButton = changeButtonDiv.childNodes[0];
|
|
430
|
+
expect(changeButton.tagName).toEqual('A');
|
|
431
|
+
expect(changeButton.textContent).toEqual('Change address details');
|
|
432
|
+
|
|
433
|
+
case 21:
|
|
434
|
+
case "end":
|
|
435
|
+
return _context14.stop();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}, _callee14);
|
|
439
|
+
})));
|
|
440
|
+
it('should render a group with one action button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16() {
|
|
441
|
+
var GROUP_PAGES, cya, namesGroup, firstNameRow, surname, changeButtonDiv, changeButton;
|
|
442
|
+
return regeneratorRuntime.wrap(function _callee16$(_context16) {
|
|
443
|
+
while (1) {
|
|
444
|
+
switch (_context16.prev = _context16.next) {
|
|
445
|
+
case 0:
|
|
446
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
|
|
447
|
+
_context16.next = 3;
|
|
448
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15() {
|
|
449
|
+
return regeneratorRuntime.wrap(function _callee15$(_context15) {
|
|
450
|
+
while (1) {
|
|
451
|
+
switch (_context15.prev = _context15.next) {
|
|
452
|
+
case 0:
|
|
453
|
+
(0, _reactDom.render)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
454
|
+
pages: GROUP_PAGES,
|
|
455
|
+
onRowAction: ON_ROW_ACTION,
|
|
456
|
+
onAction: ON_ACTION,
|
|
457
|
+
groups: _groupOfRow.default.cya.groups
|
|
458
|
+
}), container);
|
|
459
|
+
|
|
460
|
+
case 1:
|
|
461
|
+
case "end":
|
|
462
|
+
return _context15.stop();
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}, _callee15);
|
|
466
|
+
})));
|
|
467
|
+
|
|
409
468
|
case 3:
|
|
410
469
|
cya = checkCYA(container);
|
|
411
470
|
namesGroup = cya.childNodes[2];
|
|
@@ -429,10 +488,10 @@ describe('components', function () {
|
|
|
429
488
|
|
|
430
489
|
case 22:
|
|
431
490
|
case "end":
|
|
432
|
-
return
|
|
491
|
+
return _context16.stop();
|
|
433
492
|
}
|
|
434
493
|
}
|
|
435
|
-
},
|
|
494
|
+
}, _callee16);
|
|
436
495
|
})));
|
|
437
496
|
});
|
|
438
497
|
});
|
|
@@ -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[3].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[3].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[3].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('Task List Form'); //Check status's are correct
|
|
642
642
|
|
|
643
|
-
firstTaskStatus = container.childNodes[0].childNodes[1].childNodes[
|
|
643
|
+
firstTaskStatus = container.childNodes[0].childNodes[1].childNodes[3].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[3].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[3].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[3].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');
|
|
@@ -67,11 +67,11 @@ var TaskList = function TaskList(_ref) {
|
|
|
67
67
|
|
|
68
68
|
return /*#__PURE__*/_react.default.createElement("div", _extends({}, attrs, {
|
|
69
69
|
className: classes()
|
|
70
|
-
}), /*#__PURE__*/_react.default.createElement("h2", {
|
|
70
|
+
}), refNumber && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("h2", {
|
|
71
71
|
className: "hods-task-reference-description govuk-heading-s govuk-!-margin-bottom-2 govuk-!-padding-right-1"
|
|
72
72
|
}, "".concat(refTitle)), /*#__PURE__*/_react.default.createElement("h2", {
|
|
73
|
-
className: "govuk-heading-s
|
|
74
|
-
}, "".concat(refNumber)), numberOfSections !== numberOfCompleteSections && /*#__PURE__*/_react.default.createElement("h2", {
|
|
73
|
+
className: "govuk-heading-s govuk-!-font-weight-regular"
|
|
74
|
+
}, "".concat(refNumber))), numberOfSections !== numberOfCompleteSections && /*#__PURE__*/_react.default.createElement("h2", {
|
|
75
75
|
className: "govuk-heading-s govuk-!-margin-bottom-2"
|
|
76
76
|
}, "Incomplete form"), /*#__PURE__*/_react.default.createElement("p", {
|
|
77
77
|
className: "govuk-body govuk-!-margin-bottom-7"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"urls": {
|
|
3
|
+
"refData": "/ref-data"
|
|
4
|
+
},
|
|
5
|
+
"currentUser": {
|
|
6
|
+
"givenName": "John",
|
|
7
|
+
"familyName": "Smith"
|
|
8
|
+
},
|
|
9
|
+
"areYouACivilServant": "yes",
|
|
10
|
+
"userDetails": {
|
|
11
|
+
"linemanagerEmail": "line.manager@digital.homeoffice.gov.uk",
|
|
12
|
+
"delegateEmails": "del.egate@digital.homeoffice.gov.uk"
|
|
13
|
+
},
|
|
14
|
+
"addressDetails": {
|
|
15
|
+
"firstLineOfTheAddress": "10 Downing Street",
|
|
16
|
+
"city": "London",
|
|
17
|
+
"town": "City of Westminster",
|
|
18
|
+
"postCode": "SW1A 2AA"
|
|
19
|
+
},
|
|
20
|
+
"businessKey": "123456789"
|
|
21
|
+
}
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "userProfile",
|
|
3
|
+
"version": "1",
|
|
4
|
+
"name": "userProfile",
|
|
5
|
+
"title": "Your profile",
|
|
6
|
+
"type": "hub-and-spoke",
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"id": "firstName",
|
|
10
|
+
"fieldId": "firstName",
|
|
11
|
+
"label": "First name",
|
|
12
|
+
"type": "input",
|
|
13
|
+
"readonly": true,
|
|
14
|
+
"groupId": "addressDetails",
|
|
15
|
+
"source": {
|
|
16
|
+
"field": "currentUser.givenName"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"id": "surname",
|
|
21
|
+
"fieldId": "surname",
|
|
22
|
+
"label": "Last name",
|
|
23
|
+
"type": "text",
|
|
24
|
+
"readonly": true,
|
|
25
|
+
"groupId": "addressDetails",
|
|
26
|
+
"source": {
|
|
27
|
+
"field": "currentUser.familyName"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "areYouACivilServant",
|
|
32
|
+
"fieldId": "areYouACivilServant",
|
|
33
|
+
"label": "Are you a civil servant?",
|
|
34
|
+
"type": "radios",
|
|
35
|
+
"required": true,
|
|
36
|
+
"groupId": "addressDetails",
|
|
37
|
+
"data": {
|
|
38
|
+
"url": "${urls.refData}/areYouACivilServant"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"id": "staffGradeId",
|
|
43
|
+
"fieldId": "staffGradeId",
|
|
44
|
+
"label": "Grade",
|
|
45
|
+
"hint": "We use this to assign you tasks",
|
|
46
|
+
"type": "radios",
|
|
47
|
+
"required": true,
|
|
48
|
+
"data": {
|
|
49
|
+
"url": "${urls.refData}/grade"
|
|
50
|
+
},
|
|
51
|
+
"source": {
|
|
52
|
+
"field": "userDetails.gradeid"
|
|
53
|
+
},
|
|
54
|
+
"show_when": {
|
|
55
|
+
"field": "areYouACivilServant",
|
|
56
|
+
"op": "eq",
|
|
57
|
+
"value": "yes"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"id": "team",
|
|
62
|
+
"fieldId": "team",
|
|
63
|
+
"label": "Team",
|
|
64
|
+
"hint": "We use this to assign you tasks",
|
|
65
|
+
"type": "autocomplete",
|
|
66
|
+
"required": true,
|
|
67
|
+
"item": {
|
|
68
|
+
"value": "id",
|
|
69
|
+
"label": "name"
|
|
70
|
+
},
|
|
71
|
+
"data": {
|
|
72
|
+
"url": "${urls.refData}/team"
|
|
73
|
+
},
|
|
74
|
+
"displayMenu": "inline",
|
|
75
|
+
"source": {
|
|
76
|
+
"field": "userDetails.defaultteam"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "linemanagerEmail",
|
|
81
|
+
"fieldId": "linemanagerEmail",
|
|
82
|
+
"label": "Line manager email",
|
|
83
|
+
"hint": "Must be a homeoffice.gov.uk or digital.homeoffice.gov.uk address",
|
|
84
|
+
"type": "email",
|
|
85
|
+
"format": {
|
|
86
|
+
"type": "lowercase",
|
|
87
|
+
"on": "submit"
|
|
88
|
+
},
|
|
89
|
+
"required": true,
|
|
90
|
+
"source": {
|
|
91
|
+
"field": "userDetails.linemanagerEmail"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"id": "delegateEmails",
|
|
96
|
+
"fieldId": "delegateEmails",
|
|
97
|
+
"label": "Delegate email",
|
|
98
|
+
"hint": "Must be a homeoffice.gov.uk or digital.homeoffice.gov.uk address",
|
|
99
|
+
"type": "email",
|
|
100
|
+
"format": {
|
|
101
|
+
"type": "lowercase",
|
|
102
|
+
"on": "submit"
|
|
103
|
+
},
|
|
104
|
+
"required": true,
|
|
105
|
+
"source": {
|
|
106
|
+
"field": "userDetails.delegateEmails"
|
|
107
|
+
},
|
|
108
|
+
"show_when": [
|
|
109
|
+
{
|
|
110
|
+
"field": "areYouACivilServant",
|
|
111
|
+
"op": "eq",
|
|
112
|
+
"value": "yes"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"field": "staffGradeId",
|
|
116
|
+
"op": "in",
|
|
117
|
+
"values": [
|
|
118
|
+
"373979c1-2360-46be-b712-0409ac068059",
|
|
119
|
+
"36c80dfe-0aae-455b-9445-2e1c09dcafdc",
|
|
120
|
+
"1b041cda-b151-4769-b76a-d42d67b0b960",
|
|
121
|
+
"172de41d-f7b0-4be9-b7e8-0cf4f1a1342f",
|
|
122
|
+
"39e18b45-0358-4a45-83ec-5a70b74641e8"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
]
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"id": "firstLineOfTheAddress",
|
|
129
|
+
"fieldId": "firstLineOfTheAddress",
|
|
130
|
+
"label": "Address",
|
|
131
|
+
"type": "text",
|
|
132
|
+
"required": true,
|
|
133
|
+
"groupId": "addressDetails",
|
|
134
|
+
"custom_errors": [
|
|
135
|
+
{
|
|
136
|
+
"type": "required",
|
|
137
|
+
"message": "Please enter first line of the the address"
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
"source": {
|
|
141
|
+
"field": "addressDetails.firstLineOfTheAddress"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "city",
|
|
146
|
+
"fieldId": "city",
|
|
147
|
+
"label": "City",
|
|
148
|
+
"type": "text",
|
|
149
|
+
"required": true,
|
|
150
|
+
"groupId": "addressDetails",
|
|
151
|
+
"custom_errors": [
|
|
152
|
+
{
|
|
153
|
+
"type": "required",
|
|
154
|
+
"message": "Please enter city"
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"source": {
|
|
158
|
+
"field": "addressDetails.city"
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": "town",
|
|
163
|
+
"fieldId": "town",
|
|
164
|
+
"label": "Town",
|
|
165
|
+
"type": "text",
|
|
166
|
+
"required": true,
|
|
167
|
+
|
|
168
|
+
"custom_errors": [
|
|
169
|
+
{
|
|
170
|
+
"type": "required",
|
|
171
|
+
"message": "Please enter Town"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"source": {
|
|
175
|
+
"field": "addressDetails.town"
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"id": "postCode",
|
|
180
|
+
"fieldId": "postCode",
|
|
181
|
+
"label": "Postcode",
|
|
182
|
+
"type": "text",
|
|
183
|
+
"required": true,
|
|
184
|
+
"groupId": "addressDetails",
|
|
185
|
+
"custom_errors": [
|
|
186
|
+
{
|
|
187
|
+
"type": "required",
|
|
188
|
+
"message": "Please enter postcode"
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"source": {
|
|
192
|
+
"field": "addressDetails.postCode"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "postCode",
|
|
197
|
+
"fieldId": "postCode",
|
|
198
|
+
"label": "Postcode",
|
|
199
|
+
"type": "text",
|
|
200
|
+
"required": true,
|
|
201
|
+
"groupId": "addressDetails",
|
|
202
|
+
"custom_errors": [
|
|
203
|
+
{
|
|
204
|
+
"type": "required",
|
|
205
|
+
"message": "Please enter postcode"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"source": {
|
|
209
|
+
"field": "addressDetails.postCode"
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
],
|
|
213
|
+
"pages": [
|
|
214
|
+
{
|
|
215
|
+
"id": "names",
|
|
216
|
+
"name": "names",
|
|
217
|
+
"components": [
|
|
218
|
+
{
|
|
219
|
+
"use": "firstName"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"use": "surname"
|
|
223
|
+
}
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"id": "civil-servant-status",
|
|
228
|
+
"name": "civil-servant-status",
|
|
229
|
+
"title": "Are you a civil servant?",
|
|
230
|
+
"components": [
|
|
231
|
+
{
|
|
232
|
+
"use": "areYouACivilServant",
|
|
233
|
+
"label": ""
|
|
234
|
+
}
|
|
235
|
+
],
|
|
236
|
+
"actions": ["submit"],
|
|
237
|
+
"cya_link": {
|
|
238
|
+
"page": "civil-servant-status",
|
|
239
|
+
"aria_suffix": "civil servant status"
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"id": "grade",
|
|
244
|
+
"name": "grade",
|
|
245
|
+
"title": "What's your grade?",
|
|
246
|
+
"components": [
|
|
247
|
+
{
|
|
248
|
+
"use": "staffGradeId",
|
|
249
|
+
"label": ""
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
"actions": ["submit"],
|
|
253
|
+
"cya_link": {
|
|
254
|
+
"page": "grade",
|
|
255
|
+
"aria_suffix": "grade"
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"id": "team-name",
|
|
260
|
+
"name": "team-name",
|
|
261
|
+
"title": "What's your team name?",
|
|
262
|
+
"components": [
|
|
263
|
+
{
|
|
264
|
+
"use": "team",
|
|
265
|
+
"label": ""
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
"actions": ["submit"],
|
|
269
|
+
"cya_link": {
|
|
270
|
+
"page": "team-name",
|
|
271
|
+
"aria_suffix": "teams"
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"id": "add-or-change-line-manager",
|
|
276
|
+
"name": "add-or-change-line-manager",
|
|
277
|
+
"title": "Add or change a line manager",
|
|
278
|
+
"components": [
|
|
279
|
+
"Your line manager will need to review some of your forms. It’s important to keep their details up-to-date.",
|
|
280
|
+
"An email will be sent to your line manager to ask if they want to approve your request to add them.",
|
|
281
|
+
{
|
|
282
|
+
"type": "inset-text",
|
|
283
|
+
"content": "The changes will show in your profile when they approve your request."
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"type": "heading",
|
|
287
|
+
"size": "m",
|
|
288
|
+
"content": "Mandatory declarations"
|
|
289
|
+
},
|
|
290
|
+
"Mandatory declarations will not go to your line manager until they have approved your request."
|
|
291
|
+
],
|
|
292
|
+
"actions": [
|
|
293
|
+
{
|
|
294
|
+
"type": "navigate",
|
|
295
|
+
"page": "line-manager-email"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"show_on_cya": false
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"id": "line-manager-email",
|
|
302
|
+
"name": "line-manager-email",
|
|
303
|
+
"title": "What’s your line manager’s email address?",
|
|
304
|
+
"components": [
|
|
305
|
+
{
|
|
306
|
+
"use": "linemanagerEmail"
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"actions": ["submit"],
|
|
310
|
+
"cya_link": {
|
|
311
|
+
"page": "add-or-change-line-manager",
|
|
312
|
+
"aria_suffix": "line manager email address"
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"id": "add-or-change-delegate",
|
|
317
|
+
"name": "add-or-change-delegate",
|
|
318
|
+
"title": "Add or change a delegate",
|
|
319
|
+
"components": [
|
|
320
|
+
"A delegate can review a mandatory declaration on your behalf.",
|
|
321
|
+
"An email will be sent to the delegate to ask if they want to approve your request.",
|
|
322
|
+
{
|
|
323
|
+
"type": "inset-text",
|
|
324
|
+
"content": "The changes will show in your profile when they approve your request."
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
"actions": [
|
|
328
|
+
{
|
|
329
|
+
"type": "navigate",
|
|
330
|
+
"page": "delegate-email"
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"show_on_cya": false
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
"id": "delegate-email",
|
|
337
|
+
"name": "delegate-email",
|
|
338
|
+
"title": "What’s your delegate's email address?",
|
|
339
|
+
"components": [
|
|
340
|
+
{
|
|
341
|
+
"use": "delegateEmails",
|
|
342
|
+
"label": "Delegate email address"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"use": "delegateEmails",
|
|
346
|
+
"label": "Delegate email address"
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"actions": ["submit"],
|
|
350
|
+
"cya_link": {
|
|
351
|
+
"page": "add-or-change-delegate"
|
|
352
|
+
},
|
|
353
|
+
"show_when": [
|
|
354
|
+
{
|
|
355
|
+
"field": "areYouACivilServant",
|
|
356
|
+
"op": "eq",
|
|
357
|
+
"value": "yes"
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
"field": "staffGradeId",
|
|
361
|
+
"op": "in",
|
|
362
|
+
"values": [
|
|
363
|
+
"373979c1-2360-46be-b712-0409ac068059",
|
|
364
|
+
"36c80dfe-0aae-455b-9445-2e1c09dcafdc",
|
|
365
|
+
"1b041cda-b151-4769-b76a-d42d67b0b960",
|
|
366
|
+
"172de41d-f7b0-4be9-b7e8-0cf4f1a1342f",
|
|
367
|
+
"39e18b45-0358-4a45-83ec-5a70b74641e8"
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
]
|
|
371
|
+
},
|
|
372
|
+
|
|
373
|
+
{
|
|
374
|
+
"id": "address-details",
|
|
375
|
+
"groupLabel": "UK address",
|
|
376
|
+
"fieldId": "UK address",
|
|
377
|
+
"groups": [
|
|
378
|
+
{
|
|
379
|
+
"id": "address",
|
|
380
|
+
"label": "Address details",
|
|
381
|
+
"components": ["firstLineOfTheAddress", "town", "city", "postCode"]
|
|
382
|
+
}
|
|
383
|
+
],
|
|
384
|
+
"name": "address-details",
|
|
385
|
+
"title": "Address details",
|
|
386
|
+
"components": [
|
|
387
|
+
{
|
|
388
|
+
"use": "firstLineOfTheAddress",
|
|
389
|
+
"label": "Address"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"use": "town",
|
|
393
|
+
"label": "Town"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"use": "city",
|
|
397
|
+
"label": "City"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"use": "postCode",
|
|
401
|
+
"label": "Postcode"
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"actions": ["saveAndContinue", "saveAndReturn"],
|
|
405
|
+
"cya_link": {
|
|
406
|
+
"url": "/address-details",
|
|
407
|
+
"aria_suffix": "address details"
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
],
|
|
411
|
+
"hub": {
|
|
412
|
+
"format": "CYA"
|
|
413
|
+
},
|
|
414
|
+
"cya": {
|
|
415
|
+
"hide_page_titles": true,
|
|
416
|
+
"hide_actions": true
|
|
417
|
+
}
|
|
418
|
+
}
|
|
@@ -11,5 +11,11 @@
|
|
|
11
11
|
"linemanagerEmail": "line.manager@digital.homeoffice.gov.uk",
|
|
12
12
|
"delegateEmails": "del.egate@digital.homeoffice.gov.uk"
|
|
13
13
|
},
|
|
14
|
+
"addressDetails": {
|
|
15
|
+
"firstLineOfTheAddress": "10 Downing Street",
|
|
16
|
+
"city": "London",
|
|
17
|
+
"town": "City of Westminster",
|
|
18
|
+
"postCode": "SW1A 2AA"
|
|
19
|
+
},
|
|
14
20
|
"businessKey": "123456789"
|
|
15
21
|
}
|
|
@@ -31,6 +31,7 @@ var getCYARow = function getCYARow(page, component, onAction) {
|
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
33
|
pageId: page.id,
|
|
34
|
+
id: component.id,
|
|
34
35
|
fieldId: component.fieldId,
|
|
35
36
|
key: component.label || component.cya_label,
|
|
36
37
|
component: _Component.default.editable(component) ? component : undefined,
|
|
@@ -58,6 +58,7 @@ describe('utils', function () {
|
|
|
58
58
|
|
|
59
59
|
expect((0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION)).toEqual({
|
|
60
60
|
pageId: PAGE.id,
|
|
61
|
+
id: COMPONENT.id,
|
|
61
62
|
fieldId: COMPONENT.fieldId,
|
|
62
63
|
key: COMPONENT.label,
|
|
63
64
|
value: '',
|
|
@@ -84,6 +85,7 @@ describe('utils', function () {
|
|
|
84
85
|
|
|
85
86
|
expect((0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION)).toEqual({
|
|
86
87
|
pageId: PAGE.id,
|
|
88
|
+
id: COMPONENT.id,
|
|
87
89
|
fieldId: COMPONENT.fieldId,
|
|
88
90
|
key: COMPONENT.label,
|
|
89
91
|
value: 'BLAH',
|