@ukhomeoffice/cop-react-form-renderer 4.18.0 → 5.0.0-alpha
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/Answer.js +1 -14
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +19 -57
- package/dist/components/CheckYourAnswers/index.js +0 -3
- package/dist/components/CollectionPage/CollectionPage.js +8 -38
- package/dist/components/CollectionPage/index.js +0 -3
- package/dist/components/FormComponent/Collection.js +13 -54
- package/dist/components/FormComponent/Container.js +6 -30
- package/dist/components/FormComponent/FormComponent.js +14 -57
- package/dist/components/FormComponent/helpers/addLabel.js +4 -7
- package/dist/components/FormComponent/helpers/getComponentDisabled.js +0 -4
- package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +0 -2
- package/dist/components/FormComponent/helpers/getComponentError.js +0 -6
- package/dist/components/FormComponent/helpers/getComponentError.test.js +0 -2
- package/dist/components/FormComponent/helpers/index.js +0 -4
- package/dist/components/FormComponent/index.js +0 -3
- package/dist/components/FormPage/FormPage.js +14 -45
- package/dist/components/FormPage/index.js +0 -3
- package/dist/components/FormRenderer/FormRenderer.js +106 -189
- package/dist/components/FormRenderer/handlers/cyaAction.js +0 -5
- package/dist/components/FormRenderer/handlers/getPageId.js +0 -2
- package/dist/components/FormRenderer/handlers/getPageId.test.js +1 -2
- package/dist/components/FormRenderer/handlers/handlers.test.js +1 -18
- package/dist/components/FormRenderer/handlers/index.js +0 -5
- package/dist/components/FormRenderer/handlers/navigate.js +0 -5
- package/dist/components/FormRenderer/handlers/submissionError.js +0 -2
- package/dist/components/FormRenderer/helpers/canActionProceed.js +0 -3
- package/dist/components/FormRenderer/helpers/canActionProceed.test.js +1 -3
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +0 -2
- package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +1 -5
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +0 -5
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +1 -2
- package/dist/components/FormRenderer/helpers/getCYA.js +0 -6
- package/dist/components/FormRenderer/helpers/getCYA.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getFormState.js +0 -5
- package/dist/components/FormRenderer/helpers/getFormState.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getNextPageId.js +0 -25
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +1 -4
- package/dist/components/FormRenderer/helpers/getPage.js +0 -5
- package/dist/components/FormRenderer/helpers/getPage.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +0 -6
- package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +0 -10
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +0 -6
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +6 -20
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +3 -8
- package/dist/components/FormRenderer/helpers/index.js +1 -11
- package/dist/components/FormRenderer/index.js +0 -3
- package/dist/components/PageActions/ActionButton.js +2 -17
- package/dist/components/PageActions/PageActions.js +3 -10
- package/dist/components/PageActions/index.js +0 -3
- package/dist/components/SummaryList/GroupAction.js +3 -24
- package/dist/components/SummaryList/RowAction.js +3 -23
- package/dist/components/SummaryList/SummaryList.js +6 -28
- package/dist/components/SummaryList/SummaryListRow.js +4 -8
- package/dist/components/SummaryList/SummaryListTitleRow.js +2 -7
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +0 -3
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +0 -6
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +0 -3
- package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +0 -6
- package/dist/components/SummaryList/helpers/index.js +0 -2
- package/dist/components/SummaryList/index.js +0 -3
- package/dist/components/TaskList/Task.js +7 -29
- package/dist/components/TaskList/TaskList.js +12 -33
- package/dist/components/TaskList/TaskState.js +2 -10
- package/dist/components/TaskList/index.js +0 -3
- package/dist/components/index.js +0 -6
- package/dist/context/HooksContext/HooksContext.js +14 -34
- package/dist/context/HooksContext/index.js +0 -5
- package/dist/context/ValidationContext/ValidationContext.js +8 -34
- package/dist/context/ValidationContext/index.js +0 -5
- package/dist/context/index.js +0 -3
- package/dist/hooks/index.js +0 -9
- package/dist/hooks/useAxios.js +8 -25
- package/dist/hooks/useGetRequest.js +13 -47
- package/dist/hooks/useHooks.js +2 -4
- package/dist/hooks/useRefData.js +8 -37
- package/dist/hooks/useValidation.js +2 -4
- package/dist/index.js +0 -6
- package/dist/models/PageAction.js +0 -3
- package/dist/models/TaskStates.js +0 -3
- package/dist/models/index.js +0 -9
- package/dist/utils/CheckYourAnswers/getCYAAction.js +1 -9
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +0 -10
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +0 -8
- package/dist/utils/CheckYourAnswers/getCYARow.js +1 -10
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +2 -20
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +0 -18
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +0 -20
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +0 -13
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +2 -22
- package/dist/utils/CheckYourAnswers/index.js +1 -3
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +2 -11
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +0 -11
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +0 -6
- package/dist/utils/CollectionPage/index.js +1 -5
- package/dist/utils/CollectionPage/mergeCollectionPages.js +1 -12
- package/dist/utils/Component/cleanAttributes.js +1 -8
- package/dist/utils/Component/elevateNestedComponents.js +0 -3
- package/dist/utils/Component/getComponent.js +4 -68
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +6 -10
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +10 -28
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +6 -33
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +10 -27
- package/dist/utils/Component/getComponentTests/getComponent.details.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +4 -22
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +3 -7
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +3 -7
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +6 -15
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +6 -33
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.textarea.test.js +4 -21
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +10 -29
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +1 -2
- package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +3 -7
- package/dist/utils/Component/getDefaultValue.js +0 -7
- package/dist/utils/Component/index.js +0 -9
- package/dist/utils/Component/isEditable.js +1 -4
- package/dist/utils/Component/showComponent.js +1 -8
- package/dist/utils/Component/wrapInFormGroup.js +0 -7
- package/dist/utils/Condition/index.js +0 -5
- package/dist/utils/Condition/meetsAllConditions.js +0 -9
- package/dist/utils/Condition/meetsCondition.js +7 -19
- package/dist/utils/Condition/meetsOneCondition.js +1 -9
- package/dist/utils/Condition/setupConditions.js +0 -12
- package/dist/utils/Container/getEditableComponents.js +0 -7
- package/dist/utils/Container/index.js +0 -5
- package/dist/utils/Container/setupNesting.js +0 -11
- package/dist/utils/Container/showContainer.js +9 -18
- package/dist/utils/Data/applyFormula.js +2 -28
- package/dist/utils/Data/getAutocompleteSource.js +1 -4
- package/dist/utils/Data/getDataPath.js +3 -17
- package/dist/utils/Data/getOptions.js +0 -9
- package/dist/utils/Data/getSourceData.js +4 -19
- package/dist/utils/Data/index.js +1 -11
- package/dist/utils/Data/refDataToOptions.js +1 -12
- package/dist/utils/Data/setDataItem.js +0 -5
- package/dist/utils/Data/setupFormData.js +2 -20
- package/dist/utils/Data/setupRefDataUrlForComponent.js +0 -14
- package/dist/utils/FormPage/getFormPage.js +0 -15
- package/dist/utils/FormPage/getFormPages.js +0 -8
- package/dist/utils/FormPage/getPageActions.js +3 -18
- package/dist/utils/FormPage/getParagraphFromText.js +0 -3
- package/dist/utils/FormPage/index.js +0 -6
- package/dist/utils/FormPage/showFormPage.js +9 -18
- package/dist/utils/FormPage/showFormPageCYA.js +0 -5
- package/dist/utils/FormPage/useComponent.js +3 -18
- package/dist/utils/Format/formatData.js +0 -5
- package/dist/utils/Format/formatDataForComponent.js +1 -6
- package/dist/utils/Format/formatDataForForm.js +0 -8
- package/dist/utils/Format/formatDataForPage.js +1 -5
- package/dist/utils/Format/index.js +1 -6
- package/dist/utils/Hub/getFormHub.js +0 -8
- package/dist/utils/Hub/index.js +1 -3
- package/dist/utils/Meta/documents/getDocuments.js +1 -4
- package/dist/utils/Meta/documents/getDocuments.test.js +0 -9
- package/dist/utils/Meta/documents/index.js +1 -5
- package/dist/utils/Meta/documents/setDocumentForField.js +0 -11
- package/dist/utils/Meta/documents/setDocumentForField.test.js +0 -11
- package/dist/utils/Meta/index.js +2 -6
- package/dist/utils/Operate/checkValueIsTruthy.js +1 -7
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +7 -21
- package/dist/utils/Operate/index.js +0 -3
- package/dist/utils/Operate/persistValueInFormData.js +1 -8
- package/dist/utils/Operate/runPageOperations.js +3 -18
- package/dist/utils/Operate/setValueInFormData.js +2 -7
- package/dist/utils/Operate/shouldRun.js +1 -14
- package/dist/utils/Validate/additional/index.js +1 -18
- package/dist/utils/Validate/additional/index.test.js +0 -6
- package/dist/utils/Validate/additional/mustBeAfter.js +3 -8
- package/dist/utils/Validate/additional/mustBeAfter.test.js +0 -4
- package/dist/utils/Validate/additional/mustBeBefore.js +3 -8
- package/dist/utils/Validate/additional/mustBeBefore.test.js +0 -4
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +5 -16
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +0 -7
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +3 -12
- package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +0 -3
- package/dist/utils/Validate/additional/mustBeInThePast.js +5 -13
- package/dist/utils/Validate/additional/mustBeInThePast.test.js +0 -3
- package/dist/utils/Validate/additional/mustBeLessThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeLessThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeLongerThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeLongerThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +0 -4
- package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeShorterThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeShorterThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +0 -5
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +0 -4
- package/dist/utils/Validate/additional/utils.js +8 -24
- package/dist/utils/Validate/index.js +1 -9
- package/dist/utils/Validate/validateCollection.js +0 -9
- package/dist/utils/Validate/validateComponent.js +2 -35
- package/dist/utils/Validate/validateContainer.js +0 -13
- package/dist/utils/Validate/validateDate.js +4 -36
- package/dist/utils/Validate/validateEmail.js +1 -7
- package/dist/utils/Validate/validatePage.js +0 -15
- package/dist/utils/Validate/validateRegex.js +0 -10
- package/dist/utils/Validate/validateRequired.js +0 -8
- package/dist/utils/Validate/validateTime.js +3 -20
- package/dist/utils/index.js +0 -19
- package/package.json +50 -34
- package/dist/components/CheckYourAnswers/Answer.test.js +0 -95
- package/dist/components/CheckYourAnswers/CheckYourAnswers.stories.mdx +0 -410
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +0 -680
- package/dist/components/CollectionPage/CollectionPage.test.js +0 -428
- package/dist/components/FormComponent/Collection.test.js +0 -381
- package/dist/components/FormComponent/Container.test.js +0 -423
- package/dist/components/FormComponent/FormComponent.stories.mdx +0 -184
- package/dist/components/FormComponent/FormComponent.test.js +0 -264
- package/dist/components/FormPage/FormPage.stories.mdx +0 -131
- package/dist/components/FormPage/FormPage.test.js +0 -368
- package/dist/components/FormRenderer/FormRenderer.stories.mdx +0 -183
- package/dist/components/FormRenderer/FormRenderer.test.js +0 -1006
- package/dist/components/PageActions/ActionButton.test.js +0 -116
- package/dist/components/PageActions/PageActions.stories.mdx +0 -74
- package/dist/components/PageActions/PageActions.test.js +0 -157
- package/dist/components/SummaryList/GroupAction.test.js +0 -94
- package/dist/components/SummaryList/RowAction.test.js +0 -94
- package/dist/components/SummaryList/SummaryList.stories.mdx +0 -90
- package/dist/components/SummaryList/SummaryList.test.js +0 -361
- package/dist/components/TaskList/Task.test.js +0 -194
- package/dist/components/TaskList/TaskList.stories.mdx +0 -164
- package/dist/components/TaskList/TaskList.test.js +0 -334
- package/dist/components/TaskList/TaskState.test.js +0 -104
- package/dist/context/HooksContext/HooksContext.test.js +0 -60
- package/dist/context/ValidationContext/ValidationContext.test.js +0 -98
- package/dist/json/areYouACivilServant.json +0 -7
- package/dist/json/firstForm.json +0 -94
- package/dist/json/grade.json +0 -108
- package/dist/json/group.data.json +0 -21
- package/dist/json/group.json +0 -402
- package/dist/json/groupOfRow.json +0 -137
- package/dist/json/groupOfRowData.json +0 -15
- package/dist/json/port.json +0 -346
- package/dist/json/saveAndContinue.json +0 -98
- package/dist/json/sublocation.json +0 -859
- package/dist/json/taskList.json +0 -265
- package/dist/json/team.json +0 -17351
- package/dist/json/terminal.json +0 -81
- package/dist/json/userProfile.data.json +0 -21
- package/dist/json/userProfile.json +0 -276
- package/dist/setupTests.js +0 -59
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +0 -139
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +0 -76
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +0 -59
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +0 -256
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +0 -77
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +0 -199
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +0 -170
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +0 -323
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +0 -281
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +0 -64
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +0 -41
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +0 -54
- package/dist/utils/CollectionPage/mergeCollectionPages.test.js +0 -131
- package/dist/utils/Component/cleanAttributes.test.js +0 -69
- package/dist/utils/Component/elevateNestedComponents.test.js +0 -92
- package/dist/utils/Component/getDefaultValue.test.js +0 -53
- package/dist/utils/Component/isEditable.test.js +0 -42
- package/dist/utils/Component/showComponent.test.js +0 -157
- package/dist/utils/Condition/meetsAllConditions.test.js +0 -62
- package/dist/utils/Condition/meetsCondition.test.js +0 -391
- package/dist/utils/Condition/meetsOneCondition.test.js +0 -101
- package/dist/utils/Condition/setupConditions.test.js +0 -35
- package/dist/utils/Container/getEditableComponents.test.js +0 -146
- package/dist/utils/Container/setupNesting.test.js +0 -92
- package/dist/utils/Container/showContainer.test.js +0 -179
- package/dist/utils/Data/applyFormula.test.js +0 -264
- package/dist/utils/Data/getAutocompleteSource.test.js +0 -146
- package/dist/utils/Data/getDataPath.test.js +0 -52
- package/dist/utils/Data/getOptions.test.js +0 -71
- package/dist/utils/Data/getSourceData.test.js +0 -141
- package/dist/utils/Data/refDataToOptions.test.js +0 -197
- package/dist/utils/Data/setDataItem.test.js +0 -112
- package/dist/utils/Data/setupFormData.test.js +0 -276
- package/dist/utils/Data/setupRefDataUrlForComponent.test.js +0 -133
- package/dist/utils/FormPage/getFormPage.test.js +0 -205
- package/dist/utils/FormPage/getFormPages.test.js +0 -98
- package/dist/utils/FormPage/getPageActions.test.js +0 -89
- package/dist/utils/FormPage/getParagraphFromText.test.js +0 -29
- package/dist/utils/FormPage/showFormPage.test.js +0 -182
- package/dist/utils/FormPage/showFormPageCYA.test.js +0 -30
- package/dist/utils/FormPage/useComponent.test.js +0 -169
- package/dist/utils/Format/formatData.test.js +0 -46
- package/dist/utils/Format/formatDataForComponent.test.js +0 -161
- package/dist/utils/Format/formatDataForForm.test.js +0 -78
- package/dist/utils/Format/formatDataForPage.test.js +0 -96
- package/dist/utils/Hub/getFormHub.test.js +0 -107
- package/dist/utils/Operate/checkValueIsTruthy.test.js +0 -44
- package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +0 -159
- package/dist/utils/Operate/persistValueInFormData.test.js +0 -106
- package/dist/utils/Operate/runPageOperations.test.js +0 -107
- package/dist/utils/Operate/setValueInFormData.test.js +0 -46
- package/dist/utils/Operate/shouldRun.test.js +0 -69
- package/dist/utils/Validate/validateCollection.test.js +0 -74
- package/dist/utils/Validate/validateComponent.test.js +0 -267
- package/dist/utils/Validate/validateContainer.test.js +0 -81
- package/dist/utils/Validate/validateDate.test.js +0 -118
- package/dist/utils/Validate/validateEmail.test.js +0 -57
- package/dist/utils/Validate/validatePage.test.js +0 -383
- package/dist/utils/Validate/validateRegex.test.js +0 -41
- package/dist/utils/Validate/validateRequired.test.js +0 -62
- package/dist/utils/Validate/validateTime.test.js +0 -61
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
|
|
5
|
-
var _react = require("@testing-library/react");
|
|
6
|
-
|
|
7
|
-
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
8
|
-
|
|
9
|
-
var _react2 = _interopRequireWildcard(require("react"));
|
|
10
|
-
|
|
11
|
-
var _hooks = require("../../hooks");
|
|
12
|
-
|
|
13
|
-
var _ValidationContext = _interopRequireDefault(require("./ValidationContext"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
|
-
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); }
|
|
18
|
-
|
|
19
|
-
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; }
|
|
20
|
-
|
|
21
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
22
|
-
|
|
23
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
-
|
|
25
|
-
var TestComponent = function TestComponent(_ref) {
|
|
26
|
-
var customErrors = _ref.customErrors;
|
|
27
|
-
|
|
28
|
-
var _useValidation = (0, _hooks.useValidation)(),
|
|
29
|
-
addErrors = _useValidation.addErrors,
|
|
30
|
-
clearErrors = _useValidation.clearErrors,
|
|
31
|
-
errors = _useValidation.errors,
|
|
32
|
-
validate = _useValidation.validate;
|
|
33
|
-
|
|
34
|
-
(0, _react2.useEffect)(function () {
|
|
35
|
-
if (customErrors) {
|
|
36
|
-
addErrors(customErrors);
|
|
37
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
38
|
-
|
|
39
|
-
}, [customErrors]);
|
|
40
|
-
return /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, typeof addErrors === 'function' && /*#__PURE__*/_react2.default.createElement("span", null, "addErrors is a function"), typeof clearErrors === 'function' && /*#__PURE__*/_react2.default.createElement("span", null, "clearErrors is a function"), typeof validate.page === 'function' && /*#__PURE__*/_react2.default.createElement("span", null, "validate.page is a function"), Array.isArray(errors) && /*#__PURE__*/_react2.default.createElement("span", null, "errors is an array of length ", errors.length), (errors === null || errors === void 0 ? void 0 : errors.length) > 0 && /*#__PURE__*/_react2.default.createElement(_copReactComponents.ErrorSummary, {
|
|
41
|
-
errors: errors
|
|
42
|
-
}));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
describe('context.ValidationContext', function () {
|
|
46
|
-
it('should appropriately set up the context', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
47
|
-
var _render, container;
|
|
48
|
-
|
|
49
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
50
|
-
while (1) {
|
|
51
|
-
switch (_context.prev = _context.next) {
|
|
52
|
-
case 0:
|
|
53
|
-
_render = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_ValidationContext.default, null, /*#__PURE__*/_react2.default.createElement(TestComponent, null))), container = _render.container;
|
|
54
|
-
expect(container.childNodes.length).toEqual(4);
|
|
55
|
-
expect(container.textContent).toContain('addErrors is a function');
|
|
56
|
-
expect(container.textContent).toContain('clearErrors is a function');
|
|
57
|
-
expect(container.textContent).toContain('validate.page is a function');
|
|
58
|
-
expect(container.textContent).toContain('errors is an array of length 0');
|
|
59
|
-
|
|
60
|
-
case 6:
|
|
61
|
-
case "end":
|
|
62
|
-
return _context.stop();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, _callee);
|
|
66
|
-
})));
|
|
67
|
-
it('should appropriately handle errors', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
68
|
-
var CUSTOM_ERRORS, _render2, container, errorSummary;
|
|
69
|
-
|
|
70
|
-
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
71
|
-
while (1) {
|
|
72
|
-
switch (_context2.prev = _context2.next) {
|
|
73
|
-
case 0:
|
|
74
|
-
CUSTOM_ERRORS = [{
|
|
75
|
-
id: 'alpha',
|
|
76
|
-
error: 'Alpha is required'
|
|
77
|
-
}];
|
|
78
|
-
_render2 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_ValidationContext.default, null, /*#__PURE__*/_react2.default.createElement(TestComponent, {
|
|
79
|
-
customErrors: CUSTOM_ERRORS
|
|
80
|
-
}))), container = _render2.container;
|
|
81
|
-
expect(container.childNodes.length).toEqual(5);
|
|
82
|
-
expect(container.textContent).toContain('addErrors is a function');
|
|
83
|
-
expect(container.textContent).toContain('clearErrors is a function');
|
|
84
|
-
expect(container.textContent).toContain('validate.page is a function');
|
|
85
|
-
expect(container.textContent).toContain('errors is an array of length 1');
|
|
86
|
-
errorSummary = container.childNodes[4];
|
|
87
|
-
expect(errorSummary.tagName).toEqual('DIV');
|
|
88
|
-
expect(errorSummary.classList).toContain('govuk-error-summary');
|
|
89
|
-
expect(errorSummary.textContent).toContain(CUSTOM_ERRORS[0].error);
|
|
90
|
-
|
|
91
|
-
case 11:
|
|
92
|
-
case "end":
|
|
93
|
-
return _context2.stop();
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}, _callee2);
|
|
97
|
-
})));
|
|
98
|
-
});
|
package/dist/json/firstForm.json
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"id": "firstForm",
|
|
3
|
-
"version": "1",
|
|
4
|
-
"name": "firstForm",
|
|
5
|
-
"title": "First form",
|
|
6
|
-
"type": "cya",
|
|
7
|
-
"components": [
|
|
8
|
-
{
|
|
9
|
-
"id": "firstName",
|
|
10
|
-
"fieldId": "firstName",
|
|
11
|
-
"label": "First name",
|
|
12
|
-
"type": "text",
|
|
13
|
-
"required": true
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"id": "surname",
|
|
17
|
-
"fieldId": "surname",
|
|
18
|
-
"label": "Last name",
|
|
19
|
-
"type": "text",
|
|
20
|
-
"required": true
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"id": "age",
|
|
24
|
-
"fieldId": "age",
|
|
25
|
-
"label": "Your age",
|
|
26
|
-
"type": "text",
|
|
27
|
-
"required": true
|
|
28
|
-
}
|
|
29
|
-
],
|
|
30
|
-
"pages": [
|
|
31
|
-
{
|
|
32
|
-
"id": "before",
|
|
33
|
-
"name": "before",
|
|
34
|
-
"title": "Before you start",
|
|
35
|
-
"components": [
|
|
36
|
-
"This is a sample form to prove out the mechanism for save and continue.",
|
|
37
|
-
"When you click on the Start button, a new business key should be generated for this form.",
|
|
38
|
-
{
|
|
39
|
-
"type": "inset-text",
|
|
40
|
-
"content": "Generating a business key is non-reversible and cancelling the form creation will leave a gap."
|
|
41
|
-
},
|
|
42
|
-
"If you are happy to proceed, click start now."
|
|
43
|
-
],
|
|
44
|
-
"actions": [
|
|
45
|
-
{ "type": "navigate", "page": "firstName", "start": true, "label": "Start now" }
|
|
46
|
-
],
|
|
47
|
-
"show_on_cya": false
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"id": "firstName",
|
|
51
|
-
"name": "firstName",
|
|
52
|
-
"title": "Enter first name",
|
|
53
|
-
"components": [
|
|
54
|
-
{ "use": "firstName", "label": "" }
|
|
55
|
-
],
|
|
56
|
-
"actions": [ "saveAndContinue", "saveAndReturn" ],
|
|
57
|
-
"cya_link": {
|
|
58
|
-
"page": "firstName",
|
|
59
|
-
"aria_suffix": "your first name"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"id": "surname",
|
|
64
|
-
"name": "surname",
|
|
65
|
-
"title": "Enter surname",
|
|
66
|
-
"components": [
|
|
67
|
-
{ "use": "surname", "label": "" }
|
|
68
|
-
],
|
|
69
|
-
"actions": [ "saveAndContinue", "saveAndReturn" ],
|
|
70
|
-
"cya_link": {
|
|
71
|
-
"page": "surname",
|
|
72
|
-
"aria_suffix": "your surname"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"id": "age",
|
|
77
|
-
"name": "age",
|
|
78
|
-
"title": "Enter age",
|
|
79
|
-
"components": [
|
|
80
|
-
{ "use": "age", "label": "" }
|
|
81
|
-
],
|
|
82
|
-
"actions": [ "saveAndContinue", "saveAndReturn" ],
|
|
83
|
-
"cya_link": {
|
|
84
|
-
"page": "age",
|
|
85
|
-
"aria_suffix": "your first name"
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
"cya": {
|
|
90
|
-
"actions": [
|
|
91
|
-
{ "type": "submit", "label": "Submit", "validate": true }
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
}
|
package/dist/json/grade.json
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"data": [
|
|
3
|
-
{
|
|
4
|
-
"id": "373979c1-2360-46be-b712-0409ac068059",
|
|
5
|
-
"name": "SCS4",
|
|
6
|
-
"parentgradetypeid": null,
|
|
7
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
8
|
-
"validto": null,
|
|
9
|
-
"updatedby": null
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"id": "36c80dfe-0aae-455b-9445-2e1c09dcafdc",
|
|
13
|
-
"name": "SCS3",
|
|
14
|
-
"parentgradetypeid": "373979c1-2360-46be-b712-0409ac068059",
|
|
15
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
16
|
-
"validto": null,
|
|
17
|
-
"updatedby": null
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"id": "1b041cda-b151-4769-b76a-d42d67b0b960",
|
|
21
|
-
"name": "Senior Director / SCS2",
|
|
22
|
-
"parentgradetypeid": "36c80dfe-0aae-455b-9445-2e1c09dcafdc",
|
|
23
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
24
|
-
"validto": null,
|
|
25
|
-
"updatedby": null
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"id": "172de41d-f7b0-4be9-b7e8-0cf4f1a1342f",
|
|
29
|
-
"name": "Director / SCS1",
|
|
30
|
-
"parentgradetypeid": "1b041cda-b151-4769-b76a-d42d67b0b960",
|
|
31
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
32
|
-
"validto": null,
|
|
33
|
-
"updatedby": null
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"id": "39e18b45-0358-4a45-83ec-5a70b74641e8",
|
|
37
|
-
"name": "Deputy Director / Grade 6",
|
|
38
|
-
"parentgradetypeid": "172de41d-f7b0-4be9-b7e8-0cf4f1a1342f",
|
|
39
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
40
|
-
"validto": null,
|
|
41
|
-
"updatedby": null
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"id": "44855085-a36b-42e5-b805-f4ebe209ecf2",
|
|
45
|
-
"name": "Assistant Director / Grade 7",
|
|
46
|
-
"parentgradetypeid": "39e18b45-0358-4a45-83ec-5a70b74641e8",
|
|
47
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
48
|
-
"validto": null,
|
|
49
|
-
"updatedby": null
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
"id": "4fad1115-7d12-4b6f-8d8a-97dbe469a346",
|
|
53
|
-
"name": "Senior Officer / Senior Executive Officer",
|
|
54
|
-
"parentgradetypeid": "44855085-a36b-42e5-b805-f4ebe209ecf2",
|
|
55
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
56
|
-
"validto": null,
|
|
57
|
-
"updatedby": null
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"id": "b512288d-95e3-4f60-ad4c-4cdfab68d841",
|
|
61
|
-
"name": "Higher Officer / Higher Executive Officer",
|
|
62
|
-
"parentgradetypeid": "4fad1115-7d12-4b6f-8d8a-97dbe469a346",
|
|
63
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
64
|
-
"validto": null,
|
|
65
|
-
"updatedby": null
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"id": "1c140011-46ad-4a5d-af25-e80a6fcdcdba",
|
|
69
|
-
"name": "Officer / Executive Officer",
|
|
70
|
-
"parentgradetypeid": "b512288d-95e3-4f60-ad4c-4cdfab68d841",
|
|
71
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
72
|
-
"validto": null,
|
|
73
|
-
"updatedby": null
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"id": "02de92d8-aad1-4663-a37f-a87012f60f1b",
|
|
77
|
-
"name": "Assistant Officer / Administrative Officer",
|
|
78
|
-
"parentgradetypeid": "1c140011-46ad-4a5d-af25-e80a6fcdcdba",
|
|
79
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
80
|
-
"validto": null,
|
|
81
|
-
"updatedby": null
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"id": "9910a29d-7fbb-451d-8729-f39f4373bbcc",
|
|
85
|
-
"name": "Assistant Office / Messenger",
|
|
86
|
-
"parentgradetypeid": "02de92d8-aad1-4663-a37f-a87012f60f1b",
|
|
87
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
88
|
-
"validto": null,
|
|
89
|
-
"updatedby": null
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"id": "073b92f8-7208-4026-a090-906c276079f1",
|
|
93
|
-
"name": "Contractor",
|
|
94
|
-
"parentgradetypeid": null,
|
|
95
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
96
|
-
"validto": null,
|
|
97
|
-
"updatedby": null
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"id": "c27cf914-0b97-4c4e-bb2d-2ae4b886baa5",
|
|
101
|
-
"name": "Agency Staff",
|
|
102
|
-
"parentgradetypeid": null,
|
|
103
|
-
"validfrom": "2019-01-01T00:01:00.000Z",
|
|
104
|
-
"validto": null,
|
|
105
|
-
"updatedby": null
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
}
|