@ukhomeoffice/cop-react-form-renderer 3.17.0 → 3.18.0

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.
@@ -229,15 +229,15 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
229
229
  if (hubDetails !== null && hubDetails !== void 0 && hubDetails.sections) {
230
230
  var _data$formStatus2;
231
231
 
232
- var tasks = data !== null && data !== void 0 && (_data$formStatus2 = data.formStatus) !== null && _data$formStatus2 !== void 0 && _data$formStatus2.tasks ? data.formStatus.tasks : {};
232
+ var tasks = (data === null || data === void 0 ? void 0 : (_data$formStatus2 = data.formStatus) === null || _data$formStatus2 === void 0 ? void 0 : _data$formStatus2.tasks) || {};
233
233
 
234
- var updatedSections = _helpers.default.getUpdatedSectionStates(hubDetails.sections, tasks);
234
+ var updatedSections = _helpers.default.getUpdatedSectionStates(hubDetails.sections, tasks, hubDetails.nonSequential);
235
235
 
236
236
  setHubDetails(function (prev) {
237
237
  return _objectSpread(_objectSpread({}, prev), updatedSections);
238
238
  });
239
239
  }
240
- }, [currentTask.fullPages, data, hubDetails === null || hubDetails === void 0 ? void 0 : hubDetails.sections]);
240
+ }, [currentTask.fullPages, data, hubDetails === null || hubDetails === void 0 ? void 0 : hubDetails.sections, hubDetails === null || hubDetails === void 0 ? void 0 : hubDetails.nonSequential]);
241
241
 
