@ukhomeoffice/cop-react-form-renderer 5.90.1 → 5.90.2
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 +15 -15
- package/dist/components/CheckYourAnswers/Answer.test.js +181 -132
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +142 -106
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +941 -563
- package/dist/components/CheckYourAnswers/index.js +1 -1
- package/dist/components/CollectionPage/CollectionPage.js +66 -75
- package/dist/components/CollectionPage/CollectionPage.test.js +369 -318
- package/dist/components/CollectionPage/index.js +1 -1
- package/dist/components/CollectionSummary/BannerStrip.js +15 -15
- package/dist/components/CollectionSummary/BannerStrip.test.js +79 -83
- package/dist/components/CollectionSummary/CollectionSummary.js +131 -109
- package/dist/components/CollectionSummary/CollectionSummary.test.js +180 -198
- package/dist/components/CollectionSummary/Confirmation.js +13 -15
- package/dist/components/CollectionSummary/Confirmation.test.js +63 -68
- package/dist/components/CollectionSummary/RenderListView.js +55 -47
- package/dist/components/CollectionSummary/RenderListView.test.js +81 -82
- package/dist/components/CollectionSummary/SummaryCard.js +157 -121
- package/dist/components/CollectionSummary/SummaryCard.test.js +1000 -970
- package/dist/components/CollectionSummary/SummaryCardDetails.js +94 -103
- package/dist/components/CollectionSummary/SummaryCardDetails.test.js +195 -187
- package/dist/components/CollectionSummary/SummaryCardValidationContext.js +36 -31
- package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +76 -64
- package/dist/components/CollectionSummary/index.js +1 -1
- package/dist/components/FormComponent/Collection.js +117 -80
- package/dist/components/FormComponent/Collection.test.js +1082 -910
- package/dist/components/FormComponent/Container.js +38 -43
- package/dist/components/FormComponent/Container.test.js +411 -379
- package/dist/components/FormComponent/FormComponent.js +74 -71
- package/dist/components/FormComponent/FormComponent.test.js +415 -354
- 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 +8 -8
- package/dist/components/FormComponent/helpers/getComponentError.js +5 -3
- package/dist/components/FormComponent/helpers/getComponentError.test.js +15 -15
- package/dist/components/FormComponent/helpers/getComponentFieldSet.js +4 -3
- package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +7 -7
- package/dist/components/FormComponent/helpers/index.js +5 -5
- package/dist/components/FormComponent/index.js +1 -1
- package/dist/components/FormPage/FormPage.js +87 -71
- package/dist/components/FormPage/FormPage.test.js +170 -133
- package/dist/components/FormPage/index.js +1 -1
- package/dist/components/FormRenderer/FormRenderer.js +198 -153
- package/dist/components/FormRenderer/FormRenderer.test.js +1116 -731
- package/dist/components/FormRenderer/handlers/cyaAction.js +3 -3
- package/dist/components/FormRenderer/handlers/getPageId.js +3 -1
- package/dist/components/FormRenderer/handlers/getPageId.test.js +15 -15
- package/dist/components/FormRenderer/handlers/handlers.test.js +33 -33
- package/dist/components/FormRenderer/handlers/index.js +2 -2
- package/dist/components/FormRenderer/handlers/navigate.js +4 -4
- 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 +16 -16
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +3 -1
- package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +21 -17
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +30 -27
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +21 -21
- package/dist/components/FormRenderer/helpers/getCYA.js +7 -5
- package/dist/components/FormRenderer/helpers/getCYA.test.js +12 -12
- package/dist/components/FormRenderer/helpers/getFormState.js +8 -6
- package/dist/components/FormRenderer/helpers/getFormState.test.js +11 -11
- package/dist/components/FormRenderer/helpers/getNextPageId.js +32 -18
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +68 -68
- package/dist/components/FormRenderer/helpers/getPage.js +4 -2
- package/dist/components/FormRenderer/helpers/getPage.test.js +12 -12
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +11 -8
- package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +15 -15
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +13 -12
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +98 -104
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +64 -65
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +79 -72
- package/dist/components/FormRenderer/helpers/index.js +2 -2
- package/dist/components/FormRenderer/index.js +1 -1
- package/dist/components/FormRenderer/onCYAAction.js +54 -61
- package/dist/components/FormRenderer/onCYAAction.test.js +153 -165
- package/dist/components/FormRenderer/onPageAction.js +41 -45
- package/dist/components/FormRenderer/onPageAction.test.js +210 -225
- package/dist/components/FormRenderer/onTaskAction.js +15 -11
- package/dist/components/FormRenderer/onTaskAction.test.js +89 -94
- package/dist/components/PageActions/ActionButton.js +16 -13
- package/dist/components/PageActions/ActionButton.test.js +79 -57
- package/dist/components/PageActions/PageActions.js +11 -11
- package/dist/components/PageActions/PageActions.test.js +116 -87
- package/dist/components/PageActions/index.js +1 -1
- package/dist/components/SummaryList/GroupAction.js +21 -13
- package/dist/components/SummaryList/GroupAction.test.js +37 -41
- package/dist/components/SummaryList/RowAction.js +17 -12
- package/dist/components/SummaryList/RowAction.test.js +37 -41
- package/dist/components/SummaryList/SummaryList.js +28 -23
- package/dist/components/SummaryList/SummaryList.test.js +206 -179
- package/dist/components/SummaryList/SummaryListHeadingRow.js +6 -8
- package/dist/components/SummaryList/SummaryListHeadingRowWithAction.js +5 -7
- package/dist/components/SummaryList/SummaryListRow.js +6 -8
- package/dist/components/SummaryList/SummaryListTitleRow.js +5 -7
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +6 -4
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +24 -24
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +6 -4
- package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +24 -24
- package/dist/components/SummaryList/helpers/index.js +2 -2
- package/dist/components/SummaryList/index.js +1 -1
- package/dist/components/TaskList/Task.js +30 -20
- package/dist/components/TaskList/Task.test.js +77 -84
- package/dist/components/TaskList/TaskList.js +84 -53
- package/dist/components/TaskList/TaskList.test.js +150 -150
- package/dist/components/TaskList/TaskState.js +6 -8
- package/dist/components/TaskList/TaskState.test.js +49 -56
- package/dist/components/TaskList/index.js +1 -1
- package/dist/components/index.js +8 -8
- package/dist/context/HooksContext/HooksContext.js +81 -58
- package/dist/context/HooksContext/HooksContext.test.js +36 -27
- package/dist/context/HooksContext/index.js +4 -3
- package/dist/context/ValidationContext/ValidationContext.js +95 -44
- package/dist/context/ValidationContext/ValidationContext.test.js +70 -58
- package/dist/context/ValidationContext/index.js +4 -3
- package/dist/context/index.js +3 -3
- package/dist/hooks/index.js +11 -10
- package/dist/hooks/useAxios.js +41 -15
- package/dist/hooks/useGetRequest.js +98 -62
- package/dist/hooks/useHooks.js +3 -1
- package/dist/hooks/useRefData.js +41 -28
- package/dist/hooks/useValidation.js +3 -1
- package/dist/index.js +15 -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 +38 -44
- package/dist/models/TaskStates.js +28 -29
- package/dist/models/index.js +10 -10
- package/dist/setupTests.js +32 -31
- package/dist/utils/CheckYourAnswers/getCYAAction.js +5 -5
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +55 -53
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +27 -17
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +36 -34
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +34 -20
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +45 -43
- package/dist/utils/CheckYourAnswers/getCYARow.js +10 -8
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +87 -87
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +25 -19
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +17 -16
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +45 -39
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +75 -72
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +105 -100
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +182 -218
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +21 -26
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +106 -112
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +21 -15
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +83 -77
- package/dist/utils/CheckYourAnswers/getSummaryListRowForDetails.js +13 -13
- package/dist/utils/CheckYourAnswers/getSummaryListRowForDetails.test.js +19 -14
- package/dist/utils/CheckYourAnswers/index.js +2 -2
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +6 -6
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +26 -26
- package/dist/utils/CollectionPage/addCollectionPageEntry.js +3 -3
- package/dist/utils/CollectionPage/addCollectionPageEntry.test.js +6 -6
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +3 -3
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +22 -21
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +24 -14
- package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +43 -52
- package/dist/utils/CollectionPage/getCollectionPageActiveId.js +3 -3
- package/dist/utils/CollectionPage/getCollectionPageActiveId.test.js +11 -11
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +12 -7
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +23 -23
- package/dist/utils/CollectionPage/getCollectionPageData.js +13 -8
- package/dist/utils/CollectionPage/getCollectionPageData.test.js +20 -20
- package/dist/utils/CollectionPage/getErrorsForCollection.js +26 -25
- package/dist/utils/CollectionPage/getErrorsForCollection.test.js +23 -21
- package/dist/utils/CollectionPage/getQuickEditPage.js +32 -37
- package/dist/utils/CollectionPage/getQuickEditPage.test.js +22 -18
- package/dist/utils/CollectionPage/index.js +2 -2
- package/dist/utils/CollectionPage/mergeCollectionPages.js +42 -37
- package/dist/utils/CollectionPage/mergeCollectionPages.test.js +18 -48
- package/dist/utils/CollectionPage/removeCollectionPageEntry.js +7 -5
- package/dist/utils/CollectionPage/removeCollectionPageEntry.test.js +11 -11
- package/dist/utils/CollectionPage/setCollectionPageData.js +19 -12
- package/dist/utils/CollectionPage/setCollectionPageData.test.js +26 -26
- package/dist/utils/Component/addShowWhen.js +8 -4
- package/dist/utils/Component/addShowWhen.test.js +38 -38
- package/dist/utils/Component/applyToComponentTree.js +20 -19
- package/dist/utils/Component/applyToComponentTree.test.js +33 -28
- 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 +34 -34
- package/dist/utils/Component/getComponent.js +97 -90
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +18 -19
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +63 -50
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +49 -40
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +40 -30
- package/dist/utils/Component/getComponentTests/getComponent.details.test.js +19 -21
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +23 -18
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +27 -22
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +11 -12
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +16 -18
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +9 -10
- package/dist/utils/Component/getComponentTests/getComponent.list.test.js +16 -18
- package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +27 -23
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +175 -155
- package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +16 -18
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +23 -18
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +73 -58
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +23 -18
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +23 -18
- package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +41 -34
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +32 -23
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +9 -10
- package/dist/utils/Component/getDefaultValue.js +9 -7
- package/dist/utils/Component/getDefaultValue.test.js +13 -13
- package/dist/utils/Component/getDefaultValueFromConfig.js +24 -24
- package/dist/utils/Component/getDefaultValueFromConfig.test.js +32 -32
- package/dist/utils/Component/index.js +2 -2
- package/dist/utils/Component/isEditable.js +4 -2
- package/dist/utils/Component/isEditable.test.js +15 -14
- package/dist/utils/Component/optionIsSelected.js +4 -2
- package/dist/utils/Component/optionIsSelected.test.js +12 -12
- package/dist/utils/Component/setupContainerComponentsPath.js +31 -29
- package/dist/utils/Component/setupContainerComponentsPath.test.js +16 -16
- package/dist/utils/Component/showComponent.js +4 -3
- package/dist/utils/Component/showComponent.test.js +29 -29
- package/dist/utils/Component/wrapInFormGroup.js +4 -4
- package/dist/utils/Condition/index.js +2 -2
- package/dist/utils/Condition/meetsAllConditions.js +9 -9
- package/dist/utils/Condition/meetsAllConditions.test.js +21 -21
- package/dist/utils/Condition/meetsCondition.js +31 -20
- package/dist/utils/Condition/meetsCondition.test.js +403 -403
- package/dist/utils/Condition/meetsOneCondition.js +6 -6
- package/dist/utils/Condition/meetsOneCondition.test.js +17 -17
- package/dist/utils/Condition/setupConditions.js +19 -14
- package/dist/utils/Condition/setupConditions.test.js +8 -8
- package/dist/utils/Container/getEditableComponents.js +6 -4
- package/dist/utils/Container/getEditableComponents.test.js +46 -44
- package/dist/utils/Container/index.js +2 -2
- package/dist/utils/Container/setupNesting.js +22 -16
- package/dist/utils/Container/setupNesting.test.js +31 -28
- package/dist/utils/Container/showContainer.js +8 -4
- package/dist/utils/Container/showContainer.test.js +31 -31
- package/dist/utils/Data/applyFormula.js +50 -40
- package/dist/utils/Data/applyFormula.test.js +26 -26
- package/dist/utils/Data/deleteValues.js +8 -4
- package/dist/utils/Data/deleteValues.test.js +11 -11
- package/dist/utils/Data/getAutocompleteSource.js +29 -20
- package/dist/utils/Data/getAutocompleteSource.test.js +87 -81
- package/dist/utils/Data/getDataPath.js +30 -20
- package/dist/utils/Data/getDataPath.test.js +20 -20
- package/dist/utils/Data/getOptions.js +34 -27
- package/dist/utils/Data/getOptions.test.js +28 -28
- package/dist/utils/Data/getSourceData.js +19 -6
- package/dist/utils/Data/getSourceData.test.js +81 -85
- package/dist/utils/Data/index.js +2 -2
- package/dist/utils/Data/nestInRefdataOptions.js +16 -9
- package/dist/utils/Data/nestInRefdataOptions.test.js +17 -17
- package/dist/utils/Data/refDataToOptions.js +15 -11
- package/dist/utils/Data/refDataToOptions.test.js +20 -20
- package/dist/utils/Data/setDataItem.js +8 -7
- package/dist/utils/Data/setDataItem.test.js +38 -38
- package/dist/utils/Data/setupFormData.js +22 -14
- package/dist/utils/Data/setupFormData.test.js +51 -52
- package/dist/utils/Data/setupRefDataUrlForComponent.js +28 -21
- package/dist/utils/Data/setupRefDataUrlForComponent.test.js +28 -28
- package/dist/utils/FormPage/applyConditionalProperties.js +10 -6
- package/dist/utils/FormPage/applyConditionalProperties.test.js +19 -16
- package/dist/utils/FormPage/getConditionalText.js +4 -4
- package/dist/utils/FormPage/getConditionalText.test.js +35 -35
- package/dist/utils/FormPage/getFormPage.js +17 -16
- package/dist/utils/FormPage/getFormPage.test.js +48 -49
- package/dist/utils/FormPage/getFormPages.js +13 -8
- package/dist/utils/FormPage/getFormPages.test.js +25 -22
- package/dist/utils/FormPage/getPageActions.js +17 -10
- package/dist/utils/FormPage/getPageActions.test.js +33 -33
- package/dist/utils/FormPage/getParagraphFromText.js +7 -5
- package/dist/utils/FormPage/getParagraphFromText.test.js +7 -7
- package/dist/utils/FormPage/index.js +5 -3
- package/dist/utils/FormPage/showFormPage.js +8 -4
- package/dist/utils/FormPage/showFormPage.test.js +33 -33
- package/dist/utils/FormPage/showFormPageCYA.js +3 -3
- package/dist/utils/FormPage/showFormPageCYA.test.js +9 -9
- package/dist/utils/FormPage/useComponent.js +28 -21
- package/dist/utils/FormPage/useComponent.test.js +80 -78
- package/dist/utils/Format/formatData.js +1 -1
- package/dist/utils/Format/formatData.test.js +19 -19
- package/dist/utils/Format/formatDataForComponent.js +7 -6
- package/dist/utils/Format/formatDataForComponent.test.js +78 -50
- package/dist/utils/Format/formatDataForForm.js +8 -6
- package/dist/utils/Format/formatDataForForm.test.js +17 -14
- package/dist/utils/Format/formatDataForPage.js +5 -4
- package/dist/utils/Format/formatDataForPage.test.js +25 -20
- package/dist/utils/Format/index.js +2 -2
- package/dist/utils/Hub/getFormHub.js +2 -2
- package/dist/utils/Hub/getFormHub.test.js +32 -29
- package/dist/utils/Hub/index.js +2 -2
- package/dist/utils/Meta/constants.js +2 -2
- package/dist/utils/Meta/documents/getDocuments.js +4 -1
- package/dist/utils/Meta/documents/getDocuments.test.js +17 -25
- package/dist/utils/Meta/documents/index.js +2 -2
- package/dist/utils/Meta/documents/setDocumentsForField.js +17 -15
- package/dist/utils/Meta/documents/setDocumentsForField.test.js +35 -69
- package/dist/utils/Meta/index.js +2 -2
- package/dist/utils/Operate/checkValueIsTruthy.js +4 -4
- package/dist/utils/Operate/checkValueIsTruthy.test.js +17 -17
- package/dist/utils/Operate/deleteValueInFormData.js +3 -3
- package/dist/utils/Operate/deleteValueInFormData.test.js +15 -15
- package/dist/utils/Operate/getFirstOf.js +8 -8
- package/dist/utils/Operate/getFirstOf.test.js +33 -33
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +12 -12
- package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +53 -47
- package/dist/utils/Operate/getLength.js +11 -11
- package/dist/utils/Operate/getLength.test.js +19 -19
- package/dist/utils/Operate/index.js +2 -2
- package/dist/utils/Operate/persistValueInFormData.js +6 -6
- package/dist/utils/Operate/persistValueInFormData.test.js +21 -23
- package/dist/utils/Operate/runPageOperations.js +9 -9
- package/dist/utils/Operate/runPageOperations.test.js +37 -36
- package/dist/utils/Operate/setValueInFormData.js +5 -5
- package/dist/utils/Operate/setValueInFormData.test.js +17 -17
- package/dist/utils/Operate/shouldRun.js +8 -8
- package/dist/utils/Operate/shouldRun.test.js +28 -22
- package/dist/utils/Validate/additional/conditionallyPermittedChange.js +1 -1
- package/dist/utils/Validate/additional/conditionallyPermittedChange.test.js +15 -15
- package/dist/utils/Validate/additional/conditionallyRequired.js +5 -4
- package/dist/utils/Validate/additional/conditionallyRequired.test.js +19 -19
- package/dist/utils/Validate/additional/index.js +8 -8
- package/dist/utils/Validate/additional/index.test.js +22 -22
- package/dist/utils/Validate/additional/mustBeAfter.js +3 -3
- package/dist/utils/Validate/additional/mustBeAfter.test.js +41 -41
- package/dist/utils/Validate/additional/mustBeBefore.js +3 -3
- package/dist/utils/Validate/additional/mustBeBefore.test.js +29 -29
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +14 -9
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +42 -38
- package/dist/utils/Validate/additional/mustBeGreaterThan.js +2 -2
- package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +19 -19
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +4 -4
- package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeInThePast.js +5 -5
- package/dist/utils/Validate/additional/mustBeInThePast.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeLessThan.js +2 -2
- package/dist/utils/Validate/additional/mustBeLessThan.test.js +18 -18
- package/dist/utils/Validate/additional/mustBeLongerThan.js +1 -1
- package/dist/utils/Validate/additional/mustBeLongerThan.test.js +17 -17
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +2 -2
- package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +21 -21
- package/dist/utils/Validate/additional/mustBeOneOf.js +1 -1
- package/dist/utils/Validate/additional/mustBeOneOf.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeShorterThan.js +1 -1
- package/dist/utils/Validate/additional/mustBeShorterThan.test.js +17 -17
- package/dist/utils/Validate/additional/mustBeUniqueInCollection.js +5 -5
- package/dist/utils/Validate/additional/mustBeUniqueInCollection.test.js +40 -36
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +5 -3
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +17 -15
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +1 -1
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +13 -13
- package/dist/utils/Validate/additional/mustNotContainSql.js +4 -3
- package/dist/utils/Validate/additional/mustNotContainSql.test.js +15 -15
- package/dist/utils/Validate/additional/mustSelectOnlyOne.js +5 -3
- package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +27 -29
- package/dist/utils/Validate/additional/utils.js +24 -11
- package/dist/utils/Validate/index.js +2 -2
- package/dist/utils/Validate/validateCollection.js +27 -21
- package/dist/utils/Validate/validateCollection.test.js +77 -85
- package/dist/utils/Validate/validateComponent.js +23 -22
- package/dist/utils/Validate/validateComponent.test.js +165 -188
- package/dist/utils/Validate/validateContainer.js +21 -16
- package/dist/utils/Validate/validateContainer.test.js +56 -62
- package/dist/utils/Validate/validateDate.js +23 -17
- package/dist/utils/Validate/validateDate.test.js +32 -31
- package/dist/utils/Validate/validateEmail.js +9 -7
- package/dist/utils/Validate/validateEmail.test.js +26 -26
- package/dist/utils/Validate/validateMultifile.js +7 -5
- package/dist/utils/Validate/validateMultifile.test.js +18 -17
- package/dist/utils/Validate/validatePage.js +24 -20
- package/dist/utils/Validate/validatePage.test.js +215 -227
- package/dist/utils/Validate/validateRegex.js +8 -5
- package/dist/utils/Validate/validateRegex.test.js +17 -17
- package/dist/utils/Validate/validateRequired.js +7 -5
- package/dist/utils/Validate/validateRequired.test.js +19 -19
- package/dist/utils/Validate/validateTextArea.js +7 -5
- package/dist/utils/Validate/validateTextArea.test.js +21 -21
- package/dist/utils/Validate/validateTime.js +19 -12
- package/dist/utils/Validate/validateTime.test.js +27 -27
- package/dist/utils/index.js +10 -8
- package/package.json +1 -1
|
@@ -19,34 +19,46 @@ var _models = require("../../models");
|
|
|
19
19
|
var _setupTests = require("../../setupTests");
|
|
20
20
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
21
21
|
var _CheckYourAnswers = _interopRequireWildcard(require("./CheckYourAnswers"));
|
|
22
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" !=
|
|
24
|
-
function _interopRequireDefault(
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
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); }
|
|
26
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
27
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
28
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
29
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
30
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
33
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
34
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
35
|
+
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; }
|
|
36
|
+
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; }
|
|
37
|
+
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; }
|
|
38
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
39
|
+
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); } // Global imports
|
|
27
40
|
// Local imports
|
|
28
|
-
|
|
29
|
-
describe('
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
const ON_ROW_ACTION_CALLS = [];
|
|
37
|
-
const ON_ROW_ACTION = row => {
|
|
41
|
+
describe('components', function () {
|
|
42
|
+
describe('CheckYourAnswers', function () {
|
|
43
|
+
var mockAxios = new _axiosMockAdapter.default(_axios.default);
|
|
44
|
+
var DATA = _utils.default.Data.setupForm(_userProfile.default.pages, _userProfile.default.components, _userProfileData.default);
|
|
45
|
+
var PAGES = _utils.default.FormPage.getAll(_userProfile.default.pages, _userProfile.default.components, _objectSpread({}, DATA));
|
|
46
|
+
var ON_ROW_ACTION_CALLS = [];
|
|
47
|
+
var ON_ROW_ACTION = function ON_ROW_ACTION(row) {
|
|
38
48
|
ON_ROW_ACTION_CALLS.push(row);
|
|
39
49
|
};
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
var ON_ACTION_CALLS = [];
|
|
51
|
+
var ON_ACTION = function ON_ACTION(action, onError) {
|
|
42
52
|
ON_ACTION_CALLS.push({
|
|
43
|
-
action,
|
|
44
|
-
onError
|
|
53
|
+
action: action,
|
|
54
|
+
onError: onError
|
|
45
55
|
});
|
|
46
56
|
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
var container = null;
|
|
58
|
+
var refDataUrl = function refDataUrl(suffix) {
|
|
59
|
+
return "".concat(_userProfileData.default.urls.refData, "/").concat(suffix);
|
|
60
|
+
};
|
|
61
|
+
beforeEach(function () {
|
|
50
62
|
ON_ROW_ACTION_CALLS.length = 0;
|
|
51
63
|
ON_ACTION_CALLS.length = 0;
|
|
52
64
|
container = document.createElement('div');
|
|
@@ -56,19 +68,19 @@ describe('components', () => {
|
|
|
56
68
|
mockAxios.onGet(refDataUrl('grade')).reply(200, _grade.default);
|
|
57
69
|
mockAxios.onGet(refDataUrl('team')).reply(200, _team.default);
|
|
58
70
|
});
|
|
59
|
-
afterEach(()
|
|
71
|
+
afterEach(function () {
|
|
60
72
|
(0, _reactDom.unmountComponentAtNode)(container);
|
|
61
73
|
container.remove();
|
|
62
74
|
container = null;
|
|
63
75
|
});
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
var checkCYA = function checkCYA(cyaContainer) {
|
|
77
|
+
var checkCYAContainer = cyaContainer;
|
|
78
|
+
var cya = checkCYAContainer.childNodes[0];
|
|
67
79
|
expect(cya.tagName).toEqual('DIV');
|
|
68
80
|
expect(cya.classList).toContain(_CheckYourAnswers.DEFAULT_CLASS);
|
|
69
81
|
return cya;
|
|
70
82
|
};
|
|
71
|
-
|
|
83
|
+
var checkRow = function checkRow(row, key, value, action) {
|
|
72
84
|
expect(row.textContent).toContain(key);
|
|
73
85
|
expect(row.textContent).toContain(value);
|
|
74
86
|
if (action) {
|
|
@@ -77,543 +89,909 @@ describe('components', () => {
|
|
|
77
89
|
expect(row.textContent).not.toContain('Change');
|
|
78
90
|
}
|
|
79
91
|
};
|
|
80
|
-
it('should show default title if none is provided',
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
await (0, _testUtils.act)(async () => {
|
|
110
|
-
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
111
|
-
pages: PAGES,
|
|
112
|
-
onRowAction: ON_ROW_ACTION,
|
|
113
|
-
onAction: ON_ACTION
|
|
114
|
-
}), container);
|
|
115
|
-
});
|
|
116
|
-
const cya = checkCYA(container);
|
|
117
|
-
const [, cyaChildNode] = cya.childNodes;
|
|
118
|
-
const names = cyaChildNode.childNodes[0];
|
|
119
|
-
expect(names.tagName).toEqual('DL');
|
|
120
|
-
expect(names.classList).toContain(`govuk-!-margin-bottom-${_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM}`);
|
|
121
|
-
const [firstName, surname] = names.childNodes;
|
|
122
|
-
checkRow(firstName, 'First name', 'John', false);
|
|
123
|
-
checkRow(surname, 'Last name', 'Smith', false);
|
|
124
|
-
});
|
|
125
|
-
it('should show editable page components correctly', async () => {
|
|
126
|
-
await (0, _testUtils.act)(async () => {
|
|
127
|
-
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
128
|
-
pages: PAGES,
|
|
129
|
-
onRowAction: ON_ROW_ACTION,
|
|
130
|
-
onAction: ON_ACTION
|
|
131
|
-
}), container);
|
|
132
|
-
});
|
|
133
|
-
const cya = checkCYA(container);
|
|
134
|
-
const [,, title, cyaChildNode] = cya.childNodes;
|
|
135
|
-
const civilServant = cyaChildNode.childNodes[0];
|
|
136
|
-
expect(title.textContent).toEqual('Are you a civil servant?');
|
|
137
|
-
expect(civilServant.tagName).toEqual('DL');
|
|
138
|
-
expect(civilServant.classList).toContain(`govuk-!-margin-bottom-${_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM}`);
|
|
139
|
-
const [status] = civilServant.childNodes;
|
|
140
|
-
checkRow(status, 'Are you a civil servant?', 'Yes', true);
|
|
141
|
-
});
|
|
142
|
-
it('should show editable page components correctly with page titles hidden', async () => {
|
|
143
|
-
await (0, _testUtils.act)(async () => {
|
|
144
|
-
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
145
|
-
pages: PAGES,
|
|
146
|
-
onRowAction: ON_ROW_ACTION,
|
|
147
|
-
onAction: ON_ACTION,
|
|
148
|
-
hide_page_titles: true
|
|
149
|
-
}), container);
|
|
150
|
-
});
|
|
151
|
-
const cya = checkCYA(container);
|
|
152
|
-
const [,, cyaChildNode] = cya.childNodes; // The title simply isn't returned
|
|
153
|
-
const civilServant = cyaChildNode.childNodes[0];
|
|
154
|
-
expect(civilServant.tagName).toEqual('DL');
|
|
155
|
-
expect(civilServant.classList).toContain(`govuk-!-margin-bottom-0`); // Changed margin if no titles
|
|
156
|
-
const [status] = civilServant.childNodes;
|
|
157
|
-
checkRow(status, 'Are you a civil servant?', 'Yes', true);
|
|
158
|
-
});
|
|
159
|
-
it('should only show change link next to the heading when the page is configured to only have a single change link', async () => {
|
|
160
|
-
const CUSTOM_PAGES = PAGES.map(page => ({
|
|
161
|
-
...page,
|
|
162
|
-
cya_link: {
|
|
163
|
-
page: page.id,
|
|
164
|
-
aria_suffix: 'page details',
|
|
165
|
-
singleChangeLink: true
|
|
92
|
+
it('should show default title if none is provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
93
|
+
var cya, title;
|
|
94
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
95
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
_context2.next = 2;
|
|
98
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
99
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
100
|
+
while (1) switch (_context.prev = _context.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
103
|
+
pages: PAGES,
|
|
104
|
+
onRowAction: ON_ROW_ACTION,
|
|
105
|
+
onAction: ON_ACTION
|
|
106
|
+
}), container);
|
|
107
|
+
case 1:
|
|
108
|
+
case "end":
|
|
109
|
+
return _context.stop();
|
|
110
|
+
}
|
|
111
|
+
}, _callee);
|
|
112
|
+
})));
|
|
113
|
+
case 2:
|
|
114
|
+
cya = checkCYA(container);
|
|
115
|
+
title = cya.childNodes[0];
|
|
116
|
+
expect(title.classList).toContain('govuk-heading-l');
|
|
117
|
+
expect(title.textContent).toEqual(_CheckYourAnswers.DEFAULT_TITLE);
|
|
118
|
+
case 6:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context2.stop();
|
|
166
121
|
}
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
122
|
+
}, _callee2);
|
|
123
|
+
})));
|
|
124
|
+
it('should allow title to be overridden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
125
|
+
var TITLE, cya, title;
|
|
126
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
127
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
TITLE = 'Alpha Bravo Charlie';
|
|
130
|
+
_context4.next = 3;
|
|
131
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
132
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
133
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
134
|
+
case 0:
|
|
135
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
136
|
+
title: TITLE,
|
|
137
|
+
pages: PAGES,
|
|
138
|
+
onRowAction: ON_ROW_ACTION,
|
|
139
|
+
onAction: ON_ACTION
|
|
140
|
+
}), container);
|
|
141
|
+
case 1:
|
|
142
|
+
case "end":
|
|
143
|
+
return _context3.stop();
|
|
144
|
+
}
|
|
145
|
+
}, _callee3);
|
|
146
|
+
})));
|
|
147
|
+
case 3:
|
|
148
|
+
cya = checkCYA(container);
|
|
149
|
+
title = cya.childNodes[0];
|
|
150
|
+
expect(title.classList).toContain('govuk-heading-l');
|
|
151
|
+
expect(title.textContent).toEqual(TITLE);
|
|
152
|
+
case 7:
|
|
153
|
+
case "end":
|
|
154
|
+
return _context4.stop();
|
|
199
155
|
}
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
156
|
+
}, _callee4);
|
|
157
|
+
})));
|
|
158
|
+
it('should show readonly page components correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
159
|
+
var cya, _cya$childNodes, cyaChildNode, names, _names$childNodes, firstName, surname;
|
|
160
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
161
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
162
|
+
case 0:
|
|
163
|
+
_context6.next = 2;
|
|
164
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
165
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
166
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
167
|
+
case 0:
|
|
168
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
169
|
+
pages: PAGES,
|
|
170
|
+
onRowAction: ON_ROW_ACTION,
|
|
171
|
+
onAction: ON_ACTION
|
|
172
|
+
}), container);
|
|
173
|
+
case 1:
|
|
174
|
+
case "end":
|
|
175
|
+
return _context5.stop();
|
|
176
|
+
}
|
|
177
|
+
}, _callee5);
|
|
178
|
+
})));
|
|
179
|
+
case 2:
|
|
180
|
+
cya = checkCYA(container);
|
|
181
|
+
_cya$childNodes = _slicedToArray(cya.childNodes, 2), cyaChildNode = _cya$childNodes[1];
|
|
182
|
+
names = cyaChildNode.childNodes[0];
|
|
183
|
+
expect(names.tagName).toEqual('DL');
|
|
184
|
+
expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
|
|
185
|
+
_names$childNodes = _slicedToArray(names.childNodes, 2), firstName = _names$childNodes[0], surname = _names$childNodes[1];
|
|
186
|
+
checkRow(firstName, 'First name', 'John', false);
|
|
187
|
+
checkRow(surname, 'Last name', 'Smith', false);
|
|
188
|
+
case 10:
|
|
189
|
+
case "end":
|
|
190
|
+
return _context6.stop();
|
|
191
|
+
}
|
|
192
|
+
}, _callee6);
|
|
193
|
+
})));
|
|
194
|
+
it('should show editable page components correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
195
|
+
var cya, _cya$childNodes2, title, cyaChildNode, civilServant, _civilServant$childNo, status;
|
|
196
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
197
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
198
|
+
case 0:
|
|
199
|
+
_context8.next = 2;
|
|
200
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
201
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
202
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
203
|
+
case 0:
|
|
204
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
205
|
+
pages: PAGES,
|
|
206
|
+
onRowAction: ON_ROW_ACTION,
|
|
207
|
+
onAction: ON_ACTION
|
|
208
|
+
}), container);
|
|
209
|
+
case 1:
|
|
210
|
+
case "end":
|
|
211
|
+
return _context7.stop();
|
|
212
|
+
}
|
|
213
|
+
}, _callee7);
|
|
214
|
+
})));
|
|
215
|
+
case 2:
|
|
216
|
+
cya = checkCYA(container);
|
|
217
|
+
_cya$childNodes2 = _slicedToArray(cya.childNodes, 4), title = _cya$childNodes2[2], cyaChildNode = _cya$childNodes2[3];
|
|
218
|
+
civilServant = cyaChildNode.childNodes[0];
|
|
219
|
+
expect(title.textContent).toEqual('Are you a civil servant?');
|
|
220
|
+
expect(civilServant.tagName).toEqual('DL');
|
|
221
|
+
expect(civilServant.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
|
|
222
|
+
_civilServant$childNo = _slicedToArray(civilServant.childNodes, 1), status = _civilServant$childNo[0];
|
|
223
|
+
checkRow(status, 'Are you a civil servant?', 'Yes', true);
|
|
224
|
+
case 10:
|
|
225
|
+
case "end":
|
|
226
|
+
return _context8.stop();
|
|
227
|
+
}
|
|
228
|
+
}, _callee8);
|
|
229
|
+
})));
|
|
230
|
+
it('should show editable page components correctly with page titles hidden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
231
|
+
var cya, _cya$childNodes3, cyaChildNode, civilServant, _civilServant$childNo2, status;
|
|
232
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
233
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
234
|
+
case 0:
|
|
235
|
+
_context10.next = 2;
|
|
236
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
237
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
238
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
239
|
+
case 0:
|
|
240
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
241
|
+
pages: PAGES,
|
|
242
|
+
onRowAction: ON_ROW_ACTION,
|
|
243
|
+
onAction: ON_ACTION,
|
|
244
|
+
hide_page_titles: true
|
|
245
|
+
}), container);
|
|
246
|
+
case 1:
|
|
247
|
+
case "end":
|
|
248
|
+
return _context9.stop();
|
|
249
|
+
}
|
|
250
|
+
}, _callee9);
|
|
251
|
+
})));
|
|
252
|
+
case 2:
|
|
253
|
+
cya = checkCYA(container);
|
|
254
|
+
_cya$childNodes3 = _slicedToArray(cya.childNodes, 3), cyaChildNode = _cya$childNodes3[2]; // The title simply isn't returned
|
|
255
|
+
civilServant = cyaChildNode.childNodes[0];
|
|
256
|
+
expect(civilServant.tagName).toEqual('DL');
|
|
257
|
+
expect(civilServant.classList).toContain("govuk-!-margin-bottom-0"); // Changed margin if no titles
|
|
258
|
+
_civilServant$childNo2 = _slicedToArray(civilServant.childNodes, 1), status = _civilServant$childNo2[0];
|
|
259
|
+
checkRow(status, 'Are you a civil servant?', 'Yes', true);
|
|
260
|
+
case 9:
|
|
261
|
+
case "end":
|
|
262
|
+
return _context10.stop();
|
|
263
|
+
}
|
|
264
|
+
}, _callee10);
|
|
265
|
+
})));
|
|
266
|
+
it('should only show change link next to the heading when the page is configured to only have a single change link', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
267
|
+
var CUSTOM_PAGES, cya, _cya$childNodes4, title, cyaChildNode, titleText, titleAction, civilServant, _civilServant$childNo3, status;
|
|
268
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
269
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
270
|
+
case 0:
|
|
271
|
+
CUSTOM_PAGES = PAGES.map(function (page) {
|
|
272
|
+
return _objectSpread(_objectSpread({}, page), {}, {
|
|
273
|
+
cya_link: {
|
|
274
|
+
page: page.id,
|
|
275
|
+
aria_suffix: 'page details',
|
|
276
|
+
singleChangeLink: true
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
_context12.next = 3;
|
|
281
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
282
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
283
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
284
|
+
case 0:
|
|
285
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
286
|
+
pages: CUSTOM_PAGES,
|
|
287
|
+
onRowAction: ON_ROW_ACTION,
|
|
288
|
+
onAction: ON_ACTION
|
|
289
|
+
}), container);
|
|
290
|
+
case 1:
|
|
291
|
+
case "end":
|
|
292
|
+
return _context11.stop();
|
|
293
|
+
}
|
|
294
|
+
}, _callee11);
|
|
295
|
+
})));
|
|
296
|
+
case 3:
|
|
297
|
+
cya = checkCYA(container);
|
|
298
|
+
_cya$childNodes4 = _slicedToArray(cya.childNodes, 4), title = _cya$childNodes4[2], cyaChildNode = _cya$childNodes4[3];
|
|
299
|
+
expect(title.tagName).toEqual('DIV');
|
|
300
|
+
expect(title.classList).toContain('heading-with-action');
|
|
301
|
+
titleText = title.children[0];
|
|
302
|
+
expect(titleText.tagName).toEqual('DIV');
|
|
303
|
+
expect(titleText.classList).toContain('heading-text');
|
|
304
|
+
expect(titleText.textContent).toEqual('Are you a civil servant?');
|
|
305
|
+
titleAction = title.children[1];
|
|
306
|
+
expect(titleAction.tagName).toEqual('DIV');
|
|
307
|
+
expect(titleAction.classList).toContain('heading-action');
|
|
308
|
+
expect(titleAction.textContent).toEqual("Change page details");
|
|
309
|
+
civilServant = cyaChildNode.childNodes[0];
|
|
310
|
+
expect(civilServant.tagName).toEqual('DL');
|
|
311
|
+
_civilServant$childNo3 = _slicedToArray(civilServant.childNodes, 1), status = _civilServant$childNo3[0];
|
|
312
|
+
checkRow(status, 'Are you a civil servant?', 'Yes', false);
|
|
313
|
+
case 19:
|
|
314
|
+
case "end":
|
|
315
|
+
return _context12.stop();
|
|
316
|
+
}
|
|
317
|
+
}, _callee12);
|
|
318
|
+
})));
|
|
319
|
+
it('should only show change link next to the heading when the page is configured to have a single change link and form is a task list', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
320
|
+
var CUSTOM_PAGES, SECTIONS, taskHeading1, cya, _cya$childNodes5, title, cyaChildNode, titleText, titleAction, civilServant, _civilServant$childNo4, status;
|
|
321
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
322
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
323
|
+
case 0:
|
|
324
|
+
CUSTOM_PAGES = PAGES.map(function (page) {
|
|
325
|
+
return _objectSpread(_objectSpread({}, page), {}, {
|
|
326
|
+
cya_link: {
|
|
327
|
+
page: page.id,
|
|
328
|
+
aria_suffix: 'page details',
|
|
329
|
+
singleChangeLink: true
|
|
330
|
+
}
|
|
331
|
+
});
|
|
332
|
+
});
|
|
333
|
+
SECTIONS = [{
|
|
334
|
+
name: 'These are your tasks',
|
|
335
|
+
tasks: [{
|
|
336
|
+
name: 'Task 1',
|
|
337
|
+
state: 'complete',
|
|
338
|
+
pages: ['civil-servant-status']
|
|
339
|
+
}]
|
|
340
|
+
}];
|
|
341
|
+
_context14.next = 4;
|
|
342
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
343
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
344
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
345
|
+
case 0:
|
|
346
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
347
|
+
pages: CUSTOM_PAGES,
|
|
348
|
+
onRowAction: ON_ROW_ACTION,
|
|
349
|
+
onAction: ON_ACTION,
|
|
350
|
+
hide_title: true,
|
|
351
|
+
sections: SECTIONS,
|
|
352
|
+
type: _models.FormTypes.TASK_CYA
|
|
353
|
+
}), container);
|
|
354
|
+
case 1:
|
|
355
|
+
case "end":
|
|
356
|
+
return _context13.stop();
|
|
357
|
+
}
|
|
358
|
+
}, _callee13);
|
|
359
|
+
})));
|
|
360
|
+
case 4:
|
|
361
|
+
taskHeading1 = container.childNodes[0].childNodes[0];
|
|
362
|
+
expect(taskHeading1.tagName).toEqual('H2');
|
|
363
|
+
expect(taskHeading1.textContent).toEqual('Task 1');
|
|
364
|
+
expect(taskHeading1.classList).toContain("govuk-heading-m");
|
|
365
|
+
cya = checkCYA(container);
|
|
366
|
+
_cya$childNodes5 = _slicedToArray(cya.childNodes, 3), title = _cya$childNodes5[1], cyaChildNode = _cya$childNodes5[2];
|
|
367
|
+
expect(title.tagName).toEqual('DIV');
|
|
368
|
+
expect(title.classList).toContain('heading-with-action');
|
|
369
|
+
titleText = title.children[0];
|
|
370
|
+
expect(titleText.tagName).toEqual('DIV');
|
|
371
|
+
expect(titleText.classList).toContain('heading-text');
|
|
372
|
+
expect(titleText.textContent).toEqual('Are you a civil servant?');
|
|
373
|
+
titleAction = title.children[1];
|
|
374
|
+
expect(titleAction.tagName).toEqual('DIV');
|
|
375
|
+
expect(titleAction.classList).toContain('heading-action');
|
|
376
|
+
expect(titleAction.textContent).toEqual("Change page details");
|
|
377
|
+
civilServant = cyaChildNode.childNodes[0];
|
|
378
|
+
expect(civilServant.tagName).toEqual('DL');
|
|
379
|
+
_civilServant$childNo4 = _slicedToArray(civilServant.childNodes, 1), status = _civilServant$childNo4[0];
|
|
380
|
+
checkRow(status, 'Are you a civil servant?', 'Yes', false);
|
|
381
|
+
case 24:
|
|
382
|
+
case "end":
|
|
383
|
+
return _context14.stop();
|
|
384
|
+
}
|
|
385
|
+
}, _callee14);
|
|
386
|
+
})));
|
|
387
|
+
it('should show no title if is set to hidden', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
388
|
+
var cya, _cya$childNodes6, cyaChildNode, names, _names$childNodes2, firstName, surname;
|
|
389
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
390
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
391
|
+
case 0:
|
|
392
|
+
_context16.next = 2;
|
|
393
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
394
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
395
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
396
|
+
case 0:
|
|
397
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
398
|
+
pages: PAGES,
|
|
399
|
+
onRowAction: ON_ROW_ACTION,
|
|
400
|
+
onAction: ON_ACTION,
|
|
401
|
+
hide_title: true
|
|
402
|
+
}), container);
|
|
403
|
+
case 1:
|
|
404
|
+
case "end":
|
|
405
|
+
return _context15.stop();
|
|
406
|
+
}
|
|
407
|
+
}, _callee15);
|
|
408
|
+
})));
|
|
409
|
+
case 2:
|
|
410
|
+
cya = checkCYA(container);
|
|
411
|
+
_cya$childNodes6 = _slicedToArray(cya.childNodes, 1), cyaChildNode = _cya$childNodes6[0];
|
|
412
|
+
names = cyaChildNode.childNodes[0];
|
|
413
|
+
expect(names.tagName).toEqual('DL');
|
|
414
|
+
expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
|
|
415
|
+
_names$childNodes2 = _slicedToArray(names.childNodes, 2), firstName = _names$childNodes2[0], surname = _names$childNodes2[1];
|
|
416
|
+
checkRow(firstName, 'First name', 'John', false);
|
|
417
|
+
checkRow(surname, 'Last name', 'Smith', false);
|
|
418
|
+
case 10:
|
|
419
|
+
case "end":
|
|
420
|
+
return _context16.stop();
|
|
421
|
+
}
|
|
422
|
+
}, _callee16);
|
|
423
|
+
})));
|
|
424
|
+
it('should show task list in CYA style', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18() {
|
|
425
|
+
var sections, taskHeading1, namesPageHeading, taskHeading2, gradePageHeading;
|
|
426
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
427
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
428
|
+
case 0:
|
|
429
|
+
sections = [{
|
|
430
|
+
name: 'These are your tasks',
|
|
431
|
+
tasks: [{
|
|
432
|
+
name: 'Task 1',
|
|
433
|
+
state: 'complete',
|
|
434
|
+
pages: ['names']
|
|
435
|
+
}, {
|
|
436
|
+
name: 'Task 2',
|
|
437
|
+
state: 'complete',
|
|
438
|
+
pages: ['grade']
|
|
439
|
+
}]
|
|
440
|
+
}];
|
|
441
|
+
_context18.next = 3;
|
|
442
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17() {
|
|
443
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
444
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
445
|
+
case 0:
|
|
446
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
447
|
+
pages: PAGES,
|
|
448
|
+
onRowAction: ON_ROW_ACTION,
|
|
449
|
+
onAction: ON_ACTION,
|
|
450
|
+
hide_title: true,
|
|
451
|
+
sections: sections,
|
|
452
|
+
type: "task-list-cya"
|
|
453
|
+
}), container);
|
|
454
|
+
case 1:
|
|
455
|
+
case "end":
|
|
456
|
+
return _context17.stop();
|
|
457
|
+
}
|
|
458
|
+
}, _callee17);
|
|
459
|
+
})));
|
|
460
|
+
case 3:
|
|
461
|
+
taskHeading1 = container.childNodes[0].childNodes[0];
|
|
462
|
+
expect(taskHeading1.tagName).toEqual('H2');
|
|
463
|
+
expect(taskHeading1.textContent).toEqual('Task 1');
|
|
464
|
+
expect(taskHeading1.classList).toContain("govuk-heading-m");
|
|
465
|
+
namesPageHeading = container.childNodes[0].childNodes[1];
|
|
466
|
+
expect(namesPageHeading.tagName).toEqual('DIV');
|
|
467
|
+
expect(namesPageHeading.textContent).toContain('John');
|
|
468
|
+
expect(namesPageHeading.classList).toContain("group-of-rows");
|
|
469
|
+
taskHeading2 = container.childNodes[0].childNodes[2];
|
|
470
|
+
expect(taskHeading2.tagName).toEqual('H2');
|
|
471
|
+
expect(taskHeading2.textContent).toEqual('Task 2');
|
|
472
|
+
expect(taskHeading2.classList).toContain("govuk-heading-m");
|
|
473
|
+
gradePageHeading = container.childNodes[0].childNodes[3];
|
|
474
|
+
expect(gradePageHeading.tagName).toEqual('H3');
|
|
475
|
+
expect(gradePageHeading.textContent).toEqual("What's your grade?");
|
|
476
|
+
expect(gradePageHeading.classList).toContain("govuk-heading-s");
|
|
477
|
+
case 19:
|
|
478
|
+
case "end":
|
|
479
|
+
return _context18.stop();
|
|
480
|
+
}
|
|
481
|
+
}, _callee18);
|
|
482
|
+
})));
|
|
483
|
+
it('should show task list in CYA style and priotitise displayName over name for a task', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20() {
|
|
484
|
+
var sections, taskHeading1, taskHeading2;
|
|
485
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
486
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
487
|
+
case 0:
|
|
488
|
+
sections = [{
|
|
489
|
+
name: 'These are your tasks',
|
|
490
|
+
tasks: [{
|
|
491
|
+
name: 'Task 1',
|
|
492
|
+
displayName: 'Blue',
|
|
493
|
+
state: 'complete',
|
|
494
|
+
pages: ['names']
|
|
495
|
+
}, {
|
|
496
|
+
name: 'Task 2',
|
|
497
|
+
displayName: 'Red',
|
|
498
|
+
state: 'complete',
|
|
499
|
+
pages: ['grade']
|
|
500
|
+
}]
|
|
501
|
+
}];
|
|
502
|
+
_context20.next = 3;
|
|
503
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19() {
|
|
504
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
505
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
506
|
+
case 0:
|
|
507
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
508
|
+
pages: PAGES,
|
|
509
|
+
onRowAction: ON_ROW_ACTION,
|
|
510
|
+
onAction: ON_ACTION,
|
|
511
|
+
hide_title: true,
|
|
512
|
+
sections: sections,
|
|
513
|
+
type: "task-list-cya"
|
|
514
|
+
}), container);
|
|
515
|
+
case 1:
|
|
516
|
+
case "end":
|
|
517
|
+
return _context19.stop();
|
|
518
|
+
}
|
|
519
|
+
}, _callee19);
|
|
520
|
+
})));
|
|
521
|
+
case 3:
|
|
522
|
+
taskHeading1 = container.childNodes[0].childNodes[0];
|
|
523
|
+
expect(taskHeading1.textContent).toEqual('Blue');
|
|
524
|
+
taskHeading2 = container.childNodes[0].childNodes[2];
|
|
525
|
+
expect(taskHeading2.textContent).toEqual('Red');
|
|
526
|
+
case 7:
|
|
527
|
+
case "end":
|
|
528
|
+
return _context20.stop();
|
|
529
|
+
}
|
|
530
|
+
}, _callee20);
|
|
531
|
+
})));
|
|
532
|
+
it('should show task list in CYA style and not show sections without any pages', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22() {
|
|
533
|
+
var sections, taskHeading1, taskHeading2;
|
|
534
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
535
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
536
|
+
case 0:
|
|
537
|
+
sections = [{
|
|
538
|
+
name: 'These are your tasks',
|
|
539
|
+
tasks: [{
|
|
540
|
+
name: 'Task 1',
|
|
541
|
+
displayName: 'Blue',
|
|
542
|
+
state: 'complete',
|
|
543
|
+
pages: []
|
|
544
|
+
}, {
|
|
545
|
+
name: 'Task 2',
|
|
546
|
+
displayName: 'Red',
|
|
547
|
+
state: 'complete',
|
|
548
|
+
pages: ['grade']
|
|
549
|
+
}]
|
|
550
|
+
}];
|
|
551
|
+
_context22.next = 3;
|
|
552
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21() {
|
|
553
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
554
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
555
|
+
case 0:
|
|
556
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
557
|
+
pages: PAGES,
|
|
558
|
+
onRowAction: ON_ROW_ACTION,
|
|
559
|
+
onAction: ON_ACTION,
|
|
560
|
+
hide_title: true,
|
|
561
|
+
sections: sections,
|
|
562
|
+
type: "task-list-cya"
|
|
563
|
+
}), container);
|
|
564
|
+
case 1:
|
|
565
|
+
case "end":
|
|
566
|
+
return _context21.stop();
|
|
567
|
+
}
|
|
568
|
+
}, _callee21);
|
|
569
|
+
})));
|
|
570
|
+
case 3:
|
|
571
|
+
taskHeading1 = container.childNodes[0].childNodes[0];
|
|
572
|
+
expect(taskHeading1.textContent).toEqual('');
|
|
573
|
+
taskHeading2 = container.childNodes[0].childNodes[1];
|
|
574
|
+
expect(taskHeading2.textContent).toEqual('Red');
|
|
575
|
+
case 7:
|
|
576
|
+
case "end":
|
|
577
|
+
return _context22.stop();
|
|
578
|
+
}
|
|
579
|
+
}, _callee22);
|
|
580
|
+
})));
|
|
581
|
+
it('Show answers from multiple address fields into in one DL', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee24() {
|
|
582
|
+
var ADDRESS_DATA, GROUP_PAGES, cya, groupedComponent, keyGroup, valueGroup, changeButtonDiv, changeButton;
|
|
583
|
+
return _regeneratorRuntime().wrap(function _callee24$(_context24) {
|
|
584
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
585
|
+
case 0:
|
|
586
|
+
ADDRESS_DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
|
|
587
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, ADDRESS_DATA));
|
|
588
|
+
_context24.next = 4;
|
|
589
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee23() {
|
|
590
|
+
return _regeneratorRuntime().wrap(function _callee23$(_context23) {
|
|
591
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
592
|
+
case 0:
|
|
593
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
594
|
+
pages: GROUP_PAGES,
|
|
595
|
+
onRowAction: ON_ROW_ACTION,
|
|
596
|
+
onAction: ON_ACTION,
|
|
597
|
+
hide_title: true
|
|
598
|
+
}), container);
|
|
599
|
+
case 1:
|
|
600
|
+
case "end":
|
|
601
|
+
return _context23.stop();
|
|
602
|
+
}
|
|
603
|
+
}, _callee23);
|
|
604
|
+
})));
|
|
605
|
+
case 4:
|
|
606
|
+
cya = checkCYA(container);
|
|
607
|
+
groupedComponent = cya.childNodes[10];
|
|
608
|
+
keyGroup = groupedComponent.childNodes[0].childNodes[0].childNodes[0];
|
|
609
|
+
expect(keyGroup.tagName).toEqual('DT');
|
|
610
|
+
expect(keyGroup.textContent).toEqual('Address details');
|
|
611
|
+
valueGroup = groupedComponent.childNodes[0].childNodes[0].childNodes[1];
|
|
612
|
+
expect(valueGroup.childNodes.length).toEqual(4);
|
|
613
|
+
expect(valueGroup.tagName).toEqual('DD');
|
|
614
|
+
expect(valueGroup.childNodes[0].textContent).toContain('10 Downing Street');
|
|
615
|
+
expect(valueGroup.childNodes[1].textContent).toContain('City of Westminster');
|
|
616
|
+
expect(valueGroup.childNodes[2].textContent).toContain('London');
|
|
617
|
+
expect(valueGroup.childNodes[3].textContent).toContain('SW1A 2AA');
|
|
618
|
+
changeButtonDiv = groupedComponent.childNodes[0].childNodes[0].childNodes[2];
|
|
619
|
+
expect(changeButtonDiv.classList).toContain('govuk-summary-list__actions');
|
|
620
|
+
changeButton = changeButtonDiv.childNodes[0];
|
|
621
|
+
expect(changeButton.tagName).toEqual('A');
|
|
622
|
+
expect(changeButton.textContent).toEqual('Change address details');
|
|
623
|
+
case 21:
|
|
624
|
+
case "end":
|
|
625
|
+
return _context24.stop();
|
|
626
|
+
}
|
|
627
|
+
}, _callee24);
|
|
628
|
+
})));
|
|
629
|
+
it('should render a group with one action button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee26() {
|
|
630
|
+
var GROUP_PAGES, cya, namesGroup, firstNameRow, surname, changeButtonDiv, changeButton;
|
|
631
|
+
return _regeneratorRuntime().wrap(function _callee26$(_context26) {
|
|
632
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
633
|
+
case 0:
|
|
634
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
|
|
635
|
+
_context26.next = 3;
|
|
636
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee25() {
|
|
637
|
+
return _regeneratorRuntime().wrap(function _callee25$(_context25) {
|
|
638
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
639
|
+
case 0:
|
|
640
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
641
|
+
pages: GROUP_PAGES,
|
|
642
|
+
onRowAction: ON_ROW_ACTION,
|
|
643
|
+
onAction: ON_ACTION,
|
|
644
|
+
groups: _groupOfRow.default.cya.groups
|
|
645
|
+
}), container);
|
|
646
|
+
case 1:
|
|
647
|
+
case "end":
|
|
648
|
+
return _context25.stop();
|
|
649
|
+
}
|
|
650
|
+
}, _callee25);
|
|
651
|
+
})));
|
|
652
|
+
case 3:
|
|
653
|
+
cya = checkCYA(container);
|
|
654
|
+
namesGroup = cya.childNodes[2];
|
|
655
|
+
firstNameRow = namesGroup.childNodes[0].childNodes[0];
|
|
656
|
+
expect(firstNameRow.childNodes.length).toEqual(2);
|
|
657
|
+
expect(firstNameRow.childNodes[0].textContent).toEqual('First name (optional)');
|
|
658
|
+
expect(firstNameRow.childNodes[0].tagName).toEqual('DT');
|
|
659
|
+
expect(firstNameRow.childNodes[1].textContent).toEqual('John');
|
|
660
|
+
expect(firstNameRow.childNodes[1].tagName).toEqual('DD');
|
|
661
|
+
surname = namesGroup.childNodes[0].childNodes[1];
|
|
662
|
+
expect(surname.childNodes.length).toEqual(2);
|
|
663
|
+
expect(surname.childNodes[0].textContent).toEqual('Last name (optional)');
|
|
664
|
+
expect(surname.childNodes[0].tagName).toEqual('DT');
|
|
665
|
+
expect(surname.childNodes[1].textContent).toEqual('Smith');
|
|
666
|
+
expect(surname.childNodes[1].tagName).toEqual('DD');
|
|
667
|
+
changeButtonDiv = namesGroup.childNodes[0].childNodes[2];
|
|
668
|
+
expect(changeButtonDiv.classList).toContain('change-group-button');
|
|
669
|
+
changeButton = changeButtonDiv.childNodes[0];
|
|
670
|
+
expect(changeButton.tagName).toEqual('A');
|
|
671
|
+
expect(changeButton.textContent).toEqual('Change names');
|
|
672
|
+
case 22:
|
|
673
|
+
case "end":
|
|
674
|
+
return _context26.stop();
|
|
675
|
+
}
|
|
676
|
+
}, _callee26);
|
|
677
|
+
})));
|
|
678
|
+
it('should show a conditional button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee28() {
|
|
679
|
+
var GROUP_PAGES, cya, hodsButtonDiv, submitButton, saveButton;
|
|
680
|
+
return _regeneratorRuntime().wrap(function _callee28$(_context28) {
|
|
681
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
682
|
+
case 0:
|
|
683
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
|
|
684
|
+
_context28.next = 3;
|
|
685
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee27() {
|
|
686
|
+
return _regeneratorRuntime().wrap(function _callee27$(_context27) {
|
|
687
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
688
|
+
case 0:
|
|
689
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
690
|
+
pages: GROUP_PAGES,
|
|
691
|
+
onRowAction: ON_ROW_ACTION,
|
|
692
|
+
onAction: ON_ACTION,
|
|
693
|
+
groups: _groupOfRow.default.cya.groups,
|
|
694
|
+
actions: _actions.default
|
|
695
|
+
}), container);
|
|
696
|
+
case 1:
|
|
697
|
+
case "end":
|
|
698
|
+
return _context27.stop();
|
|
699
|
+
}
|
|
700
|
+
}, _callee27);
|
|
701
|
+
})));
|
|
702
|
+
case 3:
|
|
703
|
+
cya = checkCYA(container);
|
|
704
|
+
hodsButtonDiv = cya.childNodes[7];
|
|
705
|
+
expect(hodsButtonDiv.classList).toContain('hods-button-group');
|
|
706
|
+
submitButton = hodsButtonDiv.childNodes[0];
|
|
707
|
+
expect(submitButton.tagName).toEqual('BUTTON');
|
|
708
|
+
expect(submitButton.textContent).toEqual('Submit');
|
|
709
|
+
saveButton = hodsButtonDiv.childNodes[1];
|
|
710
|
+
expect(saveButton.tagName).toEqual('BUTTON');
|
|
711
|
+
expect(saveButton.textContent).toEqual('Save and return later');
|
|
712
|
+
case 12:
|
|
713
|
+
case "end":
|
|
714
|
+
return _context28.stop();
|
|
715
|
+
}
|
|
716
|
+
}, _callee28);
|
|
717
|
+
})));
|
|
718
|
+
it('should not show a conditional button', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee30() {
|
|
719
|
+
var GROUP_PAGES, cya, hodsButtonDiv, submitButton, saveButton;
|
|
720
|
+
return _regeneratorRuntime().wrap(function _callee30$(_context30) {
|
|
721
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
722
|
+
case 0:
|
|
723
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, _objectSpread({}, DATA));
|
|
724
|
+
_context30.next = 3;
|
|
725
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee29() {
|
|
726
|
+
return _regeneratorRuntime().wrap(function _callee29$(_context29) {
|
|
727
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
728
|
+
case 0:
|
|
729
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
730
|
+
pages: GROUP_PAGES,
|
|
731
|
+
onRowAction: ON_ROW_ACTION,
|
|
732
|
+
onAction: ON_ACTION,
|
|
733
|
+
groups: _groupOfRow.default.cya.groups,
|
|
734
|
+
actions: _actionsNoSave.default
|
|
735
|
+
}), container);
|
|
736
|
+
case 1:
|
|
737
|
+
case "end":
|
|
738
|
+
return _context29.stop();
|
|
739
|
+
}
|
|
740
|
+
}, _callee29);
|
|
741
|
+
})));
|
|
742
|
+
case 3:
|
|
743
|
+
cya = checkCYA(container);
|
|
744
|
+
hodsButtonDiv = cya.childNodes[7];
|
|
745
|
+
expect(hodsButtonDiv.classList).toContain('hods-button-group');
|
|
746
|
+
submitButton = hodsButtonDiv.childNodes[0];
|
|
747
|
+
expect(submitButton.tagName).toEqual('BUTTON');
|
|
748
|
+
expect(submitButton.textContent).toEqual('Submit');
|
|
749
|
+
saveButton = hodsButtonDiv.childNodes[1];
|
|
750
|
+
expect(saveButton).toEqual(undefined);
|
|
751
|
+
case 11:
|
|
752
|
+
case "end":
|
|
753
|
+
return _context30.stop();
|
|
754
|
+
}
|
|
755
|
+
}, _callee30);
|
|
756
|
+
})));
|
|
757
|
+
it('should render empty optional fields with a placeholder value when provided', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee32() {
|
|
758
|
+
var GROUP_PAGES, cya, namesGroup, firstNameRow, surname;
|
|
759
|
+
return _regeneratorRuntime().wrap(function _callee32$(_context32) {
|
|
760
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
761
|
+
case 0:
|
|
762
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_groupOfRow.default.pages, _groupOfRow.default.components, {});
|
|
763
|
+
_context32.next = 3;
|
|
764
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee31() {
|
|
765
|
+
return _regeneratorRuntime().wrap(function _callee31$(_context31) {
|
|
766
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
767
|
+
case 0:
|
|
768
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
769
|
+
pages: GROUP_PAGES,
|
|
770
|
+
groups: _groupOfRow.default.cya.groups,
|
|
771
|
+
optionalFieldPlaceholder: "Not entered"
|
|
772
|
+
}), container);
|
|
773
|
+
case 1:
|
|
774
|
+
case "end":
|
|
775
|
+
return _context31.stop();
|
|
776
|
+
}
|
|
777
|
+
}, _callee31);
|
|
778
|
+
})));
|
|
779
|
+
case 3:
|
|
780
|
+
cya = checkCYA(container);
|
|
781
|
+
namesGroup = cya.childNodes[2];
|
|
782
|
+
firstNameRow = namesGroup.childNodes[0].childNodes[0];
|
|
783
|
+
expect(firstNameRow.childNodes.length).toEqual(2);
|
|
784
|
+
expect(firstNameRow.childNodes[0].textContent).toEqual('First name (optional)');
|
|
785
|
+
expect(firstNameRow.childNodes[0].tagName).toEqual('DT');
|
|
786
|
+
expect(firstNameRow.childNodes[1].textContent).toEqual('Not entered');
|
|
787
|
+
expect(firstNameRow.childNodes[1].tagName).toEqual('DD');
|
|
788
|
+
surname = namesGroup.childNodes[0].childNodes[1];
|
|
789
|
+
expect(surname.childNodes.length).toEqual(2);
|
|
790
|
+
expect(surname.childNodes[0].textContent).toEqual('Last name (optional)');
|
|
791
|
+
expect(surname.childNodes[0].tagName).toEqual('DT');
|
|
792
|
+
expect(surname.childNodes[1].textContent).toEqual('Not entered');
|
|
793
|
+
expect(surname.childNodes[1].tagName).toEqual('DD');
|
|
794
|
+
case 17:
|
|
795
|
+
case "end":
|
|
796
|
+
return _context32.stop();
|
|
797
|
+
}
|
|
798
|
+
}, _callee32);
|
|
799
|
+
})));
|
|
800
|
+
it('should show page components corrently with interpolated title and cya_label, if label is missing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee34() {
|
|
801
|
+
var _PAGES, _COMPONENTS, T_PAGES, cya, _cya$childNodes7, cyaTitle, cyaChildNode, names, _names$childNodes3, firstName, surname, _firstName$childNodes, label;
|
|
802
|
+
return _regeneratorRuntime().wrap(function _callee34$(_context34) {
|
|
803
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
804
|
+
case 0:
|
|
805
|
+
_PAGES = [].concat(_userProfile.default.pages); // eslint-disable-next-line no-template-curly-in-string
|
|
806
|
+
_PAGES[0] = _objectSpread(_objectSpread({}, _PAGES[0]), {}, {
|
|
807
|
+
title: 'Alpha ID: ${businessKey}'
|
|
808
|
+
});
|
|
809
|
+
_COMPONENTS = [].concat(_userProfile.default.components);
|
|
810
|
+
_COMPONENTS[0] = _objectSpread(_objectSpread({}, _COMPONENTS[0]), {}, {
|
|
811
|
+
label: undefined,
|
|
812
|
+
required: true,
|
|
813
|
+
// eslint-disable-next-line no-template-curly-in-string
|
|
814
|
+
cya_label: "Text ${currentUser.familyName}"
|
|
815
|
+
});
|
|
816
|
+
T_PAGES = _utils.default.FormPage.getAll(_PAGES, _COMPONENTS, DATA);
|
|
817
|
+
_context34.next = 7;
|
|
818
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee33() {
|
|
819
|
+
return _regeneratorRuntime().wrap(function _callee33$(_context33) {
|
|
820
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
821
|
+
case 0:
|
|
822
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
823
|
+
pages: T_PAGES,
|
|
824
|
+
onRowAction: ON_ROW_ACTION,
|
|
825
|
+
onAction: ON_ACTION
|
|
826
|
+
}), container);
|
|
827
|
+
case 1:
|
|
828
|
+
case "end":
|
|
829
|
+
return _context33.stop();
|
|
830
|
+
}
|
|
831
|
+
}, _callee33);
|
|
832
|
+
})));
|
|
833
|
+
case 7:
|
|
834
|
+
cya = checkCYA(container);
|
|
835
|
+
_cya$childNodes7 = _slicedToArray(cya.childNodes, 3), cyaTitle = _cya$childNodes7[1], cyaChildNode = _cya$childNodes7[2];
|
|
836
|
+
expect(cyaTitle.textContent).toEqual('Alpha ID: 123456789');
|
|
837
|
+
names = cyaChildNode.childNodes[0];
|
|
838
|
+
expect(names.tagName).toEqual('DL');
|
|
839
|
+
expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
|
|
840
|
+
_names$childNodes3 = _slicedToArray(names.childNodes, 2), firstName = _names$childNodes3[0], surname = _names$childNodes3[1];
|
|
841
|
+
_firstName$childNodes = _slicedToArray(firstName.childNodes, 1), label = _firstName$childNodes[0];
|
|
842
|
+
expect(label.textContent).toEqual('Text Smith');
|
|
843
|
+
checkRow(surname, 'Last name', 'Smith', false);
|
|
844
|
+
case 17:
|
|
845
|
+
case "end":
|
|
846
|
+
return _context34.stop();
|
|
847
|
+
}
|
|
848
|
+
}, _callee34);
|
|
849
|
+
})));
|
|
850
|
+
it('should show page components corrently with no label, if label and cya_label are missing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee36() {
|
|
851
|
+
var _PAGES, _COMPONENTS, T_PAGES, cya, _cya$childNodes8, cyaChildNode, names, _names$childNodes4, firstName, surname, _firstName$childNodes2, label;
|
|
852
|
+
return _regeneratorRuntime().wrap(function _callee36$(_context36) {
|
|
853
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
854
|
+
case 0:
|
|
855
|
+
_PAGES = [].concat(_userProfile.default.pages);
|
|
856
|
+
_COMPONENTS = [].concat(_userProfile.default.components);
|
|
857
|
+
_COMPONENTS[0] = _objectSpread(_objectSpread({}, _COMPONENTS[0]), {}, {
|
|
858
|
+
label: undefined,
|
|
859
|
+
required: true,
|
|
860
|
+
cya_label: undefined
|
|
861
|
+
});
|
|
862
|
+
T_PAGES = _utils.default.FormPage.getAll(_PAGES, _COMPONENTS, _objectSpread({}, DATA));
|
|
863
|
+
_context36.next = 6;
|
|
864
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee35() {
|
|
865
|
+
return _regeneratorRuntime().wrap(function _callee35$(_context35) {
|
|
866
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
867
|
+
case 0:
|
|
868
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
869
|
+
pages: T_PAGES,
|
|
870
|
+
onRowAction: ON_ROW_ACTION,
|
|
871
|
+
onAction: ON_ACTION
|
|
872
|
+
}), container);
|
|
873
|
+
case 1:
|
|
874
|
+
case "end":
|
|
875
|
+
return _context35.stop();
|
|
876
|
+
}
|
|
877
|
+
}, _callee35);
|
|
878
|
+
})));
|
|
879
|
+
case 6:
|
|
880
|
+
cya = checkCYA(container);
|
|
881
|
+
_cya$childNodes8 = _slicedToArray(cya.childNodes, 2), cyaChildNode = _cya$childNodes8[1];
|
|
882
|
+
names = cyaChildNode.childNodes[0];
|
|
883
|
+
expect(names.tagName).toEqual('DL');
|
|
884
|
+
expect(names.classList).toContain("govuk-!-margin-bottom-".concat(_CheckYourAnswers.DEFAULT_MARGIN_BOTTOM));
|
|
885
|
+
_names$childNodes4 = _slicedToArray(names.childNodes, 2), firstName = _names$childNodes4[0], surname = _names$childNodes4[1];
|
|
886
|
+
_firstName$childNodes2 = _slicedToArray(firstName.childNodes, 1), label = _firstName$childNodes2[0];
|
|
887
|
+
expect(label.textContent).toEqual("");
|
|
888
|
+
checkRow(surname, 'Last name', 'Smith', false);
|
|
889
|
+
case 15:
|
|
890
|
+
case "end":
|
|
891
|
+
return _context36.stop();
|
|
892
|
+
}
|
|
893
|
+
}, _callee36);
|
|
894
|
+
})));
|
|
895
|
+
it('should show task list in CYA style and hide pages from skipped tasks', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee38() {
|
|
896
|
+
var sections, taskHeading1, namesPageHeading;
|
|
897
|
+
return _regeneratorRuntime().wrap(function _callee38$(_context38) {
|
|
898
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
899
|
+
case 0:
|
|
900
|
+
sections = [{
|
|
901
|
+
name: 'These are your tasks',
|
|
902
|
+
tasks: [{
|
|
903
|
+
name: 'Task 1',
|
|
904
|
+
state: 'complete',
|
|
905
|
+
pages: ['names']
|
|
906
|
+
}, {
|
|
907
|
+
name: 'Task 2',
|
|
908
|
+
state: 'skipped',
|
|
909
|
+
pages: ['grade']
|
|
910
|
+
}]
|
|
911
|
+
}];
|
|
912
|
+
_context38.next = 3;
|
|
913
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee37() {
|
|
914
|
+
return _regeneratorRuntime().wrap(function _callee37$(_context37) {
|
|
915
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
916
|
+
case 0:
|
|
917
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
918
|
+
pages: PAGES,
|
|
919
|
+
onRowAction: ON_ROW_ACTION,
|
|
920
|
+
onAction: ON_ACTION,
|
|
921
|
+
hide_title: true,
|
|
922
|
+
sections: sections,
|
|
923
|
+
type: "task-list-cya"
|
|
924
|
+
}), container);
|
|
925
|
+
case 1:
|
|
926
|
+
case "end":
|
|
927
|
+
return _context37.stop();
|
|
928
|
+
}
|
|
929
|
+
}, _callee37);
|
|
930
|
+
})));
|
|
931
|
+
case 3:
|
|
932
|
+
taskHeading1 = container.childNodes[0].childNodes[0];
|
|
933
|
+
expect(taskHeading1.tagName).toEqual('H2');
|
|
934
|
+
expect(taskHeading1.textContent).toEqual('Task 1');
|
|
935
|
+
expect(taskHeading1.classList).toContain("govuk-heading-m");
|
|
936
|
+
namesPageHeading = container.childNodes[0].childNodes[1];
|
|
937
|
+
expect(namesPageHeading.tagName).toEqual('DIV');
|
|
938
|
+
expect(namesPageHeading.textContent).toContain('John');
|
|
939
|
+
expect(namesPageHeading.classList).toContain("group-of-rows");
|
|
940
|
+
expect(container.childNodes[0].childNodes.length).toEqual(2); // second task skipped so not shown
|
|
941
|
+
case 12:
|
|
942
|
+
case "end":
|
|
943
|
+
return _context38.stop();
|
|
944
|
+
}
|
|
945
|
+
}, _callee38);
|
|
946
|
+
})));
|
|
947
|
+
it('Show answers from multiple address fields into in one DL correctly when hideBlankRows is true', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee40() {
|
|
948
|
+
var ADDRESS_DATA, GROUP_PAGES, cya, groupedComponent, keyGroup, valueGroup, changeButtonDiv, changeButton;
|
|
949
|
+
return _regeneratorRuntime().wrap(function _callee40$(_context40) {
|
|
950
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
951
|
+
case 0:
|
|
952
|
+
ADDRESS_DATA = _utils.default.Data.setupForm(_group.default.pages, _group.default.components, _groupData.default);
|
|
953
|
+
GROUP_PAGES = _utils.default.FormPage.getAll(_group.default.pages, _group.default.components, _objectSpread({}, ADDRESS_DATA));
|
|
954
|
+
_context40.next = 4;
|
|
955
|
+
return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee39() {
|
|
956
|
+
return _regeneratorRuntime().wrap(function _callee39$(_context39) {
|
|
957
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
958
|
+
case 0:
|
|
959
|
+
(0, _setupTests.renderDomWithValidation)( /*#__PURE__*/_react.default.createElement(_CheckYourAnswers.default, {
|
|
960
|
+
pages: GROUP_PAGES,
|
|
961
|
+
onRowAction: ON_ROW_ACTION,
|
|
962
|
+
onAction: ON_ACTION,
|
|
963
|
+
hide_title: true,
|
|
964
|
+
hideBlankRows: true
|
|
965
|
+
}), container);
|
|
966
|
+
case 1:
|
|
967
|
+
case "end":
|
|
968
|
+
return _context39.stop();
|
|
969
|
+
}
|
|
970
|
+
}, _callee39);
|
|
971
|
+
})));
|
|
972
|
+
case 4:
|
|
973
|
+
cya = checkCYA(container);
|
|
974
|
+
groupedComponent = cya.childNodes[6];
|
|
975
|
+
keyGroup = groupedComponent.childNodes[0].childNodes[0].childNodes[0];
|
|
976
|
+
expect(keyGroup.tagName).toEqual('DT');
|
|
977
|
+
expect(keyGroup.textContent).toEqual('Address details');
|
|
978
|
+
valueGroup = groupedComponent.childNodes[0].childNodes[0].childNodes[1];
|
|
979
|
+
expect(valueGroup.childNodes.length).toEqual(4);
|
|
980
|
+
expect(valueGroup.tagName).toEqual('DD');
|
|
981
|
+
expect(valueGroup.childNodes[0].textContent).toContain('10 Downing Street');
|
|
982
|
+
expect(valueGroup.childNodes[1].textContent).toContain('City of Westminster');
|
|
983
|
+
expect(valueGroup.childNodes[2].textContent).toContain('London');
|
|
984
|
+
expect(valueGroup.childNodes[3].textContent).toContain('SW1A 2AA');
|
|
985
|
+
changeButtonDiv = groupedComponent.childNodes[0].childNodes[0].childNodes[2];
|
|
986
|
+
expect(changeButtonDiv.classList).toContain('govuk-summary-list__actions');
|
|
987
|
+
changeButton = changeButtonDiv.childNodes[0];
|
|
988
|
+
expect(changeButton.tagName).toEqual('A');
|
|
989
|
+
expect(changeButton.textContent).toEqual('Change address details');
|
|
990
|
+
case 21:
|
|
991
|
+
case "end":
|
|
992
|
+
return _context40.stop();
|
|
993
|
+
}
|
|
994
|
+
}, _callee40);
|
|
995
|
+
})));
|
|
618
996
|
});
|
|
619
997
|
});
|