@ukhomeoffice/cop-react-form-renderer 5.14.2 → 5.14.4
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 +94 -128
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +99 -129
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +291 -501
- package/dist/components/CheckYourAnswers/index.js +2 -3
- package/dist/components/CollectionPage/CollectionPage.js +64 -58
- package/dist/components/CollectionPage/CollectionPage.test.js +212 -238
- package/dist/components/CollectionPage/index.js +2 -3
- package/dist/components/FormComponent/Collection.js +77 -113
- package/dist/components/FormComponent/Collection.test.js +688 -787
- package/dist/components/FormComponent/Container.js +44 -43
- package/dist/components/FormComponent/Container.test.js +316 -346
- package/dist/components/FormComponent/FormComponent.js +58 -64
- package/dist/components/FormComponent/FormComponent.test.js +180 -219
- package/dist/components/FormComponent/helpers/addLabel.js +5 -9
- package/dist/components/FormComponent/helpers/getComponentDisabled.js +2 -3
- package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +8 -8
- package/dist/components/FormComponent/helpers/getComponentError.js +4 -7
- package/dist/components/FormComponent/helpers/getComponentError.test.js +15 -15
- package/dist/components/FormComponent/helpers/getComponentFieldSet.js +2 -2
- 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 +2 -3
- package/dist/components/FormPage/FormPage.js +65 -79
- package/dist/components/FormPage/FormPage.test.js +134 -170
- package/dist/components/FormPage/index.js +2 -3
- package/dist/components/FormRenderer/FormRenderer.js +151 -193
- package/dist/components/FormRenderer/FormRenderer.test.js +598 -920
- package/dist/components/FormRenderer/handlers/cyaAction.js +4 -5
- package/dist/components/FormRenderer/handlers/getPageId.js +2 -5
- 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 +3 -4
- package/dist/components/FormRenderer/handlers/navigate.js +5 -6
- package/dist/components/FormRenderer/handlers/submissionError.js +2 -3
- package/dist/components/FormRenderer/helpers/canActionProceed.js +2 -3
- package/dist/components/FormRenderer/helpers/canActionProceed.test.js +10 -10
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +2 -5
- package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +17 -21
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +19 -27
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +17 -17
- package/dist/components/FormRenderer/helpers/getCYA.js +6 -9
- package/dist/components/FormRenderer/helpers/getCYA.test.js +12 -12
- package/dist/components/FormRenderer/helpers/getFormState.js +7 -10
- package/dist/components/FormRenderer/helpers/getFormState.test.js +11 -11
- package/dist/components/FormRenderer/helpers/getNextPageId.js +19 -34
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +68 -68
- package/dist/components/FormRenderer/helpers/getPage.js +3 -6
- package/dist/components/FormRenderer/helpers/getPage.test.js +12 -12
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +9 -13
- package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +15 -15
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +12 -13
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +98 -92
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +66 -66
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +72 -79
- package/dist/components/FormRenderer/helpers/index.js +3 -4
- package/dist/components/FormRenderer/index.js +2 -3
- package/dist/components/FormRenderer/onCYAAction.js +52 -62
- package/dist/components/FormRenderer/onCYAAction.test.js +146 -138
- package/dist/components/FormRenderer/onPageAction.js +48 -47
- package/dist/components/FormRenderer/onPageAction.test.js +219 -205
- package/dist/components/FormRenderer/onTaskAction.js +12 -17
- package/dist/components/FormRenderer/onTaskAction.test.js +94 -89
- package/dist/components/PageActions/ActionButton.js +15 -19
- package/dist/components/PageActions/ActionButton.test.js +58 -79
- package/dist/components/PageActions/PageActions.js +12 -13
- package/dist/components/PageActions/PageActions.test.js +88 -116
- package/dist/components/PageActions/index.js +2 -3
- package/dist/components/SummaryList/GroupAction.js +15 -23
- package/dist/components/SummaryList/GroupAction.test.js +41 -37
- package/dist/components/SummaryList/RowAction.js +14 -19
- package/dist/components/SummaryList/RowAction.test.js +41 -37
- package/dist/components/SummaryList/SummaryList.js +25 -30
- package/dist/components/SummaryList/SummaryList.test.js +160 -182
- package/dist/components/SummaryList/SummaryListHeadingRow.js +9 -8
- package/dist/components/SummaryList/SummaryListRow.js +9 -8
- package/dist/components/SummaryList/SummaryListTitleRow.js +8 -7
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +5 -8
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +24 -24
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +5 -8
- 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 +2 -3
- package/dist/components/TaskList/Task.js +22 -33
- package/dist/components/TaskList/Task.test.js +84 -77
- package/dist/components/TaskList/TaskList.js +46 -75
- package/dist/components/TaskList/TaskList.test.js +118 -113
- package/dist/components/TaskList/TaskState.js +9 -9
- package/dist/components/TaskList/TaskState.test.js +56 -49
- package/dist/components/TaskList/index.js +2 -3
- package/dist/components/index.js +8 -8
- package/dist/context/HooksContext/HooksContext.js +59 -85
- package/dist/context/HooksContext/HooksContext.test.js +28 -36
- package/dist/context/HooksContext/index.js +4 -6
- package/dist/context/ValidationContext/ValidationContext.js +35 -76
- package/dist/context/ValidationContext/ValidationContext.test.js +50 -61
- package/dist/context/ValidationContext/index.js +4 -6
- package/dist/context/index.js +3 -3
- package/dist/hooks/index.js +10 -11
- package/dist/hooks/useAxios.js +17 -43
- package/dist/hooks/useGetRequest.js +61 -106
- package/dist/hooks/useHooks.js +2 -5
- package/dist/hooks/useRefData.js +29 -45
- package/dist/hooks/useValidation.js +2 -5
- package/dist/index.js +15 -17
- package/dist/models/CollectionLabels.js +2 -3
- package/dist/models/ComponentTypes.js +25 -26
- package/dist/models/EventTypes.js +5 -6
- package/dist/models/FormPages.js +5 -6
- package/dist/models/FormTypes.js +9 -10
- package/dist/models/HubFormats.js +4 -5
- package/dist/models/PageAction.js +45 -42
- package/dist/models/TaskStates.js +30 -31
- package/dist/models/index.js +11 -12
- package/dist/setupTests.js +20 -24
- package/dist/utils/CheckYourAnswers/getCYAAction.js +6 -7
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +53 -55
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +18 -20
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +21 -23
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +17 -21
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +18 -20
- package/dist/utils/CheckYourAnswers/getCYARow.js +8 -10
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +72 -72
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +20 -27
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +16 -17
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +41 -47
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +72 -75
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +71 -78
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +133 -114
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +27 -23
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +112 -106
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +16 -23
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +77 -83
- package/dist/utils/CheckYourAnswers/index.js +3 -4
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +7 -9
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +25 -25
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +9 -16
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +19 -20
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +4 -8
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +15 -15
- package/dist/utils/CollectionPage/index.js +3 -4
- package/dist/utils/CollectionPage/mergeCollectionPages.js +26 -29
- package/dist/utils/CollectionPage/mergeCollectionPages.test.js +15 -15
- package/dist/utils/Component/addShowWhen.js +5 -10
- package/dist/utils/Component/addShowWhen.test.js +38 -38
- package/dist/utils/Component/applyToComponentTree.js +20 -22
- package/dist/utils/Component/applyToComponentTree.test.js +28 -33
- package/dist/utils/Component/cleanAttributes.js +11 -16
- package/dist/utils/Component/cleanAttributes.test.js +17 -18
- package/dist/utils/Component/elevateNestedComponents.js +7 -9
- package/dist/utils/Component/elevateNestedComponents.test.js +19 -19
- package/dist/utils/Component/getComponent.js +91 -99
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +19 -18
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +51 -63
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +41 -49
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +33 -37
- package/dist/utils/Component/getComponentTests/getComponent.details.test.js +21 -19
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +23 -27
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +12 -11
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +18 -16
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +10 -9
- package/dist/utils/Component/getComponentTests/getComponent.list.test.js +18 -16
- package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +24 -27
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +156 -175
- package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +18 -16
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +59 -73
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +19 -23
- package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +35 -41
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +24 -32
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +3 -3
- package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +10 -9
- package/dist/utils/Component/getDefaultValue.js +7 -9
- package/dist/utils/Component/getDefaultValue.test.js +14 -14
- package/dist/utils/Component/index.js +3 -4
- package/dist/utils/Component/isEditable.js +3 -7
- package/dist/utils/Component/isEditable.test.js +14 -15
- package/dist/utils/Component/optionIsSelected.js +2 -3
- package/dist/utils/Component/optionIsSelected.test.js +10 -10
- package/dist/utils/Component/setupContainerComponentsPath.js +30 -33
- package/dist/utils/Component/setupContainerComponentsPath.test.js +16 -16
- package/dist/utils/Component/showComponent.js +4 -6
- package/dist/utils/Component/showComponent.test.js +29 -29
- package/dist/utils/Component/wrapInFormGroup.js +6 -6
- package/dist/utils/Condition/index.js +3 -4
- package/dist/utils/Condition/meetsAllConditions.js +9 -10
- package/dist/utils/Condition/meetsAllConditions.test.js +18 -18
- package/dist/utils/Condition/meetsCondition.js +19 -27
- package/dist/utils/Condition/meetsCondition.test.js +377 -377
- package/dist/utils/Condition/meetsOneCondition.js +7 -8
- package/dist/utils/Condition/meetsOneCondition.test.js +17 -17
- package/dist/utils/Condition/setupConditions.js +15 -21
- package/dist/utils/Condition/setupConditions.test.js +8 -8
- package/dist/utils/Container/getEditableComponents.js +5 -8
- package/dist/utils/Container/getEditableComponents.test.js +44 -46
- package/dist/utils/Container/index.js +3 -4
- package/dist/utils/Container/setupNesting.js +17 -24
- package/dist/utils/Container/setupNesting.test.js +28 -31
- package/dist/utils/Container/showContainer.js +5 -10
- package/dist/utils/Container/showContainer.test.js +31 -31
- package/dist/utils/Data/applyFormula.js +41 -52
- package/dist/utils/Data/applyFormula.test.js +26 -26
- package/dist/utils/Data/getAutocompleteSource.js +11 -14
- package/dist/utils/Data/getAutocompleteSource.test.js +59 -59
- package/dist/utils/Data/getDataPath.js +21 -32
- package/dist/utils/Data/getDataPath.test.js +20 -20
- package/dist/utils/Data/getOptions.js +22 -28
- package/dist/utils/Data/getOptions.test.js +21 -21
- package/dist/utils/Data/getSourceData.js +7 -21
- package/dist/utils/Data/getSourceData.test.js +85 -81
- package/dist/utils/Data/index.js +3 -4
- package/dist/utils/Data/refDataToOptions.js +12 -17
- package/dist/utils/Data/refDataToOptions.test.js +20 -20
- package/dist/utils/Data/setDataItem.js +8 -10
- package/dist/utils/Data/setDataItem.test.js +38 -38
- package/dist/utils/Data/setupFormData.js +32 -48
- package/dist/utils/Data/setupFormData.test.js +99 -98
- package/dist/utils/Data/setupRefDataUrlForComponent.js +22 -30
- package/dist/utils/Data/setupRefDataUrlForComponent.test.js +28 -28
- package/dist/utils/FormPage/applyConditionalProperties.js +7 -12
- package/dist/utils/FormPage/applyConditionalProperties.test.js +16 -19
- package/dist/utils/FormPage/getFormPage.js +17 -19
- package/dist/utils/FormPage/getFormPage.test.js +49 -48
- package/dist/utils/FormPage/getFormPages.js +9 -15
- package/dist/utils/FormPage/getFormPages.test.js +22 -25
- package/dist/utils/FormPage/getPageActions.js +11 -19
- package/dist/utils/FormPage/getPageActions.test.js +33 -33
- package/dist/utils/FormPage/getParagraphFromText.js +6 -9
- package/dist/utils/FormPage/getParagraphFromText.test.js +7 -7
- package/dist/utils/FormPage/index.js +3 -4
- package/dist/utils/FormPage/showFormPage.js +5 -10
- package/dist/utils/FormPage/showFormPage.test.js +33 -33
- package/dist/utils/FormPage/showFormPageCYA.js +4 -5
- package/dist/utils/FormPage/showFormPageCYA.test.js +9 -9
- package/dist/utils/FormPage/useComponent.js +21 -29
- package/dist/utils/FormPage/useComponent.test.js +71 -73
- package/dist/utils/Format/formatData.js +2 -3
- package/dist/utils/Format/formatData.test.js +19 -19
- package/dist/utils/Format/formatDataForComponent.js +6 -9
- package/dist/utils/Format/formatDataForComponent.test.js +50 -78
- package/dist/utils/Format/formatDataForForm.js +7 -10
- package/dist/utils/Format/formatDataForForm.test.js +14 -17
- package/dist/utils/Format/formatDataForPage.js +4 -7
- package/dist/utils/Format/formatDataForPage.test.js +20 -25
- package/dist/utils/Format/index.js +3 -4
- package/dist/utils/Hub/getFormHub.js +3 -4
- package/dist/utils/Hub/getFormHub.test.js +29 -32
- package/dist/utils/Hub/index.js +3 -4
- package/dist/utils/Meta/constants.js +2 -4
- package/dist/utils/Meta/documents/getDocuments.js +2 -6
- package/dist/utils/Meta/documents/getDocuments.test.js +25 -17
- package/dist/utils/Meta/documents/index.js +3 -4
- package/dist/utils/Meta/documents/setDocumentsForField.js +16 -19
- package/dist/utils/Meta/documents/setDocumentsForField.test.js +69 -35
- package/dist/utils/Meta/index.js +3 -4
- package/dist/utils/Operate/checkValueIsTruthy.js +5 -6
- package/dist/utils/Operate/checkValueIsTruthy.test.js +17 -17
- package/dist/utils/Operate/getFirstOf.js +9 -10
- package/dist/utils/Operate/getFirstOf.test.js +33 -33
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +13 -14
- package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +47 -53
- package/dist/utils/Operate/index.js +3 -4
- package/dist/utils/Operate/persistValueInFormData.js +7 -8
- package/dist/utils/Operate/persistValueInFormData.test.js +23 -21
- package/dist/utils/Operate/runPageOperations.js +10 -11
- package/dist/utils/Operate/runPageOperations.test.js +36 -37
- package/dist/utils/Operate/setValueInFormData.js +6 -7
- package/dist/utils/Operate/setValueInFormData.test.js +17 -17
- package/dist/utils/Operate/shouldRun.js +9 -10
- package/dist/utils/Operate/shouldRun.test.js +22 -28
- package/dist/utils/Validate/additional/conditionallyRequired.js +5 -7
- package/dist/utils/Validate/additional/conditionallyRequired.test.js +19 -19
- package/dist/utils/Validate/additional/index.js +8 -9
- package/dist/utils/Validate/additional/index.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeAfter.js +4 -5
- package/dist/utils/Validate/additional/mustBeAfter.test.js +41 -41
- package/dist/utils/Validate/additional/mustBeBefore.js +4 -5
- package/dist/utils/Validate/additional/mustBeBefore.test.js +29 -29
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +8 -14
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +34 -38
- package/dist/utils/Validate/additional/mustBeGreaterThan.js +3 -4
- package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +19 -19
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +5 -6
- package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeInThePast.js +6 -7
- package/dist/utils/Validate/additional/mustBeInThePast.test.js +13 -13
- package/dist/utils/Validate/additional/mustBeLessThan.js +3 -4
- package/dist/utils/Validate/additional/mustBeLessThan.test.js +18 -18
- package/dist/utils/Validate/additional/mustBeLongerThan.js +2 -3
- package/dist/utils/Validate/additional/mustBeLongerThan.test.js +17 -17
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +3 -4
- package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +21 -21
- package/dist/utils/Validate/additional/mustBeShorterThan.js +2 -3
- package/dist/utils/Validate/additional/mustBeShorterThan.test.js +17 -17
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +4 -7
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +15 -17
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +2 -3
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +13 -13
- package/dist/utils/Validate/additional/mustSelectOnlyOne.js +4 -7
- package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +29 -27
- package/dist/utils/Validate/additional/utils.js +9 -25
- package/dist/utils/Validate/index.js +3 -4
- package/dist/utils/Validate/validateCollection.js +22 -29
- package/dist/utils/Validate/validateCollection.test.js +85 -77
- package/dist/utils/Validate/validateComponent.js +19 -19
- package/dist/utils/Validate/validateComponent.test.js +169 -147
- package/dist/utils/Validate/validateContainer.js +16 -22
- package/dist/utils/Validate/validateContainer.test.js +52 -48
- package/dist/utils/Validate/validateDate.js +14 -21
- package/dist/utils/Validate/validateDate.test.js +28 -29
- package/dist/utils/Validate/validateEmail.js +8 -11
- package/dist/utils/Validate/validateEmail.test.js +26 -26
- package/dist/utils/Validate/validateMultifile.js +6 -10
- package/dist/utils/Validate/validateMultifile.test.js +17 -18
- package/dist/utils/Validate/validatePage.js +20 -22
- package/dist/utils/Validate/validatePage.test.js +146 -143
- package/dist/utils/Validate/validateRegex.js +6 -10
- package/dist/utils/Validate/validateRegex.test.js +17 -17
- package/dist/utils/Validate/validateRequired.js +6 -9
- package/dist/utils/Validate/validateRequired.test.js +19 -19
- package/dist/utils/Validate/validateTextArea.js +6 -9
- package/dist/utils/Validate/validateTextArea.test.js +21 -21
- package/dist/utils/Validate/validateTime.js +8 -16
- package/dist/utils/Validate/validateTime.test.js +15 -15
- package/dist/utils/index.js +10 -12
- package/package.json +9 -6
|
@@ -1,88 +1,80 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
3
|
var _react = require("@testing-library/react");
|
|
5
4
|
var _react2 = _interopRequireDefault(require("react"));
|
|
6
5
|
var _SummaryList = _interopRequireWildcard(require("./SummaryList"));
|
|
7
|
-
function _getRequireWildcardCache(
|
|
8
|
-
function _interopRequireWildcard(
|
|
9
|
-
function _interopRequireDefault(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var checkSummaryList = function checkSummaryList(container, id) {
|
|
19
|
-
var summaryList = (0, _react.getByTestId)(container, id);
|
|
6
|
+
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); }
|
|
7
|
+
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 && {}.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; }
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
+
// Global imports
|
|
10
|
+
|
|
11
|
+
// Local imports
|
|
12
|
+
|
|
13
|
+
describe('components', () => {
|
|
14
|
+
describe('SummaryList', () => {
|
|
15
|
+
const checkSummaryList = (container, id) => {
|
|
16
|
+
const summaryList = (0, _react.getByTestId)(container, id);
|
|
20
17
|
expect(summaryList.tagName).toEqual('DL');
|
|
21
18
|
expect(summaryList.classList).toContain(_SummaryList.DEFAULT_CLASS);
|
|
22
19
|
return summaryList;
|
|
23
20
|
};
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const checkTitleRow = (summaryList, index) => {
|
|
22
|
+
const row = summaryList.childNodes[index];
|
|
26
23
|
expect(row.tagName).toEqual('DIV');
|
|
27
|
-
expect(row.classList).toContain(
|
|
28
|
-
expect(row.classList).toContain(
|
|
29
|
-
|
|
30
|
-
heading = _row$childNodes[0];
|
|
24
|
+
expect(row.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__row`);
|
|
25
|
+
expect(row.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__title`);
|
|
26
|
+
const [heading] = row.childNodes;
|
|
31
27
|
expect(heading.tagName).toEqual('H3');
|
|
32
28
|
expect(heading.classList).toContain('govuk-heading-s');
|
|
33
29
|
return heading;
|
|
34
30
|
};
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const checkActionRow = (summaryList, index) => {
|
|
32
|
+
const row = summaryList.childNodes[index];
|
|
37
33
|
expect(row.tagName).toEqual('DIV');
|
|
38
34
|
expect(row.childNodes.length).toEqual(1);
|
|
39
|
-
|
|
35
|
+
const link = row.childNodes[0];
|
|
40
36
|
return link;
|
|
41
37
|
};
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const checkRow = (summaryList, index) => {
|
|
39
|
+
const row = summaryList.childNodes[index];
|
|
44
40
|
expect(row.tagName).toEqual('DIV');
|
|
45
|
-
expect(row.classList).toContain(
|
|
46
|
-
|
|
47
|
-
key = _row$childNodes2[0],
|
|
48
|
-
value = _row$childNodes2[1],
|
|
49
|
-
actions = _row$childNodes2[2];
|
|
41
|
+
expect(row.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__row`);
|
|
42
|
+
const [key, value, actions] = row.childNodes;
|
|
50
43
|
expect(key.tagName).toEqual('DT');
|
|
51
|
-
expect(key.classList).toContain(
|
|
44
|
+
expect(key.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__key`);
|
|
52
45
|
expect(value.tagName).toEqual('DD');
|
|
53
|
-
expect(value.classList).toContain(
|
|
46
|
+
expect(value.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__value`);
|
|
54
47
|
expect(actions.tagName).toEqual('DD');
|
|
55
|
-
expect(actions.classList).toContain(
|
|
48
|
+
expect(actions.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__actions`);
|
|
56
49
|
return [key, value, actions];
|
|
57
50
|
};
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
const checkRowNoChangeActions = (summaryList, index) => {
|
|
52
|
+
const row = summaryList.childNodes[index];
|
|
60
53
|
expect(row.tagName).toEqual('DIV');
|
|
61
|
-
expect(row.classList).toContain(
|
|
62
|
-
|
|
63
|
-
key = _row$childNodes3[0],
|
|
64
|
-
value = _row$childNodes3[1];
|
|
54
|
+
expect(row.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__row`);
|
|
55
|
+
const [key, value] = row.childNodes;
|
|
65
56
|
expect(key.tagName).toEqual('DT');
|
|
66
|
-
expect(key.classList).toContain(
|
|
57
|
+
expect(key.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__key`);
|
|
67
58
|
expect(value.tagName).toEqual('DD');
|
|
68
|
-
expect(value.classList).toContain(
|
|
59
|
+
expect(value.classList).toContain(`${_SummaryList.DEFAULT_CLASS}__value`);
|
|
69
60
|
expect(row.childNodes.length).toEqual(2);
|
|
70
61
|
return [key, value];
|
|
71
62
|
};
|
|
72
|
-
it('should handle an empty rows array',
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
63
|
+
it('should handle an empty rows array', () => {
|
|
64
|
+
const ID = 'test-id';
|
|
65
|
+
const ROWS = [];
|
|
66
|
+
const {
|
|
67
|
+
container
|
|
68
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
69
|
+
"data-testid": ID,
|
|
70
|
+
rows: ROWS
|
|
71
|
+
}));
|
|
72
|
+
const summaryList = checkSummaryList(container, ID);
|
|
81
73
|
expect(summaryList.childNodes.length).toEqual(0);
|
|
82
74
|
});
|
|
83
|
-
it('should handle rows with no actions and string values',
|
|
84
|
-
|
|
85
|
-
|
|
75
|
+
it('should handle rows with no actions and string values', () => {
|
|
76
|
+
const ID = 'test-id';
|
|
77
|
+
const ROWS = [{
|
|
86
78
|
key: 'a',
|
|
87
79
|
pageId: 'p1',
|
|
88
80
|
fieldId: 'a',
|
|
@@ -93,28 +85,25 @@ describe('components', function () {
|
|
|
93
85
|
fieldId: 'b',
|
|
94
86
|
value: 'Bravo value'
|
|
95
87
|
}];
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
const {
|
|
89
|
+
container
|
|
90
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
91
|
+
"data-testid": ID,
|
|
92
|
+
rows: ROWS,
|
|
93
|
+
noGroupAction: true
|
|
94
|
+
}));
|
|
95
|
+
const summaryList = checkSummaryList(container, ID);
|
|
103
96
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
104
|
-
ROWS.forEach(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
key = _checkRow2[0],
|
|
108
|
-
value = _checkRow2[1],
|
|
109
|
-
actions = _checkRow2[2];
|
|
110
|
-
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
97
|
+
ROWS.forEach((row, index) => {
|
|
98
|
+
const [key, value, actions] = checkRow(summaryList, index);
|
|
99
|
+
expect(key.textContent).toEqual(`${row.key} (optional)`);
|
|
111
100
|
expect(value.textContent).toEqual(row.value);
|
|
112
101
|
expect(actions.childNodes.length).toEqual(0);
|
|
113
102
|
});
|
|
114
103
|
});
|
|
115
|
-
it('should handle title rows',
|
|
116
|
-
|
|
117
|
-
|
|
104
|
+
it('should handle title rows', () => {
|
|
105
|
+
const ID = 'test-id';
|
|
106
|
+
const ROWS = [{
|
|
118
107
|
key: 'Title',
|
|
119
108
|
pageId: 'p1',
|
|
120
109
|
fieldId: 'a',
|
|
@@ -130,28 +119,25 @@ describe('components', function () {
|
|
|
130
119
|
fieldId: 'c',
|
|
131
120
|
value: 'Bravo value'
|
|
132
121
|
}];
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
const {
|
|
123
|
+
container
|
|
124
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
125
|
+
"data-testid": ID,
|
|
126
|
+
rows: ROWS
|
|
127
|
+
}));
|
|
128
|
+
const summaryList = checkSummaryList(container, ID);
|
|
139
129
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
140
|
-
|
|
141
|
-
|
|
130
|
+
const assessTitleRow = (row, index) => {
|
|
131
|
+
const heading = checkTitleRow(summaryList, index);
|
|
142
132
|
expect(heading.textContent).toEqual(row.key);
|
|
143
133
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
key = _checkRow4[0],
|
|
148
|
-
value = _checkRow4[1],
|
|
149
|
-
actions = _checkRow4[2];
|
|
150
|
-
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
134
|
+
const assessRow = (row, index) => {
|
|
135
|
+
const [key, value, actions] = checkRow(summaryList, index);
|
|
136
|
+
expect(key.textContent).toEqual(`${row.key} (optional)`);
|
|
151
137
|
expect(value.textContent).toEqual(row.value);
|
|
152
138
|
expect(actions.childNodes.length).toEqual(0);
|
|
153
139
|
};
|
|
154
|
-
ROWS.forEach(
|
|
140
|
+
ROWS.forEach((row, index) => {
|
|
155
141
|
if (row.type === 'title') {
|
|
156
142
|
assessTitleRow(row, index);
|
|
157
143
|
} else {
|
|
@@ -159,9 +145,9 @@ describe('components', function () {
|
|
|
159
145
|
}
|
|
160
146
|
});
|
|
161
147
|
});
|
|
162
|
-
it('should handle action rows',
|
|
163
|
-
|
|
164
|
-
|
|
148
|
+
it('should handle action rows', () => {
|
|
149
|
+
const ID = 'test-id';
|
|
150
|
+
const ROWS = [{
|
|
165
151
|
key: 'a',
|
|
166
152
|
pageId: 'p1',
|
|
167
153
|
fieldId: 'a',
|
|
@@ -186,24 +172,25 @@ describe('components', function () {
|
|
|
186
172
|
label: 'Do action'
|
|
187
173
|
}
|
|
188
174
|
}];
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
175
|
+
const {
|
|
176
|
+
container
|
|
177
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
178
|
+
"data-testid": ID,
|
|
179
|
+
rows: ROWS
|
|
180
|
+
}));
|
|
181
|
+
const summaryList = checkSummaryList(container, ID);
|
|
195
182
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
196
|
-
|
|
197
|
-
|
|
183
|
+
const assessActionRow = (row, index) => {
|
|
184
|
+
const link = checkActionRow(summaryList, index);
|
|
198
185
|
expect(link.textContent).toEqual(row.action.label);
|
|
199
186
|
};
|
|
200
|
-
ROWS.forEach(
|
|
187
|
+
ROWS.forEach((row, index) => {
|
|
201
188
|
assessActionRow(row, index);
|
|
202
189
|
});
|
|
203
190
|
});
|
|
204
|
-
it('should hide actions rows if flag is given',
|
|
205
|
-
|
|
206
|
-
|
|
191
|
+
it('should hide actions rows if flag is given', () => {
|
|
192
|
+
const ID = 'test-id';
|
|
193
|
+
const ROWS = [{
|
|
207
194
|
key: 'a',
|
|
208
195
|
pageId: 'p1',
|
|
209
196
|
fieldId: 'a',
|
|
@@ -228,19 +215,20 @@ describe('components', function () {
|
|
|
228
215
|
label: 'Do action'
|
|
229
216
|
}
|
|
230
217
|
}];
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
218
|
+
const {
|
|
219
|
+
container
|
|
220
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
221
|
+
"data-testid": ID,
|
|
222
|
+
rows: ROWS,
|
|
223
|
+
noChangeAction: true
|
|
224
|
+
}));
|
|
225
|
+
const summaryList = checkSummaryList(container, ID);
|
|
238
226
|
expect(summaryList.childNodes.length).toEqual(0);
|
|
239
227
|
});
|
|
240
|
-
it('should handle rows with no actions and component values',
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
228
|
+
it('should handle rows with no actions and component values', () => {
|
|
229
|
+
const ID = 'test-id';
|
|
230
|
+
const VALUES = ['Alpha component value', 'Bravo component value'];
|
|
231
|
+
const ROWS = [{
|
|
244
232
|
key: 'a',
|
|
245
233
|
pageId: 'p1',
|
|
246
234
|
fieldId: 'a',
|
|
@@ -251,34 +239,31 @@ describe('components', function () {
|
|
|
251
239
|
fieldId: 'b',
|
|
252
240
|
value: /*#__PURE__*/_react2.default.createElement("div", null, VALUES[1])
|
|
253
241
|
}];
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
242
|
+
const {
|
|
243
|
+
container
|
|
244
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
245
|
+
"data-testid": ID,
|
|
246
|
+
rows: ROWS
|
|
247
|
+
}));
|
|
248
|
+
const summaryList = checkSummaryList(container, ID);
|
|
260
249
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
261
|
-
ROWS.forEach(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
key = _checkRow6[0],
|
|
265
|
-
value = _checkRow6[1],
|
|
266
|
-
actions = _checkRow6[2];
|
|
267
|
-
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
250
|
+
ROWS.forEach((row, index) => {
|
|
251
|
+
const [key, value, actions] = checkRow(summaryList, index);
|
|
252
|
+
expect(key.textContent).toEqual(`${row.key} (optional)`);
|
|
268
253
|
expect(value.childNodes.length).toEqual(1);
|
|
269
|
-
|
|
254
|
+
const valueDiv = value.childNodes[0];
|
|
270
255
|
expect(valueDiv.tagName).toEqual('DIV');
|
|
271
256
|
expect(valueDiv.textContent).toEqual(VALUES[index]);
|
|
272
257
|
expect(actions.childNodes.length).toEqual(0);
|
|
273
258
|
});
|
|
274
259
|
});
|
|
275
|
-
it('should handle rows with actions',
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
260
|
+
it('should handle rows with actions', () => {
|
|
261
|
+
const ID = 'test-id';
|
|
262
|
+
const ON_ACTION_CALLS = [];
|
|
263
|
+
const ON_ACTION = row => {
|
|
279
264
|
ON_ACTION_CALLS.push(row);
|
|
280
265
|
};
|
|
281
|
-
|
|
266
|
+
const ROWS = [{
|
|
282
267
|
key: 'a',
|
|
283
268
|
pageId: 'p1',
|
|
284
269
|
fieldId: 'a',
|
|
@@ -297,32 +282,29 @@ describe('components', function () {
|
|
|
297
282
|
onAction: ON_ACTION
|
|
298
283
|
}
|
|
299
284
|
}];
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
285
|
+
const {
|
|
286
|
+
container
|
|
287
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
288
|
+
"data-testid": ID,
|
|
289
|
+
rows: ROWS
|
|
290
|
+
}));
|
|
291
|
+
const summaryList = checkSummaryList(container, ID);
|
|
306
292
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
307
|
-
ROWS.forEach(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
key = _checkRow8[0],
|
|
311
|
-
value = _checkRow8[1],
|
|
312
|
-
actions = _checkRow8[2];
|
|
313
|
-
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
293
|
+
ROWS.forEach((row, index) => {
|
|
294
|
+
const [key, value, actions] = checkRow(summaryList, index);
|
|
295
|
+
expect(key.textContent).toEqual(`${row.key} (optional)`);
|
|
314
296
|
expect(value.textContent).toEqual(row.value);
|
|
315
|
-
|
|
297
|
+
const a = actions.childNodes[0];
|
|
316
298
|
expect(a.textContent).toEqual(row.action.label);
|
|
317
299
|
_react.fireEvent.click(a, {});
|
|
318
300
|
expect(ON_ACTION_CALLS.length).toEqual(index + 1);
|
|
319
301
|
expect(ON_ACTION_CALLS[index]).toEqual(row);
|
|
320
302
|
});
|
|
321
303
|
});
|
|
322
|
-
it('should handle rows with component values and actions set to hidden',
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
304
|
+
it('should handle rows with component values and actions set to hidden', () => {
|
|
305
|
+
const ID = 'test-id';
|
|
306
|
+
const VALUES = ['Alpha component value', 'Bravo component value'];
|
|
307
|
+
const ROWS = [{
|
|
326
308
|
key: 'a',
|
|
327
309
|
pageId: 'p1',
|
|
328
310
|
fieldId: 'a',
|
|
@@ -333,31 +315,29 @@ describe('components', function () {
|
|
|
333
315
|
fieldId: 'b',
|
|
334
316
|
value: /*#__PURE__*/_react2.default.createElement("div", null, VALUES[1])
|
|
335
317
|
}];
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
318
|
+
const {
|
|
319
|
+
container
|
|
320
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
321
|
+
"data-testid": ID,
|
|
322
|
+
rows: ROWS,
|
|
323
|
+
noChangeAction: true
|
|
324
|
+
}));
|
|
325
|
+
const summaryList = checkSummaryList(container, ID);
|
|
343
326
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
344
|
-
ROWS.forEach(
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
key = _checkRowNoChangeActi2[0],
|
|
348
|
-
value = _checkRowNoChangeActi2[1];
|
|
349
|
-
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
327
|
+
ROWS.forEach((row, index) => {
|
|
328
|
+
const [key, value] = checkRowNoChangeActions(summaryList, index);
|
|
329
|
+
expect(key.textContent).toEqual(`${row.key} (optional)`);
|
|
350
330
|
expect(value.childNodes.length).toEqual(1);
|
|
351
|
-
|
|
331
|
+
const valueDiv = value.childNodes[0];
|
|
352
332
|
expect(valueDiv.tagName).toEqual('DIV');
|
|
353
333
|
expect(valueDiv.textContent).toEqual(VALUES[index]);
|
|
354
334
|
});
|
|
355
335
|
});
|
|
356
|
-
it('should render groups of rows correctly',
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
336
|
+
it('should render groups of rows correctly', () => {
|
|
337
|
+
const ID = 'test-id';
|
|
338
|
+
const VALUES = ['Alpha component value', 'Bravo component value', 'Charlie component value'];
|
|
339
|
+
const ISGROUP = true;
|
|
340
|
+
const ROWS = [{
|
|
361
341
|
key: 'a',
|
|
362
342
|
pageId: 'p1',
|
|
363
343
|
fieldId: 'a',
|
|
@@ -376,22 +356,20 @@ describe('components', function () {
|
|
|
376
356
|
fieldId: 'c',
|
|
377
357
|
value: /*#__PURE__*/_react2.default.createElement("div", null, VALUES[2])
|
|
378
358
|
}];
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
359
|
+
const {
|
|
360
|
+
container
|
|
361
|
+
} = (0, _react.render)(/*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
362
|
+
"data-testid": ID,
|
|
363
|
+
rows: ROWS,
|
|
364
|
+
isGroup: ISGROUP
|
|
365
|
+
}));
|
|
366
|
+
const summaryList = checkSummaryList(container, ID);
|
|
386
367
|
expect(summaryList.childNodes.length).toEqual(ROWS.length + 1);
|
|
387
|
-
ROWS.forEach(
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
key = _checkRow10[0],
|
|
391
|
-
value = _checkRow10[1];
|
|
392
|
-
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
368
|
+
ROWS.forEach((row, index) => {
|
|
369
|
+
const [key, value] = checkRow(summaryList, index);
|
|
370
|
+
expect(key.textContent).toEqual(`${row.key} (optional)`);
|
|
393
371
|
expect(value.childNodes.length).toEqual(1);
|
|
394
|
-
|
|
372
|
+
const valueDiv = value.childNodes[0];
|
|
395
373
|
expect(valueDiv.tagName).toEqual('DIV');
|
|
396
374
|
expect(valueDiv.textContent).toEqual(VALUES[index]);
|
|
397
375
|
});
|
|
@@ -7,15 +7,17 @@ exports.default = void 0;
|
|
|
7
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
// Global imports
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const SummaryListHeadingRow = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
title,
|
|
16
|
+
size,
|
|
17
|
+
classes
|
|
18
|
+
} = _ref;
|
|
17
19
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
18
|
-
className:
|
|
20
|
+
className: `${classes('heading')}`
|
|
19
21
|
}, size === 's' && /*#__PURE__*/_react.default.createElement(_copReactComponents.SmallHeading, null, title), size === 'm' && /*#__PURE__*/_react.default.createElement(_copReactComponents.MediumHeading, null, title));
|
|
20
22
|
};
|
|
21
23
|
SummaryListHeadingRow.propTypes = {
|
|
@@ -26,5 +28,4 @@ SummaryListHeadingRow.propTypes = {
|
|
|
26
28
|
SummaryListHeadingRow.defaultProps = {
|
|
27
29
|
size: 'm'
|
|
28
30
|
};
|
|
29
|
-
var _default = SummaryListHeadingRow;
|
|
30
|
-
exports.default = _default;
|
|
31
|
+
var _default = exports.default = SummaryListHeadingRow;
|
|
@@ -7,20 +7,22 @@ exports.default = void 0;
|
|
|
7
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _RowAction = _interopRequireDefault(require("./RowAction"));
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
// Global imports
|
|
12
12
|
|
|
13
13
|
// Local imports
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
const SummaryListRow = _ref => {
|
|
16
|
+
let {
|
|
17
|
+
row,
|
|
18
|
+
classes,
|
|
19
|
+
showAction
|
|
20
|
+
} = _ref;
|
|
19
21
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
20
22
|
className: classes('row')
|
|
21
23
|
}, /*#__PURE__*/_react.default.createElement("dt", {
|
|
22
24
|
className: classes('key')
|
|
23
|
-
}, row.key, !row.required &&
|
|
25
|
+
}, row.key, !row.required && ` (optional)`), /*#__PURE__*/_react.default.createElement("dd", {
|
|
24
26
|
className: classes('value')
|
|
25
27
|
}, row.value), showAction && /*#__PURE__*/_react.default.createElement("dd", {
|
|
26
28
|
className: classes('actions')
|
|
@@ -46,5 +48,4 @@ SummaryListRow.propTypes = {
|
|
|
46
48
|
SummaryListRow.defaultProps = {
|
|
47
49
|
showAction: false
|
|
48
50
|
};
|
|
49
|
-
var _default = SummaryListRow;
|
|
50
|
-
exports.default = _default;
|
|
51
|
+
var _default = exports.default = SummaryListRow;
|
|
@@ -7,19 +7,20 @@ exports.default = void 0;
|
|
|
7
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
function _interopRequireDefault(
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
// Global imports
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const SummaryListTitleRow = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
title,
|
|
16
|
+
classes
|
|
17
|
+
} = _ref;
|
|
16
18
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
17
|
-
className:
|
|
19
|
+
className: `${classes('row')} ${classes('title')}`
|
|
18
20
|
}, /*#__PURE__*/_react.default.createElement(_copReactComponents.SmallHeading, null, title));
|
|
19
21
|
};
|
|
20
22
|
SummaryListTitleRow.propTypes = {
|
|
21
23
|
title: _propTypes.default.string.isRequired,
|
|
22
24
|
classes: _propTypes.default.func.isRequired
|
|
23
25
|
};
|
|
24
|
-
var _default = SummaryListTitleRow;
|
|
25
|
-
exports.default = _default;
|
|
26
|
+
var _default = exports.default = SummaryListTitleRow;
|
|
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
7
|
+
const getGroupActionAttributes = groupRow => {
|
|
8
8
|
if (groupRow && Object.prototype.hasOwnProperty.call(groupRow, 'action')) {
|
|
9
9
|
if (typeof groupRow.action.onAction === 'function') {
|
|
10
10
|
return {
|
|
11
|
-
onClick:
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
onKeyPress: function onKeyPress(event) {
|
|
11
|
+
onClick: () => groupRow.action.onAction(groupRow),
|
|
12
|
+
onKeyPress: event => {
|
|
15
13
|
if (event.key === 'Enter') {
|
|
16
14
|
groupRow.action.onAction(groupRow);
|
|
17
15
|
}
|
|
@@ -21,11 +19,10 @@ var getGroupActionAttributes = function getGroupActionAttributes(groupRow) {
|
|
|
21
19
|
}
|
|
22
20
|
if (groupRow.action.page) {
|
|
23
21
|
return {
|
|
24
|
-
href:
|
|
22
|
+
href: `/${groupRow.action.page}`
|
|
25
23
|
};
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
return {};
|
|
29
27
|
};
|
|
30
|
-
var _default = getGroupActionAttributes;
|
|
31
|
-
exports.default = _default;
|
|
28
|
+
var _default = exports.default = getGroupActionAttributes;
|