242
242
  var onPageChange = function onPageChange(newPageId) {
243
243
  clearErrors();
@@ -7,6 +7,28 @@ exports.default = void 0;
7
7
 
8
8
  var _models = require("../../../models");
9
9
 
10
+ var getCurrentTaskState = function getCurrentTaskState(_ref, defaultState) {
11
+ var complete = _ref.complete,
12
+ currentPage = _ref.currentPage;
13
+
14
+ if (complete) {
15
+ return _models.TaskStates.TYPES.COMPLETE;
16
+ }
17
+
18
+ if (currentPage) {
19
+ return _models.TaskStates.TYPES.IN_PROGRESS;
20
+ }
21
+
22
+ return defaultState;
23
+ };
24
+
25
+ var allDependentTasksComplete = function allDependentTasksComplete(tasks, mustBeComplete) {
26
+ return mustBeComplete.reduce(function (allComplete, taskName) {
27
+ var _tasks$taskName;
28
+
29
+ return allComplete && ((_tasks$taskName = tasks[taskName]) === null || _tasks$taskName === void 0 ? void 0 : _tasks$taskName.complete);
30
+ }, true);
31
+ };
10
32
  /**
11
33
  * Updates the given task list sections with the latest states
12
34
  * @param {object} sections The JSON defining the sections in the task list
@@ -19,15 +41,13 @@ var _models = require("../../../models");
19
41
  }
20
42
  * @returns An JSON representation of the task list sections with up to date states
21
43
  */
22
- var getUpdatedSectionStates = function getUpdatedSectionStates(sections, tasks) {
44
+
45
+
46
+ var getUpdatedSequentialStates = function getUpdatedSequentialStates(sections, tasks) {
23
47
  return sections.map(function (section, sectionIndex, sectionArray) {
24
48
  return section.tasks.map(function (task, taskIndex, taskArray) {
25
49
  if (tasks[task.name]) {
26
- if (tasks[task.name].complete) {
27
- task.state = _models.TaskStates.TYPES.COMPLETE;
28
- } else if (tasks[task.name].currentPage) {
29
- task.state = _models.TaskStates.TYPES.IN_PROGRESS;
30
- }
50
+ task.state = getCurrentTaskState(tasks[task.name], task.state);
31
51
  } else {
32
52
  var _taskArray, _sectionArray, _sectionArray$tasks$s;
33
53
 
@@ -46,5 +66,31 @@ var getUpdatedSectionStates = function getUpdatedSectionStates(sections, tasks)
46
66
  });
47
67
  };
48
68
 
69
+ var getUpdatedNonSequentialStates = function getUpdatedNonSequentialStates(sections, tasks) {
70
+ return sections.map(function (section) {
71
+ return section.tasks.map(function (task) {
72
+ if (tasks[task.name]) {
73
+ task.state = getCurrentTaskState(tasks[task.name], task.state);
74
+ } else if (task.depends_on && !allDependentTasksComplete(tasks, task.depends_on)) {
75
+ task.state = _models.TaskStates.TYPES.CANNOT_START_YET;
76
+ } else {
77
+ task.state = _models.TaskStates.TYPES.NOT_STARTED;
78
+ }
79
+
80
+ return task;
81
+ });
82
+ });
83
+ };
84
+
85
+ var getUpdatedSectionStates = function getUpdatedSectionStates(sections, tasks) {
86
+ var nonSequential = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
87
+
88
+ if (nonSequential === true) {
89
+ return getUpdatedNonSequentialStates(sections, tasks);
90
+ }
91
+
92
+ return getUpdatedSequentialStates(sections, tasks);
93
+ };
94
+
49
95
  var _default = getUpdatedSectionStates;
50
96
  exports.default = _default;
@@ -7,116 +7,174 @@ var _models = require("../../../models");
7
7
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
8
 
9
9
  // Local imports
10
- describe('components', function () {
11
- describe('FormRenderer', function () {
12
- describe('helpers', function () {
13
- describe('getUpdatedSectionStates', function () {
14
- it("should set all tasks to '".concat(_models.TaskStates.TYPES.CANNOT_START_YET, "' excluding the first which should be '").concat(_models.TaskStates.TYPES.NOT_STARTED, "'"), function () {
15
- var SECTIONS = [{
16
- name: 'Add event details',
17
- tasks: [{
18
- name: 'Date, location and mode details',
19
- pages: ['eventDate', 'eventMode']
20
- }, {
21
- name: 'Officer and agency details',
22
- pages: ['officeDetails']
23
- }]
24
- }, {
25
- name: 'Add people details',
26
- tasks: [{
27
- name: 'People details',
28
- pages: ['firstName', 'surname']
29
- }, {
30
- name: 'Immigration details',
31
- pages: ['immigrationDate']
32
- }, {
33
- name: 'Journey details',
34
- pages: ['journeyDetails']
35
- }]
36
- }];
37
- var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, {});
38
- expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED);
39
- expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
40
- expect(updatedSections[1][0].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
41
- expect(updatedSections[1][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
42
- expect(updatedSections[1][2].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
43
- });
44
- it("should set tasks after any '".concat(_models.TaskStates.TYPES.COMPLETE, "' ones to '").concat(_models.TaskStates.TYPES.NOT_STARTED, "'"), function () {
45
- var SECTIONS = [{
46
- name: 'Add event details',
47
- tasks: [{
48
- name: 'Date, location and mode details',
49
- pages: ['eventDate', 'eventMode']
50
- }, {
51
- name: 'Officer and agency details',
52
- pages: ['officeDetails']
53
- }]
54
- }];
55
- var TASKS = {
56
- 'Date, location and mode details': {
57
- complete: true
58
- }
59
- };
60
- var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, TASKS);
61
- expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.COMPLETE);
62
- expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED);
63
- });
64
- it("should set tasks after any '".concat(_models.TaskStates.TYPES.COMPLETE, "' ones to '").concat(_models.TaskStates.TYPES.NOT_STARTED, " across different sections'"), function () {
65
- var SECTIONS = [{
66
- name: 'Add event details',
67
- tasks: [{
68
- name: 'Date, location and mode details',
69
- pages: ['eventDate', 'eventMode']
70
- }, {
71
- name: 'Officer and agency details',
72
- pages: ['officeDetails']
73
- }]
74
- }, {
75
- name: 'Add people details',
76
- tasks: [{
77
- name: 'People details',
78
- pages: ['firstName', 'surname']
79
- }, {
80
- name: 'Immigration details',
81
- pages: ['immigrationDate']
82
- }]
83
- }];
84
- var TASKS = {
85
- 'Date, location and mode details': {
86
- complete: true
87
- },
88
- 'Officer and agency details': {
89
- complete: true
90
- }
91
- };
92
- var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, TASKS);
93
- expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.COMPLETE);
94
- expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.COMPLETE);
95
- expect(updatedSections[1][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED);
96
- expect(updatedSections[1][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
97
- });
98
- it("should set tasks to '".concat(_models.TaskStates.TYPES.IN_PROGRESS, "' if they have a current page but are not complete"), function () {
99
- var SECTIONS = [{
100
- name: 'Add event details',
101
- tasks: [{
102
- name: 'Date, location and mode details',
103
- pages: ['eventDate', 'eventMode']
104
- }, {
105
- name: 'Officer and agency details',
106
- pages: ['officeDetails']
107
- }]
108
- }];
109
- var TASKS = {
110
- 'Date, location and mode details': {
111
- complete: false,
112
- currentPage: 'eventMode'
113
- }
114
- };
115
- var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, TASKS);
116
- expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.IN_PROGRESS);
117
- expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
118
- });
119
- });
10
+ describe('components.FormRenderer.helpers.getUpdatedSectionStates', function () {
11
+ describe('sequential tasks', function () {
12
+ it("should set all tasks to '".concat(_models.TaskStates.TYPES.CANNOT_START_YET, "' excluding the first which should be '").concat(_models.TaskStates.TYPES.NOT_STARTED, "'"), function () {
13
+ var SECTIONS = [{
14
+ name: 'Add event details',
15
+ tasks: [{
16
+ name: 'Date, location and mode details',
17
+ pages: ['eventDate', 'eventMode']
18
+ }, {
19
+ name: 'Officer and agency details',
20
+ pages: ['officeDetails']
21
+ }]
22
+ }, {
23
+ name: 'Add people details',
24
+ tasks: [{
25
+ name: 'People details',
26
+ pages: ['firstName', 'surname']
27
+ }, {
28
+ name: 'Immigration details',
29
+ pages: ['immigrationDate']
30
+ }, {
31
+ name: 'Journey details',
32
+ pages: ['journeyDetails']
33
+ }]
34
+ }];
35
+ var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, {});
36
+ expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED);
37
+ expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
38
+ expect(updatedSections[1][0].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
39
+ expect(updatedSections[1][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
40
+ expect(updatedSections[1][2].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
41
+ });
42
+ it("should set tasks after any '".concat(_models.TaskStates.TYPES.COMPLETE, "' ones to '").concat(_models.TaskStates.TYPES.NOT_STARTED, "'"), function () {
43
+ var SECTIONS = [{
44
+ name: 'Add event details',
45
+ tasks: [{
46
+ name: 'Date, location and mode details',
47
+ pages: ['eventDate', 'eventMode']
48
+ }, {
49
+ name: 'Officer and agency details',
50
+ pages: ['officeDetails']
51
+ }]
52
+ }];
53
+ var TASKS = {
54
+ 'Date, location and mode details': {
55
+ complete: true
56
+ }
57
+ };
58
+ var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, TASKS);
59
+ expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.COMPLETE);
60
+ expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED);
61
+ });
62
+ it("should set tasks after any '".concat(_models.TaskStates.TYPES.COMPLETE, "' ones to '").concat(_models.TaskStates.TYPES.NOT_STARTED, " across different sections'"), function () {
63
+ var SECTIONS = [{
64
+ name: 'Add event details',
65
+ tasks: [{
66
+ name: 'Date, location and mode details',
67
+ pages: ['eventDate', 'eventMode']
68
+ }, {
69
+ name: 'Officer and agency details',
70
+ pages: ['officeDetails']
71
+ }]
72
+ }, {
73
+ name: 'Add people details',
74
+ tasks: [{
75
+ name: 'People details',
76
+ pages: ['firstName', 'surname']
77
+ }, {
78
+ name: 'Immigration details',
79
+ pages: ['immigrationDate']
80
+ }]
81
+ }];
82
+ var TASKS = {
83
+ 'Date, location and mode details': {
84
+ complete: true
85
+ },
86
+ 'Officer and agency details': {
87
+ complete: true
88
+ }
89
+ };
90
+ var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, TASKS);
91
+ expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.COMPLETE);
92
+ expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.COMPLETE);
93
+ expect(updatedSections[1][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED);
94
+ expect(updatedSections[1][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
95
+ });
96
+ it("should set tasks to '".concat(_models.TaskStates.TYPES.IN_PROGRESS, "' if they have a current page but are not complete"), function () {
97
+ var SECTIONS = [{
98
+ name: 'Add event details',
99
+ tasks: [{
100
+ name: 'Date, location and mode details',
101
+ pages: ['eventDate', 'eventMode']
102
+ }, {
103
+ name: 'Officer and agency details',
104
+ pages: ['officeDetails']
105
+ }]
106
+ }];
107
+ var TASKS = {
108
+ 'Date, location and mode details': {
109
+ complete: false,
110
+ currentPage: 'eventMode'
111
+ }
112
+ };
113
+ var updatedSections = (0, _getUpdatedSectionStates.default)(SECTIONS, TASKS);
114
+ expect(updatedSections[0][0].state).toEqual(_models.TaskStates.TYPES.IN_PROGRESS);
115
+ expect(updatedSections[0][1].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET);
116
+ });
117
+ });
118
+ describe('non-sequential tasks', function () {
119
+ var NON_SEQUENTIAL = true;
120
+ var SECTIONS = [{
121
+ name: 'First',
122
+ tasks: [{
123
+ name: 'Alpha'
124
+ }, {
125
+ name: 'Bravo'
126
+ }]
127
+ }, {
128
+ name: 'Second',
129
+ tasks: [{
130
+ name: 'Charlie',
131
+ depends_on: ['Alpha', 'Bravo']
132
+ }]
133
+ }, {
134
+ name: 'Third',
135
+ tasks: [{
136
+ name: 'Delta'
137
+ }]
138
+ }];
139
+ it("should set all states to '".concat(_models.TaskStates.TYPES.NOT_STARTED, "', except any that depend on others"), function () {
140
+ var RESULT = (0, _getUpdatedSectionStates.default)(SECTIONS, {}, NON_SEQUENTIAL);
141
+ expect(RESULT[0][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED); // Alpha
142
+
143
+ expect(RESULT[0][1].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED); // Bravo
144
+
145
+ expect(RESULT[1][0].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET); // Charlie
146
+
147
+ expect(RESULT[2][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED); // Delta
148
+ });
149
+ it('should keep dependent state unable to start if any dependencies are not complete', function () {
150
+ var ALPHA_COMPLETE = (0, _getUpdatedSectionStates.default)(SECTIONS, {
151
+ Alpha: {
152
+ complete: true
153
+ }
154
+ }, NON_SEQUENTIAL);
155
+ expect(ALPHA_COMPLETE[1][0].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET); // Charlie
156
+
157
+ var BRAVO_COMPLETE = (0, _getUpdatedSectionStates.default)(SECTIONS, {
158
+ Bravo: {
159
+ complete: true
160
+ }
161
+ }, NON_SEQUENTIAL);
162
+ expect(BRAVO_COMPLETE[1][0].state).toEqual(_models.TaskStates.TYPES.CANNOT_START_YET); // Charlie
163
+ });
164
+ it('should allow dependent state to start if all dependencies are complete', function () {
165
+ var TASKS = {
166
+ 'Alpha': {
167
+ complete: true
168
+ },
169
+ 'Bravo': {
170
+ complete: true
171
+ },
172
+ 'Delta': {}
173
+ };
174
+ var RESULT = (0, _getUpdatedSectionStates.default)(SECTIONS, TASKS, NON_SEQUENTIAL);
175
+ expect(RESULT[1][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED); // Charlie
176
+
177
+ expect(RESULT[2][0].state).toEqual(_models.TaskStates.TYPES.NOT_STARTED); // Delta
120
178
  });
121
179
  });
122
180
  });
@@ -81,7 +81,7 @@ Task.propTypes = {
81
81
  task: _propTypes.default.shape({
82
82
  name: _propTypes.default.string.isRequired,
83
83
  pages: _propTypes.default.array.isRequired,
84
- state: _propTypes.default.string.isRequired
84
+ state: _propTypes.default.string
85
85
  }).isRequired,
86
86
  onClick: _propTypes.default.func.isRequired
87
87
  };
@@ -100,7 +100,7 @@ TaskList.propTypes = {
100
100
  tasks: _propTypes.default.arrayOf(_propTypes.default.shape({
101
101
  name: _propTypes.default.string.isRequired,
102
102
  pages: _propTypes.default.array.isRequired,
103
- state: _propTypes.default.string.isRequired
103
+ state: _propTypes.default.string
104
104
  })).isRequired
105
105
  })).isRequired,
106
106
  classBlock: _propTypes.default.string,
@@ -25,18 +25,18 @@ var TaskState = function TaskState(_ref) {
25
25
 
26
26
  var classes = _copReactComponents.Utils.classBuilder(DEFAULT_CLASS, undefined, undefined);
27
27
 
28
- if (!_models.TaskStates.DETAILS[state]) {
29
- return null;
30
- }
31
-
28
+ var details = _models.TaskStates.DETAILS[state] || _models.TaskStates.DETAILS.cannotStartYet;
32
29
  return /*#__PURE__*/_react.default.createElement(_copReactComponents.Tag, {
33
- classModifiers: [_models.TaskStates.DETAILS[state].colour],
30
+ classModifiers: details.colour,
34
31
  className: classes('tag')
35
- }, _models.TaskStates.DETAILS[state].label);
32
+ }, details.label);
36
33
  };
37
34
 
38
35
  TaskState.propTypes = {
39
- state: _propTypes.default.string.isRequired
36
+ state: _propTypes.default.string
37
+ };
38
+ TaskState.defaultProps = {
39
+ state: _models.TaskStates.TYPES.CANNOT_START_YET
40
40
  };
41
41
  var _default = TaskState;
42
42
  exports.default = _default;
@@ -14,6 +14,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  // Local imports
15
15
  describe('components', function () {
16
16
  describe('TaskList.TaskState', function () {
17
+ var checkIsCannotStartYet = function checkIsCannotStartYet(container) {
18
+ expect(container.childNodes.length).toEqual(1);
19
+ expect(container.childNodes[0].classList).toContain('hods-tag');
20
+ expect(container.childNodes[0].classList).toContain("hods-tag--".concat(_models.TaskStates.DETAILS.cannotStartYet.colour));
21
+ expect(container.childNodes[0].textContent).toEqual(_models.TaskStates.DETAILS.cannotStartYet.label);
22
+ return true;
23
+ };
24
+
17
25
  it('should render a complete state icon', function () {
18
26
  var STATE = _models.TaskStates.TYPES.COMPLETE;
19
27
 
@@ -60,12 +68,9 @@ describe('components', function () {
60
68
  })),
61
69
  container = _render4.container;
62
70
 
63
- expect(container.childNodes.length).toEqual(1);
64
- expect(container.childNodes[0].classList).toContain('hods-tag');
65
- expect(container.childNodes[0].classList).toContain("hods-tag--".concat(_models.TaskStates.DETAILS.cannotStartYet.colour));
66
- expect(container.childNodes[0].textContent).toEqual(_models.TaskStates.DETAILS.cannotStartYet.label);
71
+ expect(checkIsCannotStartYet(container)).toBeTruthy();
67
72
  });
68
- it('should not render a state if given an unknown value', function () {
73
+ it('should render the "Cannot start yet" state if given an unknown value', function () {
69
74
  var STATE = 'spellingError';
70
75
 
71
76
  var _render5 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskState.default, {
@@ -73,9 +78,9 @@ describe('components', function () {
73
78
  })),
74
79
  container = _render5.container;
75
80
 
76
- expect(container.childNodes.length).toEqual(0);
81
+ expect(checkIsCannotStartYet(container)).toBeTruthy();
77
82
  });
78
- it('should not render a state if given null', function () {
83
+ it('should render the "Cannot start yet" state if given null', function () {
79
84
  var STATE = null;
80
85
 
81
86
  var _render6 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskState.default, {
@@ -83,9 +88,9 @@ describe('components', function () {
83
88
  })),
84
89
  container = _render6.container;
85
90
 
86
- expect(container.childNodes.length).toEqual(0);
91
+ expect(checkIsCannotStartYet(container)).toBeTruthy();
87
92
  });
88
- it('should not render a state if given undefined', function () {
93
+ it('should render the "Cannot start yet" state if given undefined', function () {
89
94
  var STATE = undefined;
90
95
 
91
96
  var _render7 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskState.default, {
@@ -93,7 +98,7 @@ describe('components', function () {
93
98
  })),
94
99
  container = _render7.container;
95
100
 
96
- expect(container.childNodes.length).toEqual(0);
101
+ expect(checkIsCannotStartYet(container)).toBeTruthy();
97
102
  });
98
103
  });
99
104
  });
@@ -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(2);
106
- expect(ON_CHANGE_CALLS[1]).toMatchObject({
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(3);
115
- expect(ON_CHANGE_CALLS[2]).toMatchObject({
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(4);
124
- expect(ON_CHANGE_CALLS[3]).toMatchObject({
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.17.0",
3
+ "version": "3.18.0",
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.12.0",
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",