@ukhomeoffice/cop-react-form-renderer 6.5.1-peter → 6.7.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 +12 -12
- package/dist/components/CheckYourAnswers/Answer.test.js +92 -127
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +101 -131
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +463 -769
- package/dist/components/CollectionPage/CollectionPage.js +73 -63
- package/dist/components/CollectionPage/CollectionPage.test.js +316 -366
- package/dist/components/CollectionSummary/BannerStrip.js +13 -13
- package/dist/components/CollectionSummary/BannerStrip.test.js +80 -76
- package/dist/components/CollectionSummary/CollectionSummary.js +97 -107
- package/dist/components/CollectionSummary/CollectionSummary.test.js +152 -142
- package/dist/components/CollectionSummary/Confirmation.js +14 -12
- package/dist/components/CollectionSummary/Confirmation.test.js +68 -63
- package/dist/components/CollectionSummary/RenderListView.js +45 -51
- package/dist/components/CollectionSummary/RenderListView.test.js +78 -77
- package/dist/components/CollectionSummary/SummaryCard.js +104 -135
- package/dist/components/CollectionSummary/SummaryCard.test.js +930 -962
- package/dist/components/CollectionSummary/SummaryCardDetails.js +72 -71
- package/dist/components/CollectionSummary/SummaryCardDetails.test.js +128 -135
- package/dist/components/CollectionSummary/SummaryCardValidationContext.js +30 -35
- package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +62 -74
- package/dist/components/FormComponent/Collection.js +74 -108
- package/dist/components/FormComponent/Collection.test.js +909 -1081
- package/dist/components/FormComponent/Container.js +40 -38
- package/dist/components/FormComponent/Container.test.js +314 -345
- package/dist/components/FormComponent/FormComponent.js +69 -72
- package/dist/components/FormComponent/FormComponent.test.js +353 -414
- package/dist/components/FormComponent/helpers/addLabel.js +4 -7
- package/dist/components/FormComponent/helpers/getComponentDisabled.js +1 -1
- package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +7 -7
- package/dist/components/FormComponent/helpers/getComponentError.js +3 -5
- package/dist/components/FormComponent/helpers/getComponentError.test.js +14 -14
- package/dist/components/FormComponent/helpers/getComponentFieldSet.js +3 -4
- package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +6 -6
- package/dist/components/FormComponent/helpers/index.js +4 -4
- package/dist/components/FormPage/FormPage.js +65 -80
- package/dist/components/FormPage/FormPage.test.js +127 -163
- package/dist/components/FormRenderer/FormRenderer.js +143 -179
- package/dist/components/FormRenderer/FormRenderer.test.js +730 -1115
- package/dist/components/FormRenderer/handlers/cyaAction.js +2 -2
- package/dist/components/FormRenderer/handlers/getPageId.js +1 -3
- package/dist/components/FormRenderer/handlers/getPageId.test.js +14 -14
- package/dist/components/FormRenderer/handlers/handlers.test.js +32 -32
- package/dist/components/FormRenderer/handlers/index.js +1 -1
- package/dist/components/FormRenderer/handlers/navigate.js +3 -3
- package/dist/components/FormRenderer/handlers/submissionError.js +1 -1
- package/dist/components/FormRenderer/helpers/canActionProceed.js +1 -1
- package/dist/components/FormRenderer/helpers/canActionProceed.test.js +15 -15
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +1 -3
- package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +16 -20
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +17 -22
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +16 -16
- package/dist/components/FormRenderer/helpers/getCYA.js +3 -5
- package/dist/components/FormRenderer/helpers/getCYA.test.js +11 -11
- package/dist/components/FormRenderer/helpers/getFormState.js +5 -7
- package/dist/components/FormRenderer/helpers/getFormState.test.js +10 -10
- package/dist/components/FormRenderer/helpers/getNextPageId.js +13 -24
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +67 -67
- package/dist/components/FormRenderer/helpers/getPage.js +2 -4
- package/dist/components/FormRenderer/helpers/getPage.test.js +11 -11
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +7 -9
- package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +14 -14
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +5 -5
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +103 -97
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +62 -60
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +71 -78
- package/dist/components/FormRenderer/helpers/index.js +2 -4
- package/dist/components/FormRenderer/onCYAAction.js +59 -51
- package/dist/components/FormRenderer/onCYAAction.test.js +164 -152
- package/dist/components/FormRenderer/onPageAction.js +44 -47
- package/dist/components/FormRenderer/onPageAction.test.js +223 -213
- package/dist/components/FormRenderer/onTaskAction.js +9 -13
- package/dist/components/FormRenderer/onTaskAction.test.js +93 -88
- package/dist/components/PageActions/ActionButton.js +12 -15
- package/dist/components/PageActions/ActionButton.test.js +56 -78
- package/dist/components/PageActions/PageActions.js +10 -10
- package/dist/components/PageActions/PageActions.test.js +86 -115
- package/dist/components/SummaryList/GroupAction.js +9 -17
- package/dist/components/SummaryList/GroupAction.test.js +37 -33
- package/dist/components/SummaryList/RowAction.js +11 -16
- package/dist/components/SummaryList/RowAction.test.js +37 -33
- package/dist/components/SummaryList/SummaryList.js +21 -26
- package/dist/components/SummaryList/SummaryList.test.js +143 -166
- package/dist/components/SummaryList/SummaryListHeadingRow.js +6 -4
- package/dist/components/SummaryList/SummaryListRow.js +6 -4
- package/dist/components/SummaryList/SummaryListTitleRow.js +5 -3
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +3 -5
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +22 -22
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +3 -5
- package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +22 -22
- package/dist/components/SummaryList/helpers/index.js +1 -1
- package/dist/components/TaskList/Task.js +19 -29
- package/dist/components/TaskList/Task.test.js +83 -76
- package/dist/components/TaskList/TaskList.js +45 -71
- package/dist/components/TaskList/TaskList.test.js +113 -111
- package/dist/components/TaskList/TaskState.js +7 -5
- package/dist/components/TaskList/TaskState.test.js +52 -45
- package/dist/components/index.js +7 -7
- package/dist/context/HooksContext/HooksContext.js +57 -80
- package/dist/context/HooksContext/HooksContext.test.js +26 -35
- package/dist/context/HooksContext/index.js +3 -4
- package/dist/context/ValidationContext/ValidationContext.js +43 -94
- package/dist/context/ValidationContext/ValidationContext.test.js +56 -68
- package/dist/context/ValidationContext/index.js +3 -4
- package/dist/context/index.js +2 -2
- package/dist/hooks/index.js +9 -10
- package/dist/hooks/useAxios.js +14 -40
- package/dist/hooks/useGetRequest.js +61 -97
- package/dist/hooks/useHooks.js +1 -3
- package/dist/hooks/useRefData.js +26 -39
- package/dist/hooks/useValidation.js +1 -3
- package/dist/index.js +13 -14
- package/dist/models/CollectionLabels.js +1 -1
- package/dist/models/ComponentTypes.js +25 -25
- package/dist/models/EventTypes.js +4 -4
- package/dist/models/FormPages.js +4 -4
- package/dist/models/FormTypes.js +8 -8
- package/dist/models/HubFormats.js +3 -3
- package/dist/models/PageAction.js +44 -38
- package/dist/models/TaskStates.js +29 -28
- package/dist/models/index.js +9 -9
- package/dist/setupTests.js +30 -31
- package/dist/utils/CheckYourAnswers/getCYAAction.js +5 -5
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +52 -54
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +15 -25
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +33 -35
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +17 -31
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +42 -44
- package/dist/utils/CheckYourAnswers/getCYARow.js +6 -6
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +86 -86
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +18 -24
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +15 -16
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +33 -36
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +58 -61
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +83 -89
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +164 -138
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +25 -20
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +103 -97
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +13 -18
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +70 -76
- package/dist/utils/CheckYourAnswers/getComponentRowForCYA.js +11 -11
- package/dist/utils/CheckYourAnswers/getComponentRowForCYA.test.js +7 -7
- package/dist/utils/CheckYourAnswers/index.js +1 -1
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +4 -4
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +25 -25
- package/dist/utils/CollectionPage/addCollectionPageEntry.js +2 -2
- package/dist/utils/CollectionPage/addCollectionPageEntry.test.js +5 -5
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +2 -2
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +17 -18
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +18 -20
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +55 -26
- package/dist/utils/CollectionPage/getCollectionPageActiveId.js +2 -2
- package/dist/utils/CollectionPage/getCollectionPageActiveId.test.js +10 -10
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +7 -11
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +22 -22
- package/dist/utils/CollectionPage/getCollectionPageData.js +8 -12
- package/dist/utils/CollectionPage/getCollectionPageData.test.js +19 -19
- package/dist/utils/CollectionPage/getErrorsForCollection.js +24 -24
- package/dist/utils/CollectionPage/getErrorsForCollection.test.js +20 -22
- package/dist/utils/CollectionPage/getQuickEditPage.js +36 -28
- package/dist/utils/CollectionPage/getQuickEditPage.test.js +26 -45
- package/dist/utils/CollectionPage/index.js +1 -1
- package/dist/utils/CollectionPage/mergeCollectionPages.js +31 -35
- package/dist/utils/CollectionPage/mergeCollectionPages.test.js +20 -20
- package/dist/utils/CollectionPage/removeCollectionPageEntry.js +4 -6
- package/dist/utils/CollectionPage/removeCollectionPageEntry.test.js +10 -10
- package/dist/utils/CollectionPage/setCollectionPageData.js +10 -16
- package/dist/utils/CollectionPage/setCollectionPageData.test.js +24 -24
- package/dist/utils/Component/addShowWhen.js +4 -8
- package/dist/utils/Component/addShowWhen.test.js +37 -37
- package/dist/utils/Component/applyToComponentTree.js +18 -18
- package/dist/utils/Component/applyToComponentTree.test.js +27 -32
- package/dist/utils/Component/cleanAttributes.js +10 -13
- package/dist/utils/Component/cleanAttributes.test.js +17 -18
- package/dist/utils/Component/elevateNestedComponents.js +5 -5
- package/dist/utils/Component/elevateNestedComponents.test.js +30 -30
- package/dist/utils/Component/getComponent.js +88 -94
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +18 -17
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +46 -59
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +39 -48
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +23 -33
- package/dist/utils/Component/getComponentTests/getComponent.details.test.js +20 -18
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +17 -22
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +20 -25
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +10 -9
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +17 -15
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +9 -8
- package/dist/utils/Component/getComponentTests/getComponent.list.test.js +17 -15
- package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +22 -26
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +155 -175
- package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +17 -15
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +17 -22
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +57 -72
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +17 -22
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +17 -22
- package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +31 -38
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +20 -29
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +2 -2
- package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +9 -8
- package/dist/utils/Component/getDefaultValue.js +6 -8
- package/dist/utils/Component/getDefaultValue.test.js +12 -12
- package/dist/utils/Component/getDefaultValueFromConfig.js +22 -21
- package/dist/utils/Component/getDefaultValueFromConfig.test.js +31 -31
- package/dist/utils/Component/index.js +1 -1
- package/dist/utils/Component/isEditable.js +2 -4
- package/dist/utils/Component/isEditable.test.js +14 -15
- package/dist/utils/Component/optionIsSelected.js +1 -1
- package/dist/utils/Component/optionIsSelected.test.js +9 -9
- package/dist/utils/Component/setupContainerComponentsPath.js +27 -29
- package/dist/utils/Component/setupContainerComponentsPath.test.js +11 -11
- package/dist/utils/Component/showComponent.js +1 -1
- package/dist/utils/Component/showComponent.test.js +28 -28
- package/dist/utils/Component/wrapInFormGroup.js +2 -2
- package/dist/utils/Condition/index.js +1 -1
- package/dist/utils/Condition/meetsAllConditions.js +8 -8
- package/dist/utils/Condition/meetsAllConditions.test.js +20 -20
- package/dist/utils/Condition/meetsCondition.js +16 -25
- package/dist/utils/Condition/meetsCondition.test.js +402 -402
- package/dist/utils/Condition/meetsOneCondition.js +5 -5
- package/dist/utils/Condition/meetsOneCondition.test.js +16 -16
- package/dist/utils/Condition/setupConditions.js +13 -18
- package/dist/utils/Condition/setupConditions.test.js +7 -7
- package/dist/utils/Container/getEditableComponents.js +3 -5
- package/dist/utils/Container/getEditableComponents.test.js +43 -45
- package/dist/utils/Container/index.js +1 -1
- package/dist/utils/Container/setupNesting.js +16 -20
- package/dist/utils/Container/setupNesting.test.js +27 -30
- package/dist/utils/Container/showContainer.js +3 -7
- package/dist/utils/Container/showContainer.test.js +30 -30
- package/dist/utils/Data/applyFormula.js +38 -48
- package/dist/utils/Data/applyFormula.test.js +20 -20
- package/dist/utils/Data/getAutocompleteSource.js +18 -26
- package/dist/utils/Data/getAutocompleteSource.test.js +80 -86
- package/dist/utils/Data/getDataPath.js +18 -28
- package/dist/utils/Data/getDataPath.test.js +12 -12
- package/dist/utils/Data/getOptions.js +24 -30
- package/dist/utils/Data/getOptions.test.js +27 -27
- package/dist/utils/Data/getSourceData.js +6 -19
- package/dist/utils/Data/getSourceData.test.js +84 -80
- package/dist/utils/Data/index.js +1 -1
- package/dist/utils/Data/nestInRefdataOptions.js +9 -16
- package/dist/utils/Data/nestInRefdataOptions.test.js +16 -16
- package/dist/utils/Data/refDataToOptions.js +10 -13
- package/dist/utils/Data/refDataToOptions.test.js +19 -19
- package/dist/utils/Data/setDataItem.js +7 -8
- package/dist/utils/Data/setDataItem.test.js +37 -37
- package/dist/utils/Data/setupFormData.js +13 -21
- package/dist/utils/Data/setupFormData.test.js +51 -50
- package/dist/utils/Data/setupRefDataUrlForComponent.js +20 -26
- package/dist/utils/Data/setupRefDataUrlForComponent.test.js +24 -24
- package/dist/utils/FormPage/applyConditionalProperties.js +5 -9
- package/dist/utils/FormPage/applyConditionalProperties.test.js +15 -18
- package/dist/utils/FormPage/getConditionalText.js +3 -3
- package/dist/utils/FormPage/getConditionalText.test.js +29 -29
- package/dist/utils/FormPage/getFormPage.js +15 -16
- package/dist/utils/FormPage/getFormPage.test.js +47 -46
- package/dist/utils/FormPage/getFormPages.js +7 -12
- package/dist/utils/FormPage/getFormPages.test.js +20 -23
- package/dist/utils/FormPage/getPageActions.js +9 -15
- package/dist/utils/FormPage/getPageActions.test.js +32 -32
- package/dist/utils/FormPage/getParagraphFromText.js +5 -7
- package/dist/utils/FormPage/getParagraphFromText.test.js +6 -6
- package/dist/utils/FormPage/index.js +2 -4
- package/dist/utils/FormPage/showFormPage.js +3 -7
- package/dist/utils/FormPage/showFormPage.test.js +32 -32
- package/dist/utils/FormPage/showFormPageCYA.js +1 -1
- package/dist/utils/FormPage/showFormPageCYA.test.js +8 -8
- package/dist/utils/FormPage/useComponent.js +21 -28
- package/dist/utils/FormPage/useComponent.test.js +77 -79
- package/dist/utils/Format/formatData.js +1 -1
- package/dist/utils/Format/formatData.test.js +18 -18
- package/dist/utils/Format/formatDataForComponent.js +5 -6
- package/dist/utils/Format/formatDataForComponent.test.js +50 -78
- package/dist/utils/Format/formatDataForForm.js +6 -8
- package/dist/utils/Format/formatDataForForm.test.js +13 -16
- package/dist/utils/Format/formatDataForPage.js +4 -5
- package/dist/utils/Format/formatDataForPage.test.js +20 -25
- package/dist/utils/Format/index.js +1 -1
- package/dist/utils/Hub/getFormHub.js +1 -1
- package/dist/utils/Hub/getFormHub.test.js +28 -31
- package/dist/utils/Hub/index.js +1 -1
- package/dist/utils/Meta/constants.js +2 -2
- package/dist/utils/Meta/documents/getDocuments.js +1 -1
- package/dist/utils/Meta/documents/getDocuments.test.js +24 -16
- package/dist/utils/Meta/documents/index.js +1 -1
- package/dist/utils/Meta/documents/setDocumentsForField.js +14 -16
- package/dist/utils/Meta/documents/setDocumentsForField.test.js +68 -34
- package/dist/utils/Meta/index.js +1 -1
- package/dist/utils/Operate/checkValueIsTruthy.js +2 -2
- package/dist/utils/Operate/checkValueIsTruthy.test.js +16 -16
- package/dist/utils/Operate/getFirstOf.js +5 -5
- package/dist/utils/Operate/getFirstOf.test.js +31 -31
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +10 -10
- package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +46 -52
- package/dist/utils/Operate/index.js +1 -1
- package/dist/utils/Operate/persistValueInFormData.js +3 -3
- package/dist/utils/Operate/persistValueInFormData.test.js +22 -20
- package/dist/utils/Operate/runPageOperations.js +7 -7
- package/dist/utils/Operate/runPageOperations.test.js +35 -36
- package/dist/utils/Operate/setValueInFormData.js +2 -2
- package/dist/utils/Operate/setValueInFormData.test.js +16 -16
- package/dist/utils/Operate/shouldRun.js +6 -6
- package/dist/utils/Operate/shouldRun.test.js +21 -27
- package/dist/utils/Validate/additional/conditionallyRequired.js +4 -4
- package/dist/utils/Validate/additional/conditionallyRequired.test.js +18 -18
- package/dist/utils/Validate/additional/index.js +6 -6
- package/dist/utils/Validate/additional/index.test.js +12 -12
- package/dist/utils/Validate/additional/mustBeAfter.js +2 -2
- package/dist/utils/Validate/additional/mustBeAfter.test.js +40 -40
- package/dist/utils/Validate/additional/mustBeBefore.js +2 -2
- package/dist/utils/Validate/additional/mustBeBefore.test.js +28 -28
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +7 -11
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +37 -41
- package/dist/utils/Validate/additional/mustBeGreaterThan.js +2 -2
- package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +18 -18
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +2 -2
- package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +12 -12
- package/dist/utils/Validate/additional/mustBeInThePast.js +3 -3
- package/dist/utils/Validate/additional/mustBeInThePast.test.js +12 -12
- package/dist/utils/Validate/additional/mustBeLessThan.js +2 -2
- package/dist/utils/Validate/additional/mustBeLessThan.test.js +17 -17
- package/dist/utils/Validate/additional/mustBeLongerThan.js +1 -1
- package/dist/utils/Validate/additional/mustBeLongerThan.test.js +16 -16
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +2 -2
- package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +20 -20
- package/dist/utils/Validate/additional/mustBeShorterThan.js +1 -1
- package/dist/utils/Validate/additional/mustBeShorterThan.test.js +16 -16
- package/dist/utils/Validate/additional/mustBeUniqueInCollection.js +8 -4
- package/dist/utils/Validate/additional/mustBeUniqueInCollection.test.js +64 -32
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +2 -2
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +14 -16
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +1 -1
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +12 -12
- package/dist/utils/Validate/additional/mustNotContainSql.js +3 -4
- package/dist/utils/Validate/additional/mustNotContainSql.test.js +14 -14
- package/dist/utils/Validate/additional/mustSelectOnlyOne.js +2 -2
- package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +28 -26
- package/dist/utils/Validate/additional/utils.js +9 -22
- package/dist/utils/Validate/index.js +1 -1
- package/dist/utils/Validate/validateCollection.js +19 -25
- package/dist/utils/Validate/validateCollection.test.js +74 -66
- package/dist/utils/Validate/validateComponent.js +17 -15
- package/dist/utils/Validate/validateComponent.test.js +167 -146
- package/dist/utils/Validate/validateContainer.js +15 -20
- package/dist/utils/Validate/validateContainer.test.js +58 -52
- package/dist/utils/Validate/validateDate.js +15 -21
- package/dist/utils/Validate/validateDate.test.js +31 -32
- package/dist/utils/Validate/validateEmail.js +6 -8
- package/dist/utils/Validate/validateEmail.test.js +25 -25
- package/dist/utils/Validate/validateMultifile.js +5 -7
- package/dist/utils/Validate/validateMultifile.test.js +17 -18
- package/dist/utils/Validate/validatePage.js +19 -22
- package/dist/utils/Validate/validatePage.test.js +215 -203
- package/dist/utils/Validate/validateRegex.js +3 -5
- package/dist/utils/Validate/validateRegex.test.js +14 -14
- package/dist/utils/Validate/validateRequired.js +4 -6
- package/dist/utils/Validate/validateRequired.test.js +18 -18
- package/dist/utils/Validate/validateTextArea.js +4 -6
- package/dist/utils/Validate/validateTextArea.test.js +20 -20
- package/dist/utils/Validate/validateTime.js +11 -18
- package/dist/utils/Validate/validateTime.test.js +16 -16
- package/dist/utils/index.js +7 -9
- package/package.json +2 -2
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/component-used-in-multiple-pages-data.json +0 -4
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/component-used-in-multiple-pages-form.json +0 -61
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-airpax-after.json +0 -429
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-airpax-before.json +0 -449
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-airpax-form.json +0 -15219
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-eab-2-data-after.json +0 -516
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-eab-2-data-before.json +0 -593
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-eab2-form.json +0 -15219
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-mandec-data-after.json +0 -84
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-mandec-data-before.json +0 -98
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/cop-mandec-form.json +0 -9158
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-collection-data-removed.json +0 -4
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-collections.json +0 -8
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-components-removed.json +0 -3
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-components.json +0 -5
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-entire-collection-removed.json +0 -3
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-nested-component-removed.json +0 -10
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/data-with-nested-components.json +0 -11
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-for-nested-components.json +0 -96
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-with-collections-delete-entire.json +0 -47
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-with-collections.json +0 -46
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/form-with-components.json +0 -48
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/test.json +0 -1605
- package/dist/components/FormRenderer/clear-uncompleted-routes/test-data/test2.json +0 -205
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.js +0 -206
- package/dist/components/FormRenderer/helpers/clearOutUncompletedRoutes.test.js +0 -143
- package/dist/components/FormRenderer/helpers/deleteNodeByPath.js +0 -26
- package/dist/components/FormRenderer/helpers/deleteNodeByPath.test.js +0 -56
|
@@ -6,87 +6,75 @@ var _handlers = _interopRequireDefault(require("./handlers"));
|
|
|
6
6
|
var _helpers = _interopRequireDefault(require("./helpers"));
|
|
7
7
|
var _onCYAAction = _interopRequireDefault(require("./onCYAAction"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
submissionErrorCalls: 0,
|
|
18
|
-
submissionErrorArgs: [],
|
|
19
|
-
submissionError: function submissionError(errors, addErrors) {
|
|
20
|
-
this.submissionErrorCalls += 1;
|
|
21
|
-
this.submissionErrorArgs.push(errors);
|
|
22
|
-
if (typeof addErrors === 'function') {
|
|
23
|
-
addErrors(errors);
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
reset: function reset() {
|
|
27
|
-
this.submissionErrorCalls = 0;
|
|
28
|
-
this.submissionErrorArgs = [];
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
});
|
|
32
|
-
jest.mock('./helpers', function () {
|
|
33
|
-
return {
|
|
34
|
-
canCYASubmitResult: true,
|
|
35
|
-
canCYASubmitCalls: 0,
|
|
36
|
-
canCYASubmit: function canCYASubmit() {
|
|
37
|
-
this.canCYASubmitCalls += 1;
|
|
38
|
-
return this.canCYASubmitResult;
|
|
39
|
-
},
|
|
40
|
-
getNextPageIdCalls: 0,
|
|
41
|
-
getNextPageId: function getNextPageId() {
|
|
42
|
-
this.getNextPageIdCalls += 1;
|
|
43
|
-
return 'page2';
|
|
44
|
-
},
|
|
45
|
-
getFormStateCalls: 0,
|
|
46
|
-
getFormState: function getFormState() {
|
|
47
|
-
this.getFormStateCalls += 1;
|
|
48
|
-
return {};
|
|
49
|
-
},
|
|
50
|
-
getSubmissionStatusCalls: 0,
|
|
51
|
-
getSubmissionStatus: function getSubmissionStatus() {
|
|
52
|
-
this.getSubmissionStatusCalls += 1;
|
|
53
|
-
return 'Good to go!';
|
|
54
|
-
},
|
|
55
|
-
reset: function reset() {
|
|
56
|
-
this.canCYASubmitCalls = 0;
|
|
57
|
-
this.canCYASubmitResult = true;
|
|
58
|
-
this.getFormStateCalls = 0;
|
|
59
|
-
this.getNextPageIdCalls = 0;
|
|
60
|
-
this.getFormStateCalls = 0;
|
|
61
|
-
this.getSubmissionStatusCalls = 0;
|
|
9
|
+
jest.mock('./handlers', () => ({
|
|
10
|
+
submissionErrorCalls: 0,
|
|
11
|
+
submissionErrorArgs: [],
|
|
12
|
+
submissionError(errors, addErrors) {
|
|
13
|
+
this.submissionErrorCalls += 1;
|
|
14
|
+
this.submissionErrorArgs.push(errors);
|
|
15
|
+
if (typeof addErrors === 'function') {
|
|
16
|
+
addErrors(errors);
|
|
62
17
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
18
|
+
},
|
|
19
|
+
reset() {
|
|
20
|
+
this.submissionErrorCalls = 0;
|
|
21
|
+
this.submissionErrorArgs = [];
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
24
|
+
jest.mock('./helpers', () => ({
|
|
25
|
+
canCYASubmitResult: true,
|
|
26
|
+
canCYASubmitCalls: 0,
|
|
27
|
+
canCYASubmit() {
|
|
28
|
+
this.canCYASubmitCalls += 1;
|
|
29
|
+
return this.canCYASubmitResult;
|
|
30
|
+
},
|
|
31
|
+
getNextPageIdCalls: 0,
|
|
32
|
+
getNextPageId() {
|
|
33
|
+
this.getNextPageIdCalls += 1;
|
|
34
|
+
return 'page2';
|
|
35
|
+
},
|
|
36
|
+
getFormStateCalls: 0,
|
|
37
|
+
getFormState() {
|
|
38
|
+
this.getFormStateCalls += 1;
|
|
39
|
+
return {};
|
|
40
|
+
},
|
|
41
|
+
getSubmissionStatusCalls: 0,
|
|
42
|
+
getSubmissionStatus() {
|
|
43
|
+
this.getSubmissionStatusCalls += 1;
|
|
44
|
+
return 'Good to go!';
|
|
45
|
+
},
|
|
46
|
+
reset() {
|
|
47
|
+
this.canCYASubmitCalls = 0;
|
|
48
|
+
this.canCYASubmitResult = true;
|
|
49
|
+
this.getFormStateCalls = 0;
|
|
50
|
+
this.getNextPageIdCalls = 0;
|
|
51
|
+
this.getFormStateCalls = 0;
|
|
52
|
+
this.getSubmissionStatusCalls = 0;
|
|
53
|
+
}
|
|
54
|
+
}));
|
|
55
|
+
jest.mock('../../utils', () => ({
|
|
56
|
+
Format: {
|
|
57
|
+
formCalls: 0,
|
|
58
|
+
form() {
|
|
59
|
+
this.formCalls += 1;
|
|
60
|
+
return {
|
|
61
|
+
id: 'formId'
|
|
62
|
+
};
|
|
78
63
|
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
64
|
+
},
|
|
65
|
+
reset() {
|
|
66
|
+
this.Format.formCalls = 0;
|
|
67
|
+
}
|
|
68
|
+
}));
|
|
69
|
+
describe('components.FormRenderer.onCYAAction', () => {
|
|
70
|
+
const MOCK_HOOKS = {
|
|
83
71
|
onSubmitCalls: 0,
|
|
84
72
|
onSubmitArgs: [],
|
|
85
|
-
onSubmit
|
|
73
|
+
onSubmit(type, payload, onSuccess, onError) {
|
|
86
74
|
this.onSubmitCalls += 1;
|
|
87
75
|
this.onSubmitArgs.push({
|
|
88
|
-
type
|
|
89
|
-
payload
|
|
76
|
+
type,
|
|
77
|
+
payload
|
|
90
78
|
});
|
|
91
79
|
if (typeof onSuccess === 'function') {
|
|
92
80
|
onSuccess();
|
|
@@ -99,49 +87,49 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
99
87
|
}
|
|
100
88
|
},
|
|
101
89
|
onFormCompleteCalls: 0,
|
|
102
|
-
onFormComplete
|
|
90
|
+
onFormComplete() {
|
|
103
91
|
this.onFormCompleteCalls += 1;
|
|
104
92
|
},
|
|
105
93
|
onCancelArgs: [],
|
|
106
|
-
onCancel
|
|
94
|
+
onCancel(data) {
|
|
107
95
|
this.onCancelArgs.push(data);
|
|
108
96
|
},
|
|
109
|
-
reset
|
|
97
|
+
reset() {
|
|
110
98
|
this.onSubmitCalls = 0;
|
|
111
99
|
this.onSubmitArgs = [];
|
|
112
100
|
this.onFormCompleteCalls = 0;
|
|
113
101
|
this.onCancelArgs = [];
|
|
114
102
|
}
|
|
115
103
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
104
|
+
let setPagePointCalls = 0;
|
|
105
|
+
let setPagePointArgs = [];
|
|
106
|
+
const mockSetPagePoint = point => {
|
|
119
107
|
setPagePointCalls += 1;
|
|
120
108
|
setPagePointArgs.push(point);
|
|
121
109
|
};
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
110
|
+
let setDataCalls = 0;
|
|
111
|
+
let setDataArgs = [];
|
|
112
|
+
const mockSetData = data => {
|
|
125
113
|
setDataCalls += 1;
|
|
126
114
|
setDataArgs.push(data);
|
|
127
115
|
};
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
116
|
+
let onPageChangeCalls = 0;
|
|
117
|
+
let onPageChangeArgs = [];
|
|
118
|
+
const mockOnPageChange = pageId => {
|
|
131
119
|
onPageChangeCalls += 1;
|
|
132
120
|
onPageChangeArgs.push(pageId);
|
|
133
121
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
122
|
+
let addErrorsCalls = 0;
|
|
123
|
+
let addErrorsArgs = [];
|
|
124
|
+
const mockAddErrors = errors => {
|
|
137
125
|
addErrorsCalls += 1;
|
|
138
126
|
addErrorsArgs.push(errors);
|
|
139
127
|
};
|
|
140
|
-
|
|
141
|
-
|
|
128
|
+
let mockSubmitting = false;
|
|
129
|
+
const mockSetSubmitting = submitting => {
|
|
142
130
|
mockSubmitting = submitting;
|
|
143
131
|
};
|
|
144
|
-
|
|
132
|
+
const COMPONENTS = [{
|
|
145
133
|
id: 'alpha',
|
|
146
134
|
fieldId: 'alpha'
|
|
147
135
|
}, {
|
|
@@ -154,24 +142,32 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
154
142
|
id: 'delta',
|
|
155
143
|
fieldId: 'delta'
|
|
156
144
|
}];
|
|
157
|
-
|
|
145
|
+
const PAGES = [{
|
|
158
146
|
id: 'page1',
|
|
159
|
-
components: [
|
|
147
|
+
components: [{
|
|
148
|
+
...COMPONENTS[0]
|
|
149
|
+
}, {
|
|
150
|
+
...COMPONENTS[1]
|
|
151
|
+
}]
|
|
160
152
|
}, {
|
|
161
153
|
id: 'page2',
|
|
162
|
-
components: [
|
|
154
|
+
components: [{
|
|
155
|
+
...COMPONENTS[2]
|
|
156
|
+
}, {
|
|
157
|
+
...COMPONENTS[3]
|
|
158
|
+
}]
|
|
163
159
|
}];
|
|
164
|
-
|
|
160
|
+
const CURRENT_TASK = {
|
|
165
161
|
name: 'testTask',
|
|
166
162
|
fullPages: PAGES
|
|
167
163
|
};
|
|
168
|
-
|
|
164
|
+
const ARGS = {
|
|
169
165
|
setPagePoint: mockSetPagePoint,
|
|
170
166
|
action: {
|
|
171
167
|
type: _models.PageAction.TYPES.SUBMIT
|
|
172
168
|
},
|
|
173
169
|
pages: PAGES,
|
|
174
|
-
validate:
|
|
170
|
+
validate: () => {},
|
|
175
171
|
components: COMPONENTS,
|
|
176
172
|
data: {},
|
|
177
173
|
setData: mockSetData,
|
|
@@ -186,7 +182,7 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
186
182
|
submitting: mockSubmitting,
|
|
187
183
|
setSubmitting: mockSetSubmitting
|
|
188
184
|
};
|
|
189
|
-
beforeEach(
|
|
185
|
+
beforeEach(() => {
|
|
190
186
|
_handlers.default.reset();
|
|
191
187
|
_helpers.default.reset();
|
|
192
188
|
_utils.default.reset();
|
|
@@ -201,11 +197,12 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
201
197
|
addErrorsArgs = [];
|
|
202
198
|
mockSetSubmitting(false);
|
|
203
199
|
});
|
|
204
|
-
describe('with a page action of PageAction.TYPES.SUBMIT',
|
|
205
|
-
it('should handle a hub format of HubFormats.CYA',
|
|
206
|
-
|
|
200
|
+
describe('with a page action of PageAction.TYPES.SUBMIT', () => {
|
|
201
|
+
it('should handle a hub format of HubFormats.CYA', () => {
|
|
202
|
+
const CUSTOM_ARGS = {
|
|
203
|
+
...ARGS,
|
|
207
204
|
hub: _models.HubFormats.CYA
|
|
208
|
-
}
|
|
205
|
+
};
|
|
209
206
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
210
207
|
expect(setPagePointCalls).toEqual(1);
|
|
211
208
|
expect(setPagePointArgs[0]).toEqual('submit');
|
|
@@ -235,10 +232,11 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
235
232
|
expect(addErrorsCalls).toEqual(1);
|
|
236
233
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
237
234
|
});
|
|
238
|
-
it('should handle a hub format of HubFormats.TASK',
|
|
239
|
-
|
|
235
|
+
it('should handle a hub format of HubFormats.TASK', () => {
|
|
236
|
+
const CUSTOM_ARGS = {
|
|
237
|
+
...ARGS,
|
|
240
238
|
hub: _models.HubFormats.TASK
|
|
241
|
-
}
|
|
239
|
+
};
|
|
242
240
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
243
241
|
expect(setPagePointCalls).toEqual(1);
|
|
244
242
|
expect(setPagePointArgs[0]).toEqual('submit');
|
|
@@ -268,10 +266,11 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
268
266
|
expect(addErrorsCalls).toEqual(1);
|
|
269
267
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
270
268
|
});
|
|
271
|
-
it('should handle no hub',
|
|
272
|
-
|
|
269
|
+
it('should handle no hub', () => {
|
|
270
|
+
const CUSTOM_ARGS = {
|
|
271
|
+
...ARGS,
|
|
273
272
|
hub: null
|
|
274
|
-
}
|
|
273
|
+
};
|
|
275
274
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
276
275
|
expect(setPagePointCalls).toEqual(1);
|
|
277
276
|
expect(setPagePointArgs[0]).toEqual('submit');
|
|
@@ -301,14 +300,15 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
301
300
|
expect(addErrorsCalls).toEqual(1);
|
|
302
301
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
303
302
|
});
|
|
304
|
-
it('should not validate if action.validate is false and hub is HubFormats.TASK',
|
|
305
|
-
|
|
303
|
+
it('should not validate if action.validate is false and hub is HubFormats.TASK', () => {
|
|
304
|
+
const CUSTOM_ARGS = {
|
|
305
|
+
...ARGS,
|
|
306
306
|
action: {
|
|
307
307
|
type: _models.PageAction.TYPES.SUBMIT,
|
|
308
308
|
validate: false
|
|
309
309
|
},
|
|
310
310
|
hub: _models.HubFormats.TASK
|
|
311
|
-
}
|
|
311
|
+
};
|
|
312
312
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
313
313
|
|
|
314
314
|
// Validation.
|
|
@@ -333,14 +333,15 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
333
333
|
});
|
|
334
334
|
});
|
|
335
335
|
});
|
|
336
|
-
describe('with a page action of PageAction.TYPES.SAVE_AND_CONTINUE',
|
|
337
|
-
it('should validate if action.validate is not defined',
|
|
338
|
-
|
|
336
|
+
describe('with a page action of PageAction.TYPES.SAVE_AND_CONTINUE', () => {
|
|
337
|
+
it('should validate if action.validate is not defined', () => {
|
|
338
|
+
const CUSTOM_ARGS = {
|
|
339
|
+
...ARGS,
|
|
339
340
|
action: {
|
|
340
341
|
type: _models.PageAction.TYPES.SAVE_AND_CONTINUE
|
|
341
342
|
},
|
|
342
343
|
hub: _models.HubFormats.TASK
|
|
343
|
-
}
|
|
344
|
+
};
|
|
344
345
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
345
346
|
expect(_helpers.default.canCYASubmitCalls).toEqual(1); // Validating.
|
|
346
347
|
expect(_utils.default.Format.formCalls).toEqual(1);
|
|
@@ -369,14 +370,15 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
369
370
|
expect(addErrorsCalls).toEqual(1);
|
|
370
371
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
371
372
|
});
|
|
372
|
-
it('should validate if action.validate is true',
|
|
373
|
-
|
|
373
|
+
it('should validate if action.validate is true', () => {
|
|
374
|
+
const CUSTOM_ARGS = {
|
|
375
|
+
...ARGS,
|
|
374
376
|
action: {
|
|
375
377
|
type: _models.PageAction.TYPES.SAVE_AND_CONTINUE,
|
|
376
378
|
validate: true
|
|
377
379
|
},
|
|
378
380
|
hub: _models.HubFormats.TASK
|
|
379
|
-
}
|
|
381
|
+
};
|
|
380
382
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
381
383
|
expect(_helpers.default.canCYASubmitCalls).toEqual(1); // Validating.
|
|
382
384
|
expect(_utils.default.Format.formCalls).toEqual(1);
|
|
@@ -405,14 +407,15 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
405
407
|
expect(addErrorsCalls).toEqual(1);
|
|
406
408
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
407
409
|
});
|
|
408
|
-
it('should not validate if action.validate is false',
|
|
409
|
-
|
|
410
|
+
it('should not validate if action.validate is false', () => {
|
|
411
|
+
const CUSTOM_ARGS = {
|
|
412
|
+
...ARGS,
|
|
410
413
|
action: {
|
|
411
414
|
type: _models.PageAction.TYPES.SAVE_AND_CONTINUE,
|
|
412
415
|
validate: false
|
|
413
416
|
},
|
|
414
417
|
hub: _models.HubFormats.TASK
|
|
415
|
-
}
|
|
418
|
+
};
|
|
416
419
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
417
420
|
|
|
418
421
|
// Validation.
|
|
@@ -447,15 +450,16 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
447
450
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
448
451
|
});
|
|
449
452
|
});
|
|
450
|
-
describe('with a page action of PageAction.TYPES.SAVE_AND_NAVIGATE',
|
|
451
|
-
it('should validate if action.validate is not defined',
|
|
452
|
-
|
|
453
|
+
describe('with a page action of PageAction.TYPES.SAVE_AND_NAVIGATE', () => {
|
|
454
|
+
it('should validate if action.validate is not defined', () => {
|
|
455
|
+
const CUSTOM_ARGS = {
|
|
456
|
+
...ARGS,
|
|
453
457
|
action: {
|
|
454
458
|
type: _models.PageAction.TYPES.SAVE_AND_NAVIGATE,
|
|
455
459
|
page: 'testPage'
|
|
456
460
|
},
|
|
457
461
|
hub: _models.HubFormats.TASK
|
|
458
|
-
}
|
|
462
|
+
};
|
|
459
463
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
460
464
|
expect(_helpers.default.canCYASubmitCalls).toEqual(1); // Validating.
|
|
461
465
|
expect(_utils.default.Format.formCalls).toEqual(1);
|
|
@@ -484,15 +488,16 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
484
488
|
expect(addErrorsCalls).toEqual(1);
|
|
485
489
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
486
490
|
});
|
|
487
|
-
it('should validate if action.validate is true',
|
|
488
|
-
|
|
491
|
+
it('should validate if action.validate is true', () => {
|
|
492
|
+
const CUSTOM_ARGS = {
|
|
493
|
+
...ARGS,
|
|
489
494
|
action: {
|
|
490
495
|
type: _models.PageAction.TYPES.SAVE_AND_NAVIGATE,
|
|
491
496
|
page: 'testPage',
|
|
492
497
|
validate: true
|
|
493
498
|
},
|
|
494
499
|
hub: _models.HubFormats.TASK
|
|
495
|
-
}
|
|
500
|
+
};
|
|
496
501
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
497
502
|
expect(_helpers.default.canCYASubmitCalls).toEqual(1); // Validating.
|
|
498
503
|
expect(_utils.default.Format.formCalls).toEqual(1);
|
|
@@ -521,15 +526,16 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
521
526
|
expect(addErrorsCalls).toEqual(1);
|
|
522
527
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
523
528
|
});
|
|
524
|
-
it('should not validate if action.validate is false',
|
|
525
|
-
|
|
529
|
+
it('should not validate if action.validate is false', () => {
|
|
530
|
+
const CUSTOM_ARGS = {
|
|
531
|
+
...ARGS,
|
|
526
532
|
action: {
|
|
527
533
|
type: _models.PageAction.TYPES.SAVE_AND_NAVIGATE,
|
|
528
534
|
page: 'testPage',
|
|
529
535
|
validate: false
|
|
530
536
|
},
|
|
531
537
|
hub: _models.HubFormats.TASK
|
|
532
|
-
}
|
|
538
|
+
};
|
|
533
539
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
534
540
|
|
|
535
541
|
// Validation.
|
|
@@ -564,14 +570,15 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
564
570
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
565
571
|
});
|
|
566
572
|
});
|
|
567
|
-
describe('with an action type of PageAction.TYPES.SAVE_AND_RETURN',
|
|
568
|
-
it('should validate if action.validate is not defined',
|
|
569
|
-
|
|
573
|
+
describe('with an action type of PageAction.TYPES.SAVE_AND_RETURN', () => {
|
|
574
|
+
it('should validate if action.validate is not defined', () => {
|
|
575
|
+
const CUSTOM_ARGS = {
|
|
576
|
+
...ARGS,
|
|
570
577
|
action: {
|
|
571
578
|
type: _models.PageAction.TYPES.SAVE_AND_RETURN
|
|
572
579
|
},
|
|
573
580
|
hub: _models.HubFormats.TASK
|
|
574
|
-
}
|
|
581
|
+
};
|
|
575
582
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
576
583
|
expect(_helpers.default.canCYASubmitCalls).toEqual(1); // Validating.
|
|
577
584
|
expect(_utils.default.Format.formCalls).toEqual(1);
|
|
@@ -600,14 +607,15 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
600
607
|
expect(addErrorsCalls).toEqual(1);
|
|
601
608
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
602
609
|
});
|
|
603
|
-
it('should validate if action.validate is true',
|
|
604
|
-
|
|
610
|
+
it('should validate if action.validate is true', () => {
|
|
611
|
+
const CUSTOM_ARGS = {
|
|
612
|
+
...ARGS,
|
|
605
613
|
action: {
|
|
606
614
|
type: _models.PageAction.TYPES.SAVE_AND_RETURN,
|
|
607
615
|
validate: true
|
|
608
616
|
},
|
|
609
617
|
hub: _models.HubFormats.TASK
|
|
610
|
-
}
|
|
618
|
+
};
|
|
611
619
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
612
620
|
expect(_helpers.default.canCYASubmitCalls).toEqual(1); // Validating.
|
|
613
621
|
expect(_utils.default.Format.formCalls).toEqual(1);
|
|
@@ -636,14 +644,15 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
636
644
|
expect(addErrorsCalls).toEqual(1);
|
|
637
645
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
638
646
|
});
|
|
639
|
-
it('should not validate if action.validate is false',
|
|
640
|
-
|
|
647
|
+
it('should not validate if action.validate is false', () => {
|
|
648
|
+
const CUSTOM_ARGS = {
|
|
649
|
+
...ARGS,
|
|
641
650
|
action: {
|
|
642
651
|
type: _models.PageAction.TYPES.SAVE_AND_RETURN,
|
|
643
652
|
validate: false
|
|
644
653
|
},
|
|
645
654
|
hub: _models.HubFormats.TASK
|
|
646
|
-
}
|
|
655
|
+
};
|
|
647
656
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
648
657
|
|
|
649
658
|
// Validation.
|
|
@@ -677,15 +686,16 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
677
686
|
expect(addErrorsCalls).toEqual(1);
|
|
678
687
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
679
688
|
});
|
|
680
|
-
it('should call onPageChange with undefined if type is FormTypes.TASK',
|
|
681
|
-
|
|
689
|
+
it('should call onPageChange with undefined if type is FormTypes.TASK', () => {
|
|
690
|
+
const CUSTOM_ARGS = {
|
|
691
|
+
...ARGS,
|
|
682
692
|
action: {
|
|
683
693
|
type: _models.PageAction.TYPES.SAVE_AND_RETURN,
|
|
684
694
|
validate: true
|
|
685
695
|
},
|
|
686
696
|
hub: _models.HubFormats.TASK,
|
|
687
697
|
type: _models.FormTypes.TASK
|
|
688
|
-
}
|
|
698
|
+
};
|
|
689
699
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
690
700
|
expect(_helpers.default.canCYASubmitCalls).toEqual(1); // Validating.
|
|
691
701
|
expect(_utils.default.Format.formCalls).toEqual(1);
|
|
@@ -715,23 +725,25 @@ describe('components.FormRenderer.onCYAAction', function () {
|
|
|
715
725
|
expect(addErrorsArgs[0]).toEqual(['an example error']);
|
|
716
726
|
});
|
|
717
727
|
});
|
|
718
|
-
it('should handle a page action type of PageAction.TYPES.NAVIGATE',
|
|
719
|
-
|
|
728
|
+
it('should handle a page action type of PageAction.TYPES.NAVIGATE', () => {
|
|
729
|
+
const CUSTOM_ARGS = {
|
|
730
|
+
...ARGS,
|
|
720
731
|
action: {
|
|
721
732
|
type: _models.PageAction.TYPES.NAVIGATE,
|
|
722
733
|
page: 'page2'
|
|
723
734
|
}
|
|
724
|
-
}
|
|
735
|
+
};
|
|
725
736
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
726
737
|
expect(onPageChangeCalls).toEqual(1);
|
|
727
738
|
expect(onPageChangeArgs[0]).toEqual('page2');
|
|
728
739
|
});
|
|
729
|
-
it('should handle a page action type of PageAction.TYPES.CANCEL',
|
|
730
|
-
|
|
740
|
+
it('should handle a page action type of PageAction.TYPES.CANCEL', () => {
|
|
741
|
+
const CUSTOM_ARGS = {
|
|
742
|
+
...ARGS,
|
|
731
743
|
action: {
|
|
732
744
|
type: _models.PageAction.TYPES.CANCEL
|
|
733
745
|
}
|
|
734
|
-
}
|
|
746
|
+
};
|
|
735
747
|
_onCYAAction.default.apply(void 0, Object.values(CUSTOM_ARGS));
|
|
736
748
|
expect(MOCK_HOOKS.onCancelArgs.length).toEqual(1);
|
|
737
749
|
expect(MOCK_HOOKS.onCancelArgs[0]).toMatchObject({
|