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