@ukhomeoffice/cop-react-form-renderer 6.0.5-peter → 6.5.1-peter
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.scss +2 -2
- package/dist/components/CollectionPage/CollectionPage.js +8 -2
- package/dist/components/CollectionSummary/BannerStrip.js +3 -2
- package/dist/components/CollectionSummary/BannerStrip.scss +2 -2
- package/dist/components/CollectionSummary/BannerStrip.test.js +39 -4
- package/dist/components/CollectionSummary/CollectionSummary.js +82 -63
- package/dist/components/CollectionSummary/CollectionSummary.scss +1 -1
- package/dist/components/CollectionSummary/CollectionSummary.test.js +40 -80
- package/dist/components/CollectionSummary/Confirmation.scss +1 -1
- package/dist/components/CollectionSummary/RenderListView.js +24 -20
- package/dist/components/CollectionSummary/RenderListView.scss +10 -1
- package/dist/components/CollectionSummary/RenderListView.test.js +14 -4
- package/dist/components/CollectionSummary/SummaryCard.js +59 -38
- package/dist/components/CollectionSummary/SummaryCard.scss +2 -1
- package/dist/components/CollectionSummary/SummaryCard.test.js +193 -150
- package/dist/components/CollectionSummary/SummaryCardDetails.js +70 -13
- package/dist/components/CollectionSummary/SummaryCardDetails.scss +43 -6
- package/dist/components/CollectionSummary/SummaryCardDetails.test.js +174 -26
- package/dist/components/CollectionSummary/SummaryCardValidationContext.js +15 -5
- package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +5 -4
- package/dist/components/FormComponent/Collection.js +24 -17
- package/dist/components/FormComponent/Collection.test.js +138 -0
- package/dist/components/FormComponent/FormComponent.js +12 -0
- package/dist/components/FormPage/FormPage.scss +1 -1
- package/dist/components/FormRenderer/FormRenderer.js +7 -4
- package/dist/components/FormRenderer/FormRenderer.scss +1 -1
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-airpax-after.json +429 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-airpax-before.json +449 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-airpax-form.json +15219 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-eab-2-data-after.json +516 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-eab-2-data-before.json +593 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-eab2-form.json +15219 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-mandec-data-after.json +84 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-mandec-data-before.json +98 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-mandec-form.json +9158 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/test.json +1605 -0
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/test2.json +205 -0
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +114 -61
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +30 -0
- package/dist/components/FormRenderer/helpers/deleteNodeByPath.js +8 -2
- package/dist/components/FormRenderer/onPageAction.js +6 -1
- package/dist/components/FormRenderer/onPageAction.test.js +18 -4
- package/dist/components/SummaryList/SummaryList.scss +2 -2
- package/dist/components/TaskList/TaskList.scss +1 -1
- package/dist/context/ValidationContext/ValidationContext.js +49 -5
- package/dist/context/ValidationContext/ValidationContext.test.js +16 -7
- package/dist/hooks/useRefData.js +1 -1
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +1 -2
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +5 -0
- package/dist/utils/CollectionPage/addCollectionPageEntry.js +1 -2
- package/dist/utils/CollectionPage/addCollectionPageEntry.test.js +4 -24
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +13 -1
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +17 -2
- package/dist/utils/CollectionPage/getErrorsForCollection.js +55 -0
- package/dist/utils/CollectionPage/getErrorsForCollection.test.js +155 -0
- package/dist/utils/CollectionPage/getQuickEditPage.js +7 -1
- package/dist/utils/CollectionPage/index.js +2 -0
- package/dist/utils/CollectionPage/setCollectionPageData.js +9 -4
- package/dist/utils/CollectionPage/setCollectionPageData.test.js +18 -0
- package/dist/utils/Component/isEditable.js +1 -1
- package/dist/utils/Condition/meetsAllConditions.js +5 -1
- package/dist/utils/Condition/meetsAllConditions.test.js +13 -0
- package/dist/utils/Condition/meetsCondition.js +18 -0
- package/dist/utils/Condition/meetsCondition.test.js +100 -0
- package/dist/utils/Data/getOptions.js +10 -0
- package/dist/utils/Data/getOptions.test.js +73 -0
- package/dist/utils/Data/nestInRefdataOptions.js +49 -0
- package/dist/utils/Data/nestInRefdataOptions.test.js +236 -0
- package/dist/utils/Validate/validateContainer.js +3 -1
- package/dist/utils/Validate/validateContainer.test.js +33 -0
- package/dist/utils/Validate/validateEmail.js +1 -1
- package/dist/utils/Validate/validatePage.js +10 -1
- package/dist/utils/Validate/validatePage.test.js +69 -0
- package/package.json +4 -4
|
@@ -719,4 +719,73 @@ describe('utils.Validate.Page', function () {
|
|
|
719
719
|
});
|
|
720
720
|
});
|
|
721
721
|
});
|
|
722
|
+
describe('when there are queued errors', function () {
|
|
723
|
+
it('should return any errors queued for a component as well as errors found during validation', function () {
|
|
724
|
+
var COMPONENTS = [setup('a', _models.ComponentTypes.TEXT, 'Alpha', true)];
|
|
725
|
+
var PAGE = {
|
|
726
|
+
components: COMPONENTS,
|
|
727
|
+
formData: null
|
|
728
|
+
};
|
|
729
|
+
var QUEUED_ERRORS = [{
|
|
730
|
+
id: 'a',
|
|
731
|
+
error: 'Error queued for Alpha 1'
|
|
732
|
+
}, {
|
|
733
|
+
id: 'a',
|
|
734
|
+
error: 'Error queued for Alpha 2'
|
|
735
|
+
}];
|
|
736
|
+
var RESULT = (0, _validatePage.default)(PAGE, QUEUED_ERRORS);
|
|
737
|
+
expect(RESULT.length).toEqual(3);
|
|
738
|
+
expect(RESULT[0]).toEqual(_objectSpread({}, QUEUED_ERRORS[0]));
|
|
739
|
+
expect(RESULT[1]).toEqual(_objectSpread({}, QUEUED_ERRORS[1]));
|
|
740
|
+
expect(RESULT[2]).toEqual({
|
|
741
|
+
id: 'a',
|
|
742
|
+
error: 'Alpha is required'
|
|
743
|
+
});
|
|
744
|
+
});
|
|
745
|
+
it('should return any errors queued for a component even if no errors are found during validation', function () {
|
|
746
|
+
var COMPONENTS = [setup('a', _models.ComponentTypes.TEXT, 'Alpha', true)];
|
|
747
|
+
var PAGE = {
|
|
748
|
+
components: COMPONENTS,
|
|
749
|
+
formData: {
|
|
750
|
+
a: 'Value'
|
|
751
|
+
}
|
|
752
|
+
};
|
|
753
|
+
var QUEUED_ERRORS = [{
|
|
754
|
+
id: 'a',
|
|
755
|
+
error: 'Error queued for Alpha 1'
|
|
756
|
+
}, {
|
|
757
|
+
id: 'a',
|
|
758
|
+
error: 'Error queued for Alpha 2'
|
|
759
|
+
}];
|
|
760
|
+
var RESULT = (0, _validatePage.default)(PAGE, QUEUED_ERRORS);
|
|
761
|
+
expect(RESULT.length).toEqual(2);
|
|
762
|
+
expect(RESULT[0]).toEqual(_objectSpread({}, QUEUED_ERRORS[0]));
|
|
763
|
+
expect(RESULT[1]).toEqual(_objectSpread({}, QUEUED_ERRORS[1]));
|
|
764
|
+
});
|
|
765
|
+
it('should return any queued errors if the component is not shown', function () {
|
|
766
|
+
var COMPONENTS = [_objectSpread(_objectSpread({}, setup('a', _models.ComponentTypes.TEXT, 'Alpha', true)), {}, {
|
|
767
|
+
show_when: [{
|
|
768
|
+
field: 'b',
|
|
769
|
+
op: '=',
|
|
770
|
+
value: 'yes'
|
|
771
|
+
}]
|
|
772
|
+
})];
|
|
773
|
+
var PAGE = {
|
|
774
|
+
components: COMPONENTS,
|
|
775
|
+
formData: {
|
|
776
|
+
a: 'Value',
|
|
777
|
+
b: 'no'
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
var QUEUED_ERRORS = [{
|
|
781
|
+
id: 'a',
|
|
782
|
+
error: 'Error queued for Alpha 1'
|
|
783
|
+
}, {
|
|
784
|
+
id: 'a',
|
|
785
|
+
error: 'Error queued for Alpha 2'
|
|
786
|
+
}];
|
|
787
|
+
var RESULT = (0, _validatePage.default)(PAGE, QUEUED_ERRORS);
|
|
788
|
+
expect(RESULT.length).toEqual(0);
|
|
789
|
+
});
|
|
790
|
+
});
|
|
722
791
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ukhomeoffice/cop-react-form-renderer",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.1-peter",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"clean": "rimraf dist",
|
|
@@ -16,10 +16,10 @@
|
|
|
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": "^
|
|
19
|
+
"@ukhomeoffice/cop-react-components": "^4.0.0",
|
|
20
20
|
"axios": "^0.23.0",
|
|
21
21
|
"dayjs": "^1.11.0",
|
|
22
|
-
"govuk-frontend": "^
|
|
22
|
+
"govuk-frontend": "^5.0.0",
|
|
23
23
|
"web-vitals": "^1.0.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"eslint-config-airbnb": "^19.0.4",
|
|
49
49
|
"eslint-config-prettier": "^8.6.0",
|
|
50
50
|
"html-react-parser": "^0.10.5",
|
|
51
|
-
"node-sass": "^6.0.1",
|
|
52
51
|
"prop-types": "^15.8.1",
|
|
53
52
|
"react": "^16.13.1",
|
|
54
53
|
"react-dom": "^16.13.1",
|
|
55
54
|
"react-scripts": "4.0.3",
|
|
55
|
+
"sass": "^1.69.5",
|
|
56
56
|
"storybook-addon-mock": "^2.0.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|