@ukhomeoffice/cop-react-form-renderer 5.28.0 → 5.29.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/CollectionSummary/BannerStrip.js +59 -0
- package/dist/components/CollectionSummary/BannerStrip.scss +47 -0
- package/dist/components/CollectionSummary/BannerStrip.test.js +111 -0
- package/dist/components/CollectionSummary/CollectionSummary.js +182 -0
- package/dist/components/CollectionSummary/CollectionSummary.scss +21 -0
- package/dist/components/CollectionSummary/CollectionSummary.test.js +121 -0
- package/dist/components/CollectionSummary/Confirmation.js +58 -0
- package/dist/components/CollectionSummary/Confirmation.scss +14 -0
- package/dist/components/CollectionSummary/Confirmation.test.js +102 -0
- package/dist/components/CollectionSummary/SummaryCard.js +274 -0
- package/dist/components/CollectionSummary/SummaryCard.scss +244 -0
- package/dist/components/CollectionSummary/SummaryCard.test.js +1164 -0
- package/dist/components/CollectionSummary/index.js +10 -0
- package/dist/components/FormComponent/FormComponent.js +19 -3
- package/dist/components/FormPage/FormPage.js +10 -3
- package/dist/components/FormRenderer/FormRenderer.js +1 -0
- package/dist/components/FormRenderer/onPageAction.js +5 -14
- package/dist/components/FormRenderer/onPageAction.test.js +3 -6
- package/dist/models/ComponentTypes.js +2 -0
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +1 -1
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +4 -21
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +32 -0
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +68 -0
- package/dist/utils/CollectionPage/getQuickEditPage.js +74 -0
- package/dist/utils/CollectionPage/getQuickEditPage.test.js +109 -0
- package/dist/utils/CollectionPage/index.js +4 -0
- package/dist/utils/CollectionPage/removeCollectionPageEntry.js +36 -0
- package/dist/utils/CollectionPage/removeCollectionPageEntry.test.js +61 -0
- package/package.json +2 -2
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _removeCollectionPageEntry = _interopRequireDefault(require("./removeCollectionPageEntry"));
|
|
4
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
5
|
+
// Local imports.
|
|
6
|
+
|
|
7
|
+
describe('utils.collectionPage.removeCollectionPageEntry', function () {
|
|
8
|
+
var FORM_DATA = {
|
|
9
|
+
parentsActiveId: '1',
|
|
10
|
+
childrenActiveId: '1',
|
|
11
|
+
grandchildrenActiveId: '1',
|
|
12
|
+
parents: [{
|
|
13
|
+
id: '1',
|
|
14
|
+
children: [{
|
|
15
|
+
id: '1',
|
|
16
|
+
grandchildren: [{
|
|
17
|
+
id: '1',
|
|
18
|
+
value: 'Alpha'
|
|
19
|
+
}, {
|
|
20
|
+
id: '2',
|
|
21
|
+
value: 'Bravo'
|
|
22
|
+
}, {
|
|
23
|
+
id: '3',
|
|
24
|
+
value: 'Charlie'
|
|
25
|
+
}, {
|
|
26
|
+
id: '4',
|
|
27
|
+
value: 'Delta'
|
|
28
|
+
}]
|
|
29
|
+
}]
|
|
30
|
+
}]
|
|
31
|
+
};
|
|
32
|
+
it('should return null if a parent collection does not exist', function () {
|
|
33
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.chainbreak.grandchildren', FORM_DATA, '1');
|
|
34
|
+
expect(removedEntry).toEqual(null);
|
|
35
|
+
});
|
|
36
|
+
it('should return null if an entry with the provided id does not exist', function () {
|
|
37
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.children.grandchildren', FORM_DATA, '0');
|
|
38
|
+
expect(removedEntry).toEqual(null);
|
|
39
|
+
});
|
|
40
|
+
it('should return null if form data is invalid', function () {
|
|
41
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.children.grandchildren', null, '1');
|
|
42
|
+
expect(removedEntry).toEqual(null);
|
|
43
|
+
});
|
|
44
|
+
it('should correctly remove the target entry', function () {
|
|
45
|
+
var removedEntry = (0, _removeCollectionPageEntry.default)('parents.children.grandchildren', FORM_DATA, '3');
|
|
46
|
+
expect(removedEntry).toEqual({
|
|
47
|
+
id: '3',
|
|
48
|
+
value: 'Charlie'
|
|
49
|
+
});
|
|
50
|
+
expect(FORM_DATA.parents[0].children[0].grandchildren).toEqual([{
|
|
51
|
+
id: '1',
|
|
52
|
+
value: 'Alpha'
|
|
53
|
+
}, {
|
|
54
|
+
id: '2',
|
|
55
|
+
value: 'Bravo'
|
|
56
|
+
}, {
|
|
57
|
+
id: '4',
|
|
58
|
+
value: 'Delta'
|
|
59
|
+
}]);
|
|
60
|
+
});
|
|
61
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.29.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": "^3.15.
|
|
19
|
+
"@ukhomeoffice/cop-react-components": "^3.15.1",
|
|
20
20
|
"axios": "^0.23.0",
|
|
21
21
|
"dayjs": "^1.11.0",
|
|
22
22
|
"govuk-frontend": "^4.3.1",
|