@ukhomeoffice/cop-react-form-renderer 4.11.1 → 4.13.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.
- package/dist/components/FormComponent/Collection.js +1 -0
- package/dist/components/FormComponent/Collection.test.js +59 -0
- package/dist/components/FormComponent/Container.js +3 -1
- package/dist/components/FormComponent/Container.test.js +51 -0
- package/dist/components/FormRenderer/FormRenderer.js +3 -5
- package/dist/components/TaskList/TaskList.js +9 -4
- package/dist/components/TaskList/TaskList.stories.mdx +52 -0
- package/dist/components/TaskList/TaskList.test.js +58 -6
- package/package.json +1 -1
|
@@ -184,6 +184,7 @@ var Collection = function Collection(_ref) {
|
|
|
184
184
|
full_path: full_path,
|
|
185
185
|
components: config.item.map(function (component) {
|
|
186
186
|
return _objectSpread(_objectSpread({}, component), {}, {
|
|
187
|
+
readonly: config.readonly ? true : component.readonly,
|
|
187
188
|
label: _utils.default.interpolateString(component.label, _objectSpread(_objectSpread({}, item), {}, {
|
|
188
189
|
index: labelCount
|
|
189
190
|
})),
|
|
@@ -319,4 +319,63 @@ describe('components.FormComponent.Collection', function () {
|
|
|
319
319
|
}
|
|
320
320
|
}, _callee6);
|
|
321
321
|
})));
|
|
322
|
+
it('should appropriately make child components of items readonly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
|
|
323
|
+
var COLLECTION, _renderWithValidation5, container, c, item, _item$childNodes2, title, itemContainer, formGroup, label, hint, input;
|
|
324
|
+
|
|
325
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
326
|
+
while (1) {
|
|
327
|
+
switch (_context7.prev = _context7.next) {
|
|
328
|
+
case 0:
|
|
329
|
+
COLLECTION = {
|
|
330
|
+
id: ID,
|
|
331
|
+
fieldId: ID,
|
|
332
|
+
type: _models.ComponentTypes.COLLECTION,
|
|
333
|
+
item: [TEXT_COMPONENT],
|
|
334
|
+
readonly: true
|
|
335
|
+
};
|
|
336
|
+
_renderWithValidation5 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_FormComponent.default, {
|
|
337
|
+
component: COLLECTION,
|
|
338
|
+
value: FORM_DATA[ID],
|
|
339
|
+
formData: FORM_DATA
|
|
340
|
+
})), container = _renderWithValidation5.container; // Check the container itself.
|
|
341
|
+
|
|
342
|
+
c = container.childNodes[0];
|
|
343
|
+
expect(c.tagName).toEqual('DIV');
|
|
344
|
+
expect(c.classList).toContain(_Collection.DEFAULT_CLASS); // And now check the single text component within it.
|
|
345
|
+
|
|
346
|
+
item = c.childNodes[0];
|
|
347
|
+
expect(item.tagName).toEqual('DIV');
|
|
348
|
+
expect(item.classList).toContain("".concat(_Collection.DEFAULT_CLASS, "__item"));
|
|
349
|
+
_item$childNodes2 = _slicedToArray(item.childNodes, 2), title = _item$childNodes2[0], itemContainer = _item$childNodes2[1];
|
|
350
|
+
expect(title.tagName).toEqual('LABEL');
|
|
351
|
+
expect(title.classList).toContain("".concat(_Collection.DEFAULT_CLASS, "__item-title"));
|
|
352
|
+
expect(itemContainer.tagName).toEqual('DIV');
|
|
353
|
+
expect(itemContainer.classList).toContain(_Container.DEFAULT_CLASS);
|
|
354
|
+
formGroup = itemContainer.childNodes[0];
|
|
355
|
+
expect(formGroup.tagName).toEqual('DIV');
|
|
356
|
+
expect(formGroup.classList).toContain('govuk-form-group');
|
|
357
|
+
label = formGroup.childNodes[0];
|
|
358
|
+
expect(label.tagName).toEqual('LABEL');
|
|
359
|
+
expect(label.classList).toContain('govuk-label');
|
|
360
|
+
expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
|
|
361
|
+
expect(label.getAttribute('for')).toEqual("".concat(ID, "[0].").concat(TEXT_ID));
|
|
362
|
+
hint = formGroup.childNodes[1];
|
|
363
|
+
expect(hint.tagName).toEqual('SPAN');
|
|
364
|
+
expect(hint.classList).toContain('govuk-hint');
|
|
365
|
+
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
366
|
+
input = formGroup.childNodes[2];
|
|
367
|
+
expect(input.tagName).toEqual('DIV'); // Now readonly, so a DIV.
|
|
368
|
+
|
|
369
|
+
expect(input.classList).toContain('hods-readonly'); // Now readonly, so hods-readonly
|
|
370
|
+
|
|
371
|
+
expect(input.id).toEqual("".concat(ID, "[0].").concat(TEXT_ID));
|
|
372
|
+
expect(input.textContent).toEqual(TEXT_VALUE);
|
|
373
|
+
|
|
374
|
+
case 30:
|
|
375
|
+
case "end":
|
|
376
|
+
return _context7.stop();
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}, _callee7);
|
|
380
|
+
})));
|
|
322
381
|
});
|
|
@@ -82,7 +82,9 @@ var Container = function Container(_ref) {
|
|
|
82
82
|
return /*#__PURE__*/_react.default.createElement(_FormComponent.default, _extends({
|
|
83
83
|
key: index
|
|
84
84
|
}, attrs, {
|
|
85
|
-
component: component,
|
|
85
|
+
component: _objectSpread(_objectSpread({}, component), {}, {
|
|
86
|
+
readonly: container.readonly ? true : component.readonly
|
|
87
|
+
}),
|
|
86
88
|
formData: formData,
|
|
87
89
|
value: val || defaultValue,
|
|
88
90
|
wrap: wrap,
|
|
@@ -359,4 +359,55 @@ describe('components.FormComponent.Container', function () {
|
|
|
359
359
|
}
|
|
360
360
|
}, _callee6);
|
|
361
361
|
})));
|
|
362
|
+
it('should appropriately make child components readonly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
|
|
363
|
+
var CONTAINER, _renderWithValidation7, container, c, formGroup, label, hint, input;
|
|
364
|
+
|
|
365
|
+
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
366
|
+
while (1) {
|
|
367
|
+
switch (_context7.prev = _context7.next) {
|
|
368
|
+
case 0:
|
|
369
|
+
CONTAINER = {
|
|
370
|
+
id: ID,
|
|
371
|
+
fieldId: ID,
|
|
372
|
+
type: _models.ComponentTypes.CONTAINER,
|
|
373
|
+
components: [TEXT_COMPONENT],
|
|
374
|
+
readonly: true
|
|
375
|
+
};
|
|
376
|
+
_renderWithValidation7 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_FormComponent.default, {
|
|
377
|
+
component: CONTAINER,
|
|
378
|
+
value: FORM_DATA[ID],
|
|
379
|
+
formData: FORM_DATA
|
|
380
|
+
})), container = _renderWithValidation7.container; // Check the container itself.
|
|
381
|
+
|
|
382
|
+
c = container.childNodes[0];
|
|
383
|
+
expect(c.tagName).toEqual('DIV');
|
|
384
|
+
expect(c.classList).toContain(_Container.DEFAULT_CLASS); // And now check the single text component within it.
|
|
385
|
+
|
|
386
|
+
formGroup = c.childNodes[0];
|
|
387
|
+
expect(formGroup.tagName).toEqual('DIV');
|
|
388
|
+
expect(formGroup.classList).toContain('govuk-form-group');
|
|
389
|
+
label = formGroup.childNodes[0];
|
|
390
|
+
expect(label.tagName).toEqual('LABEL');
|
|
391
|
+
expect(label.classList).toContain('govuk-label');
|
|
392
|
+
expect(label.textContent).toEqual("".concat(TEXT_COMPONENT.label, " (optional)"));
|
|
393
|
+
expect(label.getAttribute('for')).toEqual(TEXT_ID);
|
|
394
|
+
hint = formGroup.childNodes[1];
|
|
395
|
+
expect(hint.tagName).toEqual('SPAN');
|
|
396
|
+
expect(hint.classList).toContain('govuk-hint');
|
|
397
|
+
expect(hint.textContent).toEqual(TEXT_COMPONENT.hint);
|
|
398
|
+
input = formGroup.childNodes[2];
|
|
399
|
+
expect(input.tagName).toEqual('DIV'); // Now readonly, so a DIV.
|
|
400
|
+
|
|
401
|
+
expect(input.classList).toContain('hods-readonly'); // Now readonly, so hods-readonly
|
|
402
|
+
|
|
403
|
+
expect(input.id).toEqual(TEXT_ID);
|
|
404
|
+
expect(input.textContent).toEqual(TEXT_VALUE);
|
|
405
|
+
|
|
406
|
+
case 22:
|
|
407
|
+
case "end":
|
|
408
|
+
return _context7.stop();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}, _callee7);
|
|
412
|
+
})));
|
|
362
413
|
});
|
|
@@ -535,12 +535,10 @@ var InternalFormRenderer = function InternalFormRenderer(_ref2) {
|
|
|
535
535
|
noChangeAction: noChangeAction,
|
|
536
536
|
sections: typeof hubDetails !== 'undefined' ? hubDetails.sections : [],
|
|
537
537
|
type: type
|
|
538
|
-
})), hub === _models.HubFormats.TASK && formState.pageId === _models.FormPages.HUB && /*#__PURE__*/_react.default.createElement(_TaskList.default, {
|
|
539
|
-
|
|
540
|
-
refNumber: data['businessKey'],
|
|
541
|
-
refTitle: _hub.refTitle,
|
|
538
|
+
})), hub === _models.HubFormats.TASK && formState.pageId === _models.FormPages.HUB && /*#__PURE__*/_react.default.createElement(_TaskList.default, _extends({}, hubDetails, {
|
|
539
|
+
refNumber: data.businessKey,
|
|
542
540
|
onTaskAction: onTaskAction
|
|
543
|
-
}), formState.page && !formState.cya && !formState.page.collection && /*#__PURE__*/_react.default.createElement(_FormPage.default, {
|
|
541
|
+
})), formState.page && !formState.cya && !formState.page.collection && /*#__PURE__*/_react.default.createElement(_FormPage.default, {
|
|
544
542
|
page: formState.page,
|
|
545
543
|
onAction: onPageAction
|
|
546
544
|
}), formState.page && !formState.cya && formState.page.collection && /*#__PURE__*/_react.default.createElement(_CollectionPage.default, {
|
|
@@ -5,7 +5,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.DEFAULT_CLASS = void 0;
|
|
8
|
+
exports.default = exports.DEFAULT_INCOMPLETE_TITLE = exports.DEFAULT_CLASS = void 0;
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ var _Task = _interopRequireDefault(require("./Task"));
|
|
|
19
19
|
|
|
20
20
|
require("./TaskList.scss");
|
|
21
21
|
|
|
22
|
-
var _excluded = ["refTitle", "refNumber", "sections", "fieldId", "onTaskAction", "classBlock", "classModifiers", "className"];
|
|
22
|
+
var _excluded = ["refTitle", "refNumber", "incompleteTitle", "sections", "fieldId", "onTaskAction", "classBlock", "classModifiers", "className"];
|
|
23
23
|
|
|
24
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
25
25
|
|
|
@@ -35,10 +35,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
35
35
|
|
|
36
36
|
var DEFAULT_CLASS = 'hods-task-list';
|
|
37
37
|
exports.DEFAULT_CLASS = DEFAULT_CLASS;
|
|
38
|
+
var DEFAULT_INCOMPLETE_TITLE = 'Incomplete form';
|
|
39
|
+
exports.DEFAULT_INCOMPLETE_TITLE = DEFAULT_INCOMPLETE_TITLE;
|
|
38
40
|
|
|
39
41
|
var TaskList = function TaskList(_ref) {
|
|
40
42
|
var refTitle = _ref.refTitle,
|
|
41
43
|
refNumber = _ref.refNumber,
|
|
44
|
+
incompleteTitle = _ref.incompleteTitle,
|
|
42
45
|
sections = _ref.sections,
|
|
43
46
|
fieldId = _ref.fieldId,
|
|
44
47
|
onTaskAction = _ref.onTaskAction,
|
|
@@ -77,7 +80,7 @@ var TaskList = function TaskList(_ref) {
|
|
|
77
80
|
className: "govuk-body govuk-!-margin-bottom-0"
|
|
78
81
|
}, /*#__PURE__*/_react.default.createElement("strong", {
|
|
79
82
|
className: "tasklist-summary"
|
|
80
|
-
},
|
|
83
|
+
}, incompleteTitle)), /*#__PURE__*/_react.default.createElement("p", {
|
|
81
84
|
className: "govuk-body govuk-!-margin-bottom-7"
|
|
82
85
|
}, "You have completed ".concat(numberOfCompleteSections, " of ").concat(numberOfSections, " sections")), sections.map(function (section, index) {
|
|
83
86
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
|
|
@@ -99,6 +102,7 @@ var TaskList = function TaskList(_ref) {
|
|
|
99
102
|
TaskList.propTypes = {
|
|
100
103
|
refTitle: _propTypes.default.string,
|
|
101
104
|
refNumber: _propTypes.default.string,
|
|
105
|
+
incompleteTitle: _propTypes.default.string,
|
|
102
106
|
sections: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
103
107
|
name: _propTypes.default.string.isRequired,
|
|
104
108
|
tasks: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -113,7 +117,8 @@ TaskList.propTypes = {
|
|
|
113
117
|
className: _propTypes.default.string
|
|
114
118
|
};
|
|
115
119
|
TaskList.defaultProps = {
|
|
116
|
-
classBlock: DEFAULT_CLASS
|
|
120
|
+
classBlock: DEFAULT_CLASS,
|
|
121
|
+
incompleteTitle: DEFAULT_INCOMPLETE_TITLE
|
|
117
122
|
};
|
|
118
123
|
var _default = TaskList;
|
|
119
124
|
exports.default = _default;
|
|
@@ -55,3 +55,55 @@ selected to navigate to that task.
|
|
|
55
55
|
<Details summary="Properties" className="no-indent">
|
|
56
56
|
<ArgsTable of={ TaskList } />
|
|
57
57
|
</Details>
|
|
58
|
+
|
|
59
|
+
## With custom incomplete title
|
|
60
|
+
This can be specified within the `hub` portion of the form JSON:
|
|
61
|
+
```
|
|
62
|
+
{
|
|
63
|
+
...
|
|
64
|
+
hub: {
|
|
65
|
+
...
|
|
66
|
+
incompleteTitle: 'You still have work to do, it seems'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
<Canvas withToolbar>
|
|
72
|
+
<Story name="With custom incomplete title">
|
|
73
|
+
{() => {
|
|
74
|
+
const onAction = (row) => {
|
|
75
|
+
console.log('action clicked', row);
|
|
76
|
+
};
|
|
77
|
+
const COP_REF = '123';
|
|
78
|
+
const REF_TITLE = 'COP reference number';
|
|
79
|
+
const INCOMPLETE_TITLE = 'You still have work to do, it seems'
|
|
80
|
+
const SECTIONS = [
|
|
81
|
+
{
|
|
82
|
+
name: 'Add event details',
|
|
83
|
+
tasks: [
|
|
84
|
+
{ name: 'Date, location and mode details', state: 'complete' },
|
|
85
|
+
{ name: 'Officer and agency details', state: 'inProgress' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'Add people details',
|
|
90
|
+
tasks: [
|
|
91
|
+
{ name: 'People details', state: 'complete' },
|
|
92
|
+
{ name: 'Immigration details', state: 'inProgress' },
|
|
93
|
+
{ name: 'Journey details', state: 'notStarted' },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Add item details',
|
|
98
|
+
tasks: [
|
|
99
|
+
{ name: 'Item details', state: 'cannotStartYet' },
|
|
100
|
+
{ name: 'Search and interception details', state: 'cannotStartYet' },
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
return (
|
|
105
|
+
<TaskList refNumber={COP_REF} refTitle={REF_TITLE} sections={SECTIONS} incompleteTitle={INCOMPLETE_TITLE} />
|
|
106
|
+
);
|
|
107
|
+
}}
|
|
108
|
+
</Story>
|
|
109
|
+
</Canvas>
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
var _react = require("@testing-library/react");
|
|
4
6
|
|
|
5
7
|
var _react2 = _interopRequireDefault(require("react"));
|
|
6
8
|
|
|
7
|
-
var _TaskList =
|
|
9
|
+
var _TaskList = _interopRequireWildcard(require("./TaskList"));
|
|
10
|
+
|
|
11
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
+
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
8
14
|
|
|
9
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
16
|
|
|
@@ -63,7 +69,7 @@ describe('components', function () {
|
|
|
63
69
|
expect(referenceNumber.textContent).toEqual('123');
|
|
64
70
|
var incompleteForm = container.childNodes[0].childNodes[2];
|
|
65
71
|
expect(incompleteForm.tagName).toEqual('P');
|
|
66
|
-
expect(incompleteForm.textContent).toEqual(
|
|
72
|
+
expect(incompleteForm.textContent).toEqual(_TaskList.DEFAULT_INCOMPLETE_TITLE);
|
|
67
73
|
var numComplete = container.childNodes[0].childNodes[3];
|
|
68
74
|
expect(numComplete.tagName).toEqual('P');
|
|
69
75
|
expect(numComplete.textContent).toEqual('You have completed 2 of 6 sections');
|
|
@@ -79,7 +85,7 @@ describe('components', function () {
|
|
|
79
85
|
var subSectionTwoList = container.childNodes[0].childNodes[7];
|
|
80
86
|
expect(subSectionTwoList.childNodes.length).toEqual(3);
|
|
81
87
|
});
|
|
82
|
-
it('should not show incomplete
|
|
88
|
+
it('should not show incomplete title if form is complete', function () {
|
|
83
89
|
var COP_REF = '123';
|
|
84
90
|
var REF_TITLE = 'COP reference number';
|
|
85
91
|
var sections = [{
|
|
@@ -208,7 +214,53 @@ describe('components', function () {
|
|
|
208
214
|
|
|
209
215
|
var incompleteForm = container.childNodes[0].childNodes[0];
|
|
210
216
|
expect(incompleteForm.tagName).toEqual('P');
|
|
211
|
-
expect(incompleteForm.textContent).toEqual(
|
|
217
|
+
expect(incompleteForm.textContent).toEqual(_TaskList.DEFAULT_INCOMPLETE_TITLE);
|
|
218
|
+
});
|
|
219
|
+
it('should show the correct incomplete title', function () {
|
|
220
|
+
var INCOMPLETE_TITLE = 'Alpha Bravo';
|
|
221
|
+
var COP_REF = '123';
|
|
222
|
+
var sections = [{
|
|
223
|
+
name: 'These are your tasks',
|
|
224
|
+
tasks: [{
|
|
225
|
+
name: 'Nice task',
|
|
226
|
+
state: 'complete',
|
|
227
|
+
pages: ['pageOne']
|
|
228
|
+
}, {
|
|
229
|
+
name: 'Ok task',
|
|
230
|
+
state: 'inProgress',
|
|
231
|
+
pages: ['pageTwo']
|
|
232
|
+
}, {
|
|
233
|
+
name: 'Terrible task',
|
|
234
|
+
state: 'notStarted',
|
|
235
|
+
pages: ['pageThree']
|
|
236
|
+
}]
|
|
237
|
+
}, {
|
|
238
|
+
name: 'These are your extra bonus tasks',
|
|
239
|
+
tasks: [{
|
|
240
|
+
name: 'Nice task',
|
|
241
|
+
state: 'complete',
|
|
242
|
+
pages: ['pageFour']
|
|
243
|
+
}, {
|
|
244
|
+
name: 'Ok task',
|
|
245
|
+
state: 'cannotStartYet',
|
|
246
|
+
pages: ['pageFive']
|
|
247
|
+
}, {
|
|
248
|
+
name: 'Terrible task',
|
|
249
|
+
state: 'cannotStartYet',
|
|
250
|
+
pages: ['pageSix']
|
|
251
|
+
}]
|
|
252
|
+
}];
|
|
253
|
+
|
|
254
|
+
var _render5 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
|
|
255
|
+
refNumber: COP_REF,
|
|
256
|
+
sections: sections,
|
|
257
|
+
incompleteTitle: INCOMPLETE_TITLE
|
|
258
|
+
})),
|
|
259
|
+
container = _render5.container; // The first child is now the incomplete text.
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
var incompleteForm = container.childNodes[0].childNodes[0];
|
|
263
|
+
expect(incompleteForm.textContent).toEqual(INCOMPLETE_TITLE);
|
|
212
264
|
});
|
|
213
265
|
});
|
|
214
266
|
it('should pass the the selected task to the given onTaskAction function', function () {
|
|
@@ -237,13 +289,13 @@ describe('components', function () {
|
|
|
237
289
|
}]
|
|
238
290
|
}];
|
|
239
291
|
|
|
240
|
-
var
|
|
292
|
+
var _render6 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_TaskList.default, {
|
|
241
293
|
refNumber: COP_REF,
|
|
242
294
|
refTitle: REF_TITLE,
|
|
243
295
|
sections: sections,
|
|
244
296
|
onTaskAction: ON_CLICK
|
|
245
297
|
})),
|
|
246
|
-
container =
|
|
298
|
+
container = _render6.container;
|
|
247
299
|
|
|
248
300
|
var firstTask = container.childNodes[0].childNodes[5].childNodes[0].childNodes[0].childNodes[0];
|
|
249
301
|
var secondTask = container.childNodes[0].childNodes[5].childNodes[1].childNodes[0].childNodes[0];
|