@ukhomeoffice/cop-react-form-renderer 4.67.0 → 4.68.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/CheckYourAnswers/Answer.js +6 -16
- package/dist/components/CheckYourAnswers/Answer.test.js +104 -129
- package/dist/components/CheckYourAnswers/CheckYourAnswers.js +26 -64
- package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +428 -555
- package/dist/components/CheckYourAnswers/index.js +0 -3
- package/dist/components/CollectionPage/CollectionPage.js +13 -42
- package/dist/components/CollectionPage/CollectionPage.test.js +160 -206
- package/dist/components/CollectionPage/index.js +0 -3
- package/dist/components/FormComponent/Collection.js +35 -79
- package/dist/components/FormComponent/Collection.test.js +340 -391
- package/dist/components/FormComponent/Container.js +10 -31
- package/dist/components/FormComponent/Container.test.js +304 -357
- package/dist/components/FormComponent/FormComponent.js +17 -60
- package/dist/components/FormComponent/FormComponent.test.js +190 -228
- package/dist/components/FormComponent/helpers/addLabel.js +4 -7
- package/dist/components/FormComponent/helpers/getComponentDisabled.js +0 -4
- package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +0 -2
- package/dist/components/FormComponent/helpers/getComponentError.js +0 -6
- package/dist/components/FormComponent/helpers/getComponentError.test.js +0 -2
- package/dist/components/FormComponent/helpers/index.js +0 -4
- package/dist/components/FormComponent/index.js +0 -3
- package/dist/components/FormPage/FormPage.js +21 -53
- package/dist/components/FormPage/FormPage.test.js +122 -160
- package/dist/components/FormPage/index.js +0 -3
- package/dist/components/FormRenderer/FormRenderer.js +106 -296
- package/dist/components/FormRenderer/FormRenderer.test.js +820 -1058
- package/dist/components/FormRenderer/handlers/cyaAction.js +0 -5
- package/dist/components/FormRenderer/handlers/getPageId.js +0 -2
- package/dist/components/FormRenderer/handlers/getPageId.test.js +1 -2
- package/dist/components/FormRenderer/handlers/handlers.test.js +1 -18
- package/dist/components/FormRenderer/handlers/index.js +0 -5
- package/dist/components/FormRenderer/handlers/navigate.js +0 -5
- package/dist/components/FormRenderer/handlers/submissionError.js +0 -2
- package/dist/components/FormRenderer/helpers/canActionProceed.js +0 -3
- package/dist/components/FormRenderer/helpers/canActionProceed.test.js +1 -3
- package/dist/components/FormRenderer/helpers/canCYASubmit.js +0 -2
- package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +1 -5
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +4 -12
- package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +1 -2
- package/dist/components/FormRenderer/helpers/getCYA.js +0 -9
- package/dist/components/FormRenderer/helpers/getCYA.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getFormState.js +0 -5
- package/dist/components/FormRenderer/helpers/getFormState.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getNextPageId.js +0 -25
- package/dist/components/FormRenderer/helpers/getNextPageId.test.js +1 -4
- package/dist/components/FormRenderer/helpers/getPage.js +0 -5
- package/dist/components/FormRenderer/helpers/getPage.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getRelevantPages.js +0 -6
- package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +1 -3
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +0 -10
- package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +4 -7
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +32 -41
- package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +122 -8
- package/dist/components/FormRenderer/helpers/index.js +1 -11
- package/dist/components/FormRenderer/index.js +0 -3
- package/dist/components/FormRenderer/onCYAAction.js +8 -30
- package/dist/components/FormRenderer/onCYAAction.test.js +54 -79
- package/dist/components/FormRenderer/onPageAction.js +123 -0
- package/dist/components/FormRenderer/onPageAction.test.js +632 -0
- package/dist/components/PageActions/ActionButton.js +2 -17
- package/dist/components/PageActions/ActionButton.test.js +58 -81
- package/dist/components/PageActions/PageActions.js +3 -10
- package/dist/components/PageActions/PageActions.test.js +95 -120
- package/dist/components/PageActions/index.js +0 -3
- package/dist/components/SummaryList/GroupAction.js +5 -26
- package/dist/components/SummaryList/GroupAction.test.js +14 -28
- package/dist/components/SummaryList/RowAction.js +5 -25
- package/dist/components/SummaryList/RowAction.test.js +14 -28
- package/dist/components/SummaryList/SummaryList.js +7 -31
- package/dist/components/SummaryList/SummaryList.test.js +69 -126
- package/dist/components/SummaryList/SummaryListHeadingRow.js +3 -8
- package/dist/components/SummaryList/SummaryListRow.js +4 -8
- package/dist/components/SummaryList/SummaryListTitleRow.js +2 -7
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +0 -3
- package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +0 -6
- package/dist/components/SummaryList/helpers/getRowActionAttributes.js +0 -3
- package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +0 -6
- package/dist/components/SummaryList/helpers/index.js +0 -2
- package/dist/components/SummaryList/index.js +0 -3
- package/dist/components/TaskList/Task.js +9 -31
- package/dist/components/TaskList/Task.test.js +32 -59
- package/dist/components/TaskList/TaskList.js +32 -59
- package/dist/components/TaskList/TaskList.test.js +52 -90
- package/dist/components/TaskList/TaskState.js +2 -10
- package/dist/components/TaskList/TaskState.test.js +23 -41
- package/dist/components/TaskList/index.js +0 -3
- package/dist/components/index.js +0 -7
- package/dist/context/HooksContext/HooksContext.js +21 -39
- package/dist/context/HooksContext/HooksContext.test.js +18 -34
- package/dist/context/HooksContext/index.js +0 -5
- package/dist/context/ValidationContext/ValidationContext.js +26 -56
- package/dist/context/ValidationContext/ValidationContext.test.js +43 -64
- package/dist/context/ValidationContext/index.js +0 -5
- package/dist/context/index.js +0 -3
- package/dist/hooks/index.js +0 -9
- package/dist/hooks/useAxios.js +17 -36
- package/dist/hooks/useGetRequest.js +57 -93
- package/dist/hooks/useHooks.js +2 -4
- package/dist/hooks/useRefData.js +14 -41
- package/dist/hooks/useValidation.js +2 -4
- package/dist/index.js +0 -9
- package/dist/models/PageAction.js +4 -4
- package/dist/models/TaskStates.js +4 -4
- package/dist/models/index.js +1 -10
- package/dist/setupTests.js +0 -13
- package/dist/utils/CheckYourAnswers/getCYAAction.js +1 -9
- package/dist/utils/CheckYourAnswers/getCYAAction.test.js +1 -19
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +4 -11
- package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +4 -9
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +4 -9
- package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +4 -8
- package/dist/utils/CheckYourAnswers/getCYARow.js +1 -10
- package/dist/utils/CheckYourAnswers/getCYARow.test.js +8 -23
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +6 -21
- package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +2 -9
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +4 -20
- package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +7 -22
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +4 -32
- package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +4 -34
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +4 -15
- package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +4 -22
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +2 -22
- package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +7 -25
- package/dist/utils/CheckYourAnswers/index.js +1 -3
- package/dist/utils/CheckYourAnswers/showComponentCYA.js +2 -15
- package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +1 -3
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +4 -12
- package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +5 -6
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +0 -6
- package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +1 -2
- package/dist/utils/CollectionPage/index.js +1 -5
- package/dist/utils/CollectionPage/mergeCollectionPages.js +5 -11
- package/dist/utils/CollectionPage/mergeCollectionPages.test.js +1 -2
- package/dist/utils/Component/addShowWhen.js +4 -10
- package/dist/utils/Component/addShowWhen.test.js +1 -2
- package/dist/utils/Component/applyToComponentTree.js +4 -18
- package/dist/utils/Component/applyToComponentTree.test.js +4 -8
- package/dist/utils/Component/cleanAttributes.js +1 -8
- package/dist/utils/Component/cleanAttributes.test.js +15 -16
- package/dist/utils/Component/elevateNestedComponents.js +0 -6
- package/dist/utils/Component/elevateNestedComponents.test.js +0 -2
- package/dist/utils/Component/getComponent.js +7 -86
- package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +6 -10
- package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +33 -51
- package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +8 -35
- package/dist/utils/Component/getComponentTests/getComponent.date.test.js +12 -29
- package/dist/utils/Component/getComponentTests/getComponent.details.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.email.test.js +6 -23
- package/dist/utils/Component/getComponentTests/getComponent.file.test.js +6 -24
- package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +3 -7
- package/dist/utils/Component/getComponentTests/getComponent.html.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +3 -7
- package/dist/utils/Component/getComponentTests/getComponent.list.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +5 -22
- package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +156 -175
- package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +4 -10
- package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +6 -23
- package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +8 -35
- package/dist/utils/Component/getComponentTests/getComponent.select.test.js +6 -23
- package/dist/utils/Component/getComponentTests/getComponent.text.test.js +6 -23
- package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +10 -34
- package/dist/utils/Component/getComponentTests/getComponent.time.test.js +12 -31
- package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +1 -2
- package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +3 -7
- package/dist/utils/Component/getDefaultValue.js +4 -8
- package/dist/utils/Component/getDefaultValue.test.js +0 -3
- package/dist/utils/Component/index.js +0 -10
- package/dist/utils/Component/isEditable.js +1 -4
- package/dist/utils/Component/isEditable.test.js +1 -5
- package/dist/utils/Component/setupContainerComponentsPath.js +4 -9
- package/dist/utils/Component/setupContainerComponentsPath.test.js +0 -3
- package/dist/utils/Component/showComponent.js +1 -8
- package/dist/utils/Component/showComponent.test.js +1 -2
- package/dist/utils/Component/wrapInFormGroup.js +0 -7
- package/dist/utils/Condition/index.js +0 -5
- package/dist/utils/Condition/meetsAllConditions.js +0 -9
- package/dist/utils/Condition/meetsAllConditions.test.js +1 -2
- package/dist/utils/Condition/meetsCondition.js +9 -34
- package/dist/utils/Condition/meetsCondition.test.js +21 -14
- package/dist/utils/Condition/meetsOneCondition.js +1 -9
- package/dist/utils/Condition/meetsOneCondition.test.js +1 -2
- package/dist/utils/Condition/setupConditions.js +4 -13
- package/dist/utils/Condition/setupConditions.test.js +0 -2
- package/dist/utils/Container/getEditableComponents.js +0 -7
- package/dist/utils/Container/getEditableComponents.test.js +1 -12
- package/dist/utils/Container/index.js +0 -5
- package/dist/utils/Container/setupNesting.js +4 -12
- package/dist/utils/Container/setupNesting.test.js +4 -10
- package/dist/utils/Container/showContainer.js +9 -18
- package/dist/utils/Container/showContainer.test.js +1 -2
- package/dist/utils/Data/applyFormula.js +6 -29
- package/dist/utils/Data/applyFormula.test.js +1 -2
- package/dist/utils/Data/getAutocompleteSource.js +1 -5
- package/dist/utils/Data/getAutocompleteSource.test.js +1 -2
- package/dist/utils/Data/getDataPath.js +3 -17
- package/dist/utils/Data/getDataPath.test.js +0 -4
- package/dist/utils/Data/getOptions.js +4 -14
- package/dist/utils/Data/getOptions.test.js +1 -2
- package/dist/utils/Data/getSourceData.js +6 -21
- package/dist/utils/Data/getSourceData.test.js +4 -6
- package/dist/utils/Data/index.js +1 -11
- package/dist/utils/Data/refDataToOptions.js +5 -13
- package/dist/utils/Data/refDataToOptions.test.js +1 -2
- package/dist/utils/Data/setDataItem.js +0 -5
- package/dist/utils/Data/setDataItem.test.js +0 -2
- package/dist/utils/Data/setupFormData.js +6 -25
- package/dist/utils/Data/setupFormData.test.js +8 -11
- package/dist/utils/Data/setupRefDataUrlForComponent.js +4 -15
- package/dist/utils/Data/setupRefDataUrlForComponent.test.js +1 -3
- package/dist/utils/FormPage/applyConditionalProperties.js +4 -11
- package/dist/utils/FormPage/applyConditionalProperties.test.js +4 -6
- package/dist/utils/FormPage/getFormPage.js +4 -16
- package/dist/utils/FormPage/getFormPage.test.js +10 -9
- package/dist/utils/FormPage/getFormPages.js +4 -9
- package/dist/utils/FormPage/getFormPages.test.js +6 -7
- package/dist/utils/FormPage/getPageActions.js +6 -19
- package/dist/utils/FormPage/getPageActions.test.js +1 -3
- package/dist/utils/FormPage/getParagraphFromText.js +0 -3
- package/dist/utils/FormPage/getParagraphFromText.test.js +1 -3
- package/dist/utils/FormPage/index.js +0 -7
- package/dist/utils/FormPage/showFormPage.js +9 -18
- package/dist/utils/FormPage/showFormPage.test.js +0 -2
- package/dist/utils/FormPage/showFormPageCYA.js +0 -5
- package/dist/utils/FormPage/showFormPageCYA.test.js +0 -2
- package/dist/utils/FormPage/useComponent.js +7 -19
- package/dist/utils/FormPage/useComponent.test.js +4 -7
- package/dist/utils/Format/formatData.js +0 -5
- package/dist/utils/Format/formatData.test.js +1 -2
- package/dist/utils/Format/formatDataForComponent.js +1 -6
- package/dist/utils/Format/formatDataForComponent.test.js +28 -47
- package/dist/utils/Format/formatDataForForm.js +4 -9
- package/dist/utils/Format/formatDataForForm.test.js +14 -11
- package/dist/utils/Format/formatDataForPage.js +1 -5
- package/dist/utils/Format/formatDataForPage.test.js +15 -12
- package/dist/utils/Format/index.js +1 -6
- package/dist/utils/Hub/getFormHub.js +0 -8
- package/dist/utils/Hub/getFormHub.test.js +6 -8
- package/dist/utils/Hub/index.js +1 -3
- package/dist/utils/Meta/documents/getDocuments.js +1 -4
- package/dist/utils/Meta/documents/getDocuments.test.js +4 -10
- package/dist/utils/Meta/documents/index.js +1 -5
- package/dist/utils/Meta/documents/setDocumentsForField.js +4 -11
- package/dist/utils/Meta/documents/setDocumentsForField.test.js +4 -16
- package/dist/utils/Meta/index.js +1 -4
- package/dist/utils/Operate/checkValueIsTruthy.js +1 -7
- package/dist/utils/Operate/checkValueIsTruthy.test.js +0 -2
- package/dist/utils/Operate/getFirstOf.js +2 -9
- package/dist/utils/Operate/getFirstOf.test.js +0 -2
- package/dist/utils/Operate/getIndexOfMatchingValueIn.js +7 -21
- package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +6 -2
- package/dist/utils/Operate/index.js +0 -3
- package/dist/utils/Operate/persistValueInFormData.js +1 -8
- package/dist/utils/Operate/persistValueInFormData.test.js +0 -4
- package/dist/utils/Operate/runPageOperations.js +3 -19
- package/dist/utils/Operate/runPageOperations.test.js +4 -6
- package/dist/utils/Operate/setValueInFormData.js +2 -7
- package/dist/utils/Operate/setValueInFormData.test.js +0 -2
- package/dist/utils/Operate/shouldRun.js +1 -14
- package/dist/utils/Operate/shouldRun.test.js +5 -8
- package/dist/utils/Validate/additional/conditionallyRequired.js +0 -3
- package/dist/utils/Validate/additional/conditionallyRequired.test.js +0 -2
- package/dist/utils/Validate/additional/index.js +1 -22
- package/dist/utils/Validate/additional/index.test.js +0 -6
- package/dist/utils/Validate/additional/mustBeAfter.js +3 -8
- package/dist/utils/Validate/additional/mustBeAfter.test.js +0 -4
- package/dist/utils/Validate/additional/mustBeBefore.js +3 -8
- package/dist/utils/Validate/additional/mustBeBefore.test.js +0 -4
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +5 -16
- package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +4 -8
- package/dist/utils/Validate/additional/mustBeGreaterThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeInTheFuture.js +3 -12
- package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +0 -3
- package/dist/utils/Validate/additional/mustBeInThePast.js +5 -13
- package/dist/utils/Validate/additional/mustBeInThePast.test.js +0 -3
- package/dist/utils/Validate/additional/mustBeLessThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeLessThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeLongerThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeLongerThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeNumbersOnly.js +0 -3
- package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +0 -2
- package/dist/utils/Validate/additional/mustBeShorterThan.js +0 -3
- package/dist/utils/Validate/additional/mustBeShorterThan.test.js +0 -2
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +0 -5
- package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +4 -5
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +0 -3
- package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +0 -2
- package/dist/utils/Validate/additional/mustSelectOnlyOne.js +0 -6
- package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +4 -7
- package/dist/utils/Validate/additional/utils.js +10 -26
- package/dist/utils/Validate/index.js +1 -11
- package/dist/utils/Validate/validateCollection.js +4 -10
- package/dist/utils/Validate/validateCollection.test.js +4 -6
- package/dist/utils/Validate/validateComponent.js +2 -39
- package/dist/utils/Validate/validateComponent.test.js +4 -22
- package/dist/utils/Validate/validateContainer.js +4 -14
- package/dist/utils/Validate/validateContainer.test.js +4 -10
- package/dist/utils/Validate/validateDate.js +6 -38
- package/dist/utils/Validate/validateDate.test.js +0 -4
- package/dist/utils/Validate/validateEmail.js +1 -8
- package/dist/utils/Validate/validateEmail.test.js +5 -4
- package/dist/utils/Validate/validateMultifile.js +0 -7
- package/dist/utils/Validate/validateMultifile.test.js +5 -6
- package/dist/utils/Validate/validatePage.js +4 -16
- package/dist/utils/Validate/validatePage.test.js +30 -25
- package/dist/utils/Validate/validateRegex.js +0 -10
- package/dist/utils/Validate/validateRegex.test.js +5 -4
- package/dist/utils/Validate/validateRequired.js +0 -8
- package/dist/utils/Validate/validateRequired.test.js +5 -4
- package/dist/utils/Validate/validateTextArea.js +0 -8
- package/dist/utils/Validate/validateTextArea.test.js +0 -2
- package/dist/utils/Validate/validateTime.js +5 -22
- package/dist/utils/Validate/validateTime.test.js +0 -2
- package/dist/utils/index.js +4 -20
- package/package.json +2 -2
|
@@ -1,31 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
var _react = require("@testing-library/react");
|
|
6
|
-
|
|
7
5
|
var _react2 = _interopRequireDefault(require("react"));
|
|
8
|
-
|
|
9
6
|
var _SummaryList = _interopRequireWildcard(require("./SummaryList"));
|
|
10
|
-
|
|
11
7
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
|
|
13
8
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
|
|
15
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
|
|
17
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
-
|
|
19
11
|
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."); }
|
|
20
|
-
|
|
21
12
|
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); }
|
|
22
|
-
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
26
|
-
|
|
13
|
+
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; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
27
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
-
|
|
29
16
|
describe('components', function () {
|
|
30
17
|
describe('SummaryList', function () {
|
|
31
18
|
var checkSummaryList = function checkSummaryList(container, id) {
|
|
@@ -34,21 +21,17 @@ describe('components', function () {
|
|
|
34
21
|
expect(summaryList.classList).toContain(_SummaryList.DEFAULT_CLASS);
|
|
35
22
|
return summaryList;
|
|
36
23
|
};
|
|
37
|
-
|
|
38
24
|
var checkTitleRow = function checkTitleRow(summaryList, index) {
|
|
39
25
|
var row = summaryList.childNodes[index];
|
|
40
26
|
expect(row.tagName).toEqual('DIV');
|
|
41
27
|
expect(row.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__row"));
|
|
42
28
|
expect(row.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__title"));
|
|
43
|
-
|
|
44
29
|
var _row$childNodes = _slicedToArray(row.childNodes, 1),
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
heading = _row$childNodes[0];
|
|
47
31
|
expect(heading.tagName).toEqual('H3');
|
|
48
32
|
expect(heading.classList).toContain('govuk-heading-s');
|
|
49
33
|
return heading;
|
|
50
34
|
};
|
|
51
|
-
|
|
52
35
|
var checkActionRow = function checkActionRow(summaryList, index) {
|
|
53
36
|
var row = summaryList.childNodes[index];
|
|
54
37
|
expect(row.tagName).toEqual('DIV');
|
|
@@ -56,17 +39,14 @@ describe('components', function () {
|
|
|
56
39
|
var link = row.childNodes[0];
|
|
57
40
|
return link;
|
|
58
41
|
};
|
|
59
|
-
|
|
60
42
|
var checkRow = function checkRow(summaryList, index) {
|
|
61
43
|
var row = summaryList.childNodes[index];
|
|
62
44
|
expect(row.tagName).toEqual('DIV');
|
|
63
45
|
expect(row.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__row"));
|
|
64
|
-
|
|
65
46
|
var _row$childNodes2 = _slicedToArray(row.childNodes, 3),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
47
|
+
key = _row$childNodes2[0],
|
|
48
|
+
value = _row$childNodes2[1],
|
|
49
|
+
actions = _row$childNodes2[2];
|
|
70
50
|
expect(key.tagName).toEqual('DT');
|
|
71
51
|
expect(key.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__key"));
|
|
72
52
|
expect(value.tagName).toEqual('DD');
|
|
@@ -75,16 +55,13 @@ describe('components', function () {
|
|
|
75
55
|
expect(actions.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__actions"));
|
|
76
56
|
return [key, value, actions];
|
|
77
57
|
};
|
|
78
|
-
|
|
79
58
|
var checkRowNoChangeActions = function checkRowNoChangeActions(summaryList, index) {
|
|
80
59
|
var row = summaryList.childNodes[index];
|
|
81
60
|
expect(row.tagName).toEqual('DIV');
|
|
82
61
|
expect(row.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__row"));
|
|
83
|
-
|
|
84
62
|
var _row$childNodes3 = _slicedToArray(row.childNodes, 2),
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
63
|
+
key = _row$childNodes3[0],
|
|
64
|
+
value = _row$childNodes3[1];
|
|
88
65
|
expect(key.tagName).toEqual('DT');
|
|
89
66
|
expect(key.classList).toContain("".concat(_SummaryList.DEFAULT_CLASS, "__key"));
|
|
90
67
|
expect(value.tagName).toEqual('DD');
|
|
@@ -92,17 +69,14 @@ describe('components', function () {
|
|
|
92
69
|
expect(row.childNodes.length).toEqual(2);
|
|
93
70
|
return [key, value];
|
|
94
71
|
};
|
|
95
|
-
|
|
96
72
|
it('should handle an empty rows array', function () {
|
|
97
73
|
var ID = 'test-id';
|
|
98
74
|
var ROWS = [];
|
|
99
|
-
|
|
100
75
|
var _render = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
76
|
+
"data-testid": ID,
|
|
77
|
+
rows: ROWS
|
|
78
|
+
})),
|
|
79
|
+
container = _render.container;
|
|
106
80
|
var summaryList = checkSummaryList(container, ID);
|
|
107
81
|
expect(summaryList.childNodes.length).toEqual(0);
|
|
108
82
|
});
|
|
@@ -119,22 +93,19 @@ describe('components', function () {
|
|
|
119
93
|
key: 'Bravo',
|
|
120
94
|
value: 'Bravo value'
|
|
121
95
|
}];
|
|
122
|
-
|
|
123
96
|
var _render2 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
97
|
+
"data-testid": ID,
|
|
98
|
+
rows: ROWS
|
|
99
|
+
})),
|
|
100
|
+
container = _render2.container;
|
|
129
101
|
var summaryList = checkSummaryList(container, ID);
|
|
130
102
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
131
103
|
ROWS.forEach(function (row, index) {
|
|
132
104
|
var _checkRow = checkRow(summaryList, index),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
105
|
+
_checkRow2 = _slicedToArray(_checkRow, 3),
|
|
106
|
+
key = _checkRow2[0],
|
|
107
|
+
value = _checkRow2[1],
|
|
108
|
+
actions = _checkRow2[2];
|
|
138
109
|
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
139
110
|
expect(value.textContent).toEqual(row.value);
|
|
140
111
|
expect(actions.childNodes.length).toEqual(0);
|
|
@@ -158,33 +129,27 @@ describe('components', function () {
|
|
|
158
129
|
key: 'Bravo',
|
|
159
130
|
value: 'Bravo value'
|
|
160
131
|
}];
|
|
161
|
-
|
|
162
132
|
var _render3 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
133
|
+
"data-testid": ID,
|
|
134
|
+
rows: ROWS
|
|
135
|
+
})),
|
|
136
|
+
container = _render3.container;
|
|
168
137
|
var summaryList = checkSummaryList(container, ID);
|
|
169
138
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
170
|
-
|
|
171
139
|
var assessTitleRow = function assessTitleRow(row, index) {
|
|
172
140
|
var heading = checkTitleRow(summaryList, index);
|
|
173
141
|
expect(heading.textContent).toEqual(row.key);
|
|
174
142
|
};
|
|
175
|
-
|
|
176
143
|
var assessRow = function assessRow(row, index) {
|
|
177
144
|
var _checkRow3 = checkRow(summaryList, index),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
145
|
+
_checkRow4 = _slicedToArray(_checkRow3, 3),
|
|
146
|
+
key = _checkRow4[0],
|
|
147
|
+
value = _checkRow4[1],
|
|
148
|
+
actions = _checkRow4[2];
|
|
183
149
|
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
184
150
|
expect(value.textContent).toEqual(row.value);
|
|
185
151
|
expect(actions.childNodes.length).toEqual(0);
|
|
186
152
|
};
|
|
187
|
-
|
|
188
153
|
ROWS.forEach(function (row, index) {
|
|
189
154
|
if (row.type === 'title') {
|
|
190
155
|
assessTitleRow(row, index);
|
|
@@ -217,21 +182,17 @@ describe('components', function () {
|
|
|
217
182
|
label: 'Do action'
|
|
218
183
|
}
|
|
219
184
|
}];
|
|
220
|
-
|
|
221
185
|
var _render4 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
186
|
+
"data-testid": ID,
|
|
187
|
+
rows: ROWS
|
|
188
|
+
})),
|
|
189
|
+
container = _render4.container;
|
|
227
190
|
var summaryList = checkSummaryList(container, ID);
|
|
228
191
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
229
|
-
|
|
230
192
|
var assessActionRow = function assessActionRow(row, index) {
|
|
231
193
|
var link = checkActionRow(summaryList, index);
|
|
232
194
|
expect(link.textContent).toEqual(row.action.label);
|
|
233
195
|
};
|
|
234
|
-
|
|
235
196
|
ROWS.forEach(function (row, index) {
|
|
236
197
|
assessActionRow(row, index);
|
|
237
198
|
});
|
|
@@ -260,14 +221,12 @@ describe('components', function () {
|
|
|
260
221
|
label: 'Do action'
|
|
261
222
|
}
|
|
262
223
|
}];
|
|
263
|
-
|
|
264
224
|
var _render5 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
225
|
+
"data-testid": ID,
|
|
226
|
+
rows: ROWS,
|
|
227
|
+
noChangeAction: true
|
|
228
|
+
})),
|
|
229
|
+
container = _render5.container;
|
|
271
230
|
var summaryList = checkSummaryList(container, ID);
|
|
272
231
|
expect(summaryList.childNodes.length).toEqual(0);
|
|
273
232
|
});
|
|
@@ -285,22 +244,19 @@ describe('components', function () {
|
|
|
285
244
|
key: 'Bravo',
|
|
286
245
|
value: /*#__PURE__*/_react2.default.createElement("div", null, VALUES[1])
|
|
287
246
|
}];
|
|
288
|
-
|
|
289
247
|
var _render6 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
248
|
+
"data-testid": ID,
|
|
249
|
+
rows: ROWS
|
|
250
|
+
})),
|
|
251
|
+
container = _render6.container;
|
|
295
252
|
var summaryList = checkSummaryList(container, ID);
|
|
296
253
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
297
254
|
ROWS.forEach(function (row, index) {
|
|
298
255
|
var _checkRow5 = checkRow(summaryList, index),
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
256
|
+
_checkRow6 = _slicedToArray(_checkRow5, 3),
|
|
257
|
+
key = _checkRow6[0],
|
|
258
|
+
value = _checkRow6[1],
|
|
259
|
+
actions = _checkRow6[2];
|
|
304
260
|
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
305
261
|
expect(value.childNodes.length).toEqual(1);
|
|
306
262
|
var valueDiv = value.childNodes[0];
|
|
@@ -312,11 +268,9 @@ describe('components', function () {
|
|
|
312
268
|
it('should handle rows with actions', function () {
|
|
313
269
|
var ID = 'test-id';
|
|
314
270
|
var ON_ACTION_CALLS = [];
|
|
315
|
-
|
|
316
271
|
var ON_ACTION = function ON_ACTION(row) {
|
|
317
272
|
ON_ACTION_CALLS.push(row);
|
|
318
273
|
};
|
|
319
|
-
|
|
320
274
|
var ROWS = [{
|
|
321
275
|
pageId: 'p1',
|
|
322
276
|
fieldId: 'a',
|
|
@@ -336,29 +290,24 @@ describe('components', function () {
|
|
|
336
290
|
onAction: ON_ACTION
|
|
337
291
|
}
|
|
338
292
|
}];
|
|
339
|
-
|
|
340
293
|
var _render7 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
294
|
+
"data-testid": ID,
|
|
295
|
+
rows: ROWS
|
|
296
|
+
})),
|
|
297
|
+
container = _render7.container;
|
|
346
298
|
var summaryList = checkSummaryList(container, ID);
|
|
347
299
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
348
300
|
ROWS.forEach(function (row, index) {
|
|
349
301
|
var _checkRow7 = checkRow(summaryList, index),
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
302
|
+
_checkRow8 = _slicedToArray(_checkRow7, 3),
|
|
303
|
+
key = _checkRow8[0],
|
|
304
|
+
value = _checkRow8[1],
|
|
305
|
+
actions = _checkRow8[2];
|
|
355
306
|
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
356
307
|
expect(value.textContent).toEqual(row.value);
|
|
357
308
|
var a = actions.childNodes[0];
|
|
358
309
|
expect(a.textContent).toEqual(row.action.label);
|
|
359
|
-
|
|
360
310
|
_react.fireEvent.click(a, {});
|
|
361
|
-
|
|
362
311
|
expect(ON_ACTION_CALLS.length).toEqual(index + 1);
|
|
363
312
|
expect(ON_ACTION_CALLS[index]).toEqual(row);
|
|
364
313
|
});
|
|
@@ -377,22 +326,19 @@ describe('components', function () {
|
|
|
377
326
|
key: 'Bravo',
|
|
378
327
|
value: /*#__PURE__*/_react2.default.createElement("div", null, VALUES[1])
|
|
379
328
|
}];
|
|
380
|
-
|
|
381
329
|
var _render8 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
330
|
+
"data-testid": ID,
|
|
331
|
+
rows: ROWS,
|
|
332
|
+
noChangeAction: true
|
|
333
|
+
})),
|
|
334
|
+
container = _render8.container;
|
|
388
335
|
var summaryList = checkSummaryList(container, ID);
|
|
389
336
|
expect(summaryList.childNodes.length).toEqual(ROWS.length);
|
|
390
337
|
ROWS.forEach(function (row, index) {
|
|
391
338
|
var _checkRowNoChangeActi = checkRowNoChangeActions(summaryList, index),
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
339
|
+
_checkRowNoChangeActi2 = _slicedToArray(_checkRowNoChangeActi, 2),
|
|
340
|
+
key = _checkRowNoChangeActi2[0],
|
|
341
|
+
value = _checkRowNoChangeActi2[1];
|
|
396
342
|
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
397
343
|
expect(value.childNodes.length).toEqual(1);
|
|
398
344
|
var valueDiv = value.childNodes[0];
|
|
@@ -420,22 +366,19 @@ describe('components', function () {
|
|
|
420
366
|
key: 'Charlie',
|
|
421
367
|
value: /*#__PURE__*/_react2.default.createElement("div", null, VALUES[2])
|
|
422
368
|
}];
|
|
423
|
-
|
|
424
369
|
var _render9 = (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_SummaryList.default, {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
370
|
+
"data-testid": ID,
|
|
371
|
+
rows: ROWS,
|
|
372
|
+
isGroup: ISGROUP
|
|
373
|
+
})),
|
|
374
|
+
container = _render9.container;
|
|
431
375
|
var summaryList = checkSummaryList(container, ID);
|
|
432
376
|
expect(summaryList.childNodes.length).toEqual(ROWS.length + 1);
|
|
433
377
|
ROWS.forEach(function (row, index) {
|
|
434
378
|
var _checkRow9 = checkRow(summaryList, index),
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
379
|
+
_checkRow10 = _slicedToArray(_checkRow9, 2),
|
|
380
|
+
key = _checkRow10[0],
|
|
381
|
+
value = _checkRow10[1];
|
|
439
382
|
expect(key.textContent).toEqual("".concat(row.key, " (optional)"));
|
|
440
383
|
expect(value.childNodes.length).toEqual(1);
|
|
441
384
|
var valueDiv = value.childNodes[0];
|
|
@@ -4,25 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
// Global imports
|
|
12
|
+
|
|
17
13
|
var SummaryListHeadingRow = function SummaryListHeadingRow(_ref) {
|
|
18
14
|
var title = _ref.title,
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
size = _ref.size,
|
|
16
|
+
classes = _ref.classes;
|
|
21
17
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
18
|
className: "".concat(classes('heading'))
|
|
23
19
|
}, size === 's' && /*#__PURE__*/_react.default.createElement(_copReactComponents.SmallHeading, null, title), size === 'm' && /*#__PURE__*/_react.default.createElement(_copReactComponents.MediumHeading, null, title));
|
|
24
20
|
};
|
|
25
|
-
|
|
26
21
|
SummaryListHeadingRow.propTypes = {
|
|
27
22
|
title: _propTypes.default.string.isRequired,
|
|
28
23
|
classes: _propTypes.default.func.isRequired
|
|
@@ -4,21 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
9
|
var _RowAction = _interopRequireDefault(require("./RowAction"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
// Global imports
|
|
12
|
+
|
|
17
13
|
// Local imports
|
|
14
|
+
|
|
18
15
|
var SummaryListRow = function SummaryListRow(_ref) {
|
|
19
16
|
var row = _ref.row,
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
classes = _ref.classes,
|
|
18
|
+
showAction = _ref.showAction;
|
|
22
19
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
23
20
|
className: classes('row')
|
|
24
21
|
}, /*#__PURE__*/_react.default.createElement("dt", {
|
|
@@ -31,7 +28,6 @@ var SummaryListRow = function SummaryListRow(_ref) {
|
|
|
31
28
|
row: row
|
|
32
29
|
})));
|
|
33
30
|
};
|
|
34
|
-
|
|
35
31
|
SummaryListRow.propTypes = {
|
|
36
32
|
row: _propTypes.default.shape({
|
|
37
33
|
key: _propTypes.default.string.isRequired,
|
|
@@ -4,24 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _copReactComponents = require("@ukhomeoffice/cop-react-components");
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
9
|
var _react = _interopRequireDefault(require("react"));
|
|
13
|
-
|
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
11
|
// Global imports
|
|
12
|
+
|
|
17
13
|
var SummaryListTitleRow = function SummaryListTitleRow(_ref) {
|
|
18
14
|
var title = _ref.title,
|
|
19
|
-
|
|
15
|
+
classes = _ref.classes;
|
|
20
16
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
21
17
|
className: "".concat(classes('row'), " ").concat(classes('title'))
|
|
22
18
|
}, /*#__PURE__*/_react.default.createElement(_copReactComponents.SmallHeading, null, title));
|
|
23
19
|
};
|
|
24
|
-
|
|
25
20
|
SummaryListTitleRow.propTypes = {
|
|
26
21
|
title: _propTypes.default.string.isRequired,
|
|
27
22
|
classes: _propTypes.default.func.isRequired
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var getGroupActionAttributes = function getGroupActionAttributes(groupRow) {
|
|
9
8
|
if (groupRow && Object.prototype.hasOwnProperty.call(groupRow, 'action')) {
|
|
10
9
|
if (typeof groupRow.action.onAction === 'function') {
|
|
@@ -25,9 +24,7 @@ var getGroupActionAttributes = function getGroupActionAttributes(groupRow) {
|
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
return {};
|
|
30
28
|
};
|
|
31
|
-
|
|
32
29
|
var _default = getGroupActionAttributes;
|
|
33
30
|
exports.default = _default;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _getGroupActionAttributes = _interopRequireDefault(require("./getGroupActionAttributes"));
|
|
4
|
-
|
|
5
4
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
5
|
describe('components', function () {
|
|
8
6
|
describe('SummaryList', function () {
|
|
9
7
|
describe('helpers', function () {
|
|
@@ -33,11 +31,9 @@ describe('components', function () {
|
|
|
33
31
|
});
|
|
34
32
|
it('should handle a row with an onAction function', function () {
|
|
35
33
|
var ON_ACTION_CALLS = [];
|
|
36
|
-
|
|
37
34
|
var ON_ACTION = function ON_ACTION(row) {
|
|
38
35
|
ON_ACTION_CALLS.push(row);
|
|
39
36
|
};
|
|
40
|
-
|
|
41
37
|
var ROW = {
|
|
42
38
|
action: {
|
|
43
39
|
onAction: ON_ACTION
|
|
@@ -52,11 +48,9 @@ describe('components', function () {
|
|
|
52
48
|
});
|
|
53
49
|
it('should favour onAction over href', function () {
|
|
54
50
|
var ON_ACTION_CALLS = [];
|
|
55
|
-
|
|
56
51
|
var ON_ACTION = function ON_ACTION(row) {
|
|
57
52
|
ON_ACTION_CALLS.push(row);
|
|
58
53
|
};
|
|
59
|
-
|
|
60
54
|
var HREF = 'http://alpha.homeoffice.gov.uk';
|
|
61
55
|
var ROW = {
|
|
62
56
|
action: {
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var getRowActionAttributes = function getRowActionAttributes(row) {
|
|
9
8
|
if (row && row.action) {
|
|
10
9
|
if (typeof row.action.onAction === 'function') {
|
|
@@ -25,9 +24,7 @@ var getRowActionAttributes = function getRowActionAttributes(row) {
|
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
}
|
|
28
|
-
|
|
29
27
|
return {};
|
|
30
28
|
};
|
|
31
|
-
|
|
32
29
|
var _default = getRowActionAttributes;
|
|
33
30
|
exports.default = _default;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _getRowActionAttributes = _interopRequireDefault(require("./getRowActionAttributes"));
|
|
4
|
-
|
|
5
4
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
6
|
-
|
|
7
5
|
describe('components', function () {
|
|
8
6
|
describe('SummaryList', function () {
|
|
9
7
|
describe('helpers', function () {
|
|
@@ -33,11 +31,9 @@ describe('components', function () {
|
|
|
33
31
|
});
|
|
34
32
|
it('should handle a row with an onAction function', function () {
|
|
35
33
|
var ON_ACTION_CALLS = [];
|
|
36
|
-
|
|
37
34
|
var ON_ACTION = function ON_ACTION(row) {
|
|
38
35
|
ON_ACTION_CALLS.push(row);
|
|
39
36
|
};
|
|
40
|
-
|
|
41
37
|
var ROW = {
|
|
42
38
|
action: {
|
|
43
39
|
onAction: ON_ACTION
|
|
@@ -52,11 +48,9 @@ describe('components', function () {
|
|
|
52
48
|
});
|
|
53
49
|
it('should favour onAction over href', function () {
|
|
54
50
|
var ON_ACTION_CALLS = [];
|
|
55
|
-
|
|
56
51
|
var ON_ACTION = function ON_ACTION(row) {
|
|
57
52
|
ON_ACTION_CALLS.push(row);
|
|
58
53
|
};
|
|
59
|
-
|
|
60
54
|
var HREF = 'http://alpha.homeoffice.gov.uk';
|
|
61
55
|
var ROW = {
|
|
62
56
|
action: {
|
|
@@ -9,7 +9,5 @@ Object.defineProperty(exports, "getRowActionAttributes", {
|
|
|
9
9
|
return _getRowActionAttributes.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
var _getRowActionAttributes = _interopRequireDefault(require("./getRowActionAttributes"));
|
|
14
|
-
|
|
15
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -4,10 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _SummaryList = _interopRequireDefault(require("./SummaryList"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
9
|
var _default = _SummaryList.default;
|
|
13
10
|
exports.default = _default;
|