@ukhomeoffice/cop-react-form-renderer 5.14.0 → 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 +65 -106
- package/dist/hooks/useHooks.js +2 -5
- package/dist/hooks/useRefData.js +30 -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
|
@@ -5,12 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _models = require("../../models");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
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; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
13
|
-
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); }
|
|
8
|
+
// Local imports.
|
|
9
|
+
|
|
14
10
|
/**
|
|
15
11
|
* Call a callback on a component and all of its child/nested components.
|
|
16
12
|
* At each stage, the value of the component is set to the returned value
|
|
@@ -24,40 +20,43 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
24
20
|
* null if root is not valid.
|
|
25
21
|
* root if callback is not valid.
|
|
26
22
|
*/
|
|
27
|
-
|
|
28
|
-
var _root$data;
|
|
23
|
+
const applyToComponentTree = (root, callback) => {
|
|
29
24
|
if (!root) {
|
|
30
25
|
return null;
|
|
31
26
|
}
|
|
32
27
|
if (!callback) {
|
|
33
28
|
return root;
|
|
34
29
|
}
|
|
35
|
-
|
|
30
|
+
const result = {
|
|
31
|
+
...root
|
|
32
|
+
};
|
|
36
33
|
switch (root.type) {
|
|
37
34
|
case _models.ComponentTypes.CONTAINER:
|
|
38
|
-
result.components.forEach(
|
|
39
|
-
|
|
35
|
+
result.components.forEach((c, index, containerArray) => {
|
|
36
|
+
const array = containerArray;
|
|
40
37
|
array[index] = applyToComponentTree(c, callback);
|
|
41
38
|
});
|
|
42
39
|
break;
|
|
43
40
|
case _models.ComponentTypes.COLLECTION:
|
|
44
|
-
result.item.forEach(
|
|
45
|
-
|
|
41
|
+
result.item.forEach((c, index, collectionArray) => {
|
|
42
|
+
const array = collectionArray;
|
|
46
43
|
array[index] = applyToComponentTree(c, callback);
|
|
47
44
|
});
|
|
48
45
|
break;
|
|
49
46
|
case _models.ComponentTypes.CHECKBOXES:
|
|
50
47
|
case _models.ComponentTypes.RADIOS:
|
|
51
|
-
if (!
|
|
48
|
+
if (!root.data?.options) {
|
|
52
49
|
break;
|
|
53
50
|
}
|
|
54
|
-
result.data =
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
result.data = {
|
|
52
|
+
...root.data
|
|
53
|
+
};
|
|
54
|
+
result.data.options = root.data.options.map(option => {
|
|
55
|
+
const newOption = {
|
|
56
|
+
...option
|
|
57
|
+
};
|
|
57
58
|
if (option.nested) {
|
|
58
|
-
newOption.nested = option.nested.map(
|
|
59
|
-
return applyToComponentTree(c, callback);
|
|
60
|
-
});
|
|
59
|
+
newOption.nested = option.nested.map(c => applyToComponentTree(c, callback));
|
|
61
60
|
}
|
|
62
61
|
return newOption;
|
|
63
62
|
});
|
|
@@ -67,5 +66,4 @@ var applyToComponentTree = function applyToComponentTree(root, callback) {
|
|
|
67
66
|
}
|
|
68
67
|
return callback(result);
|
|
69
68
|
};
|
|
70
|
-
var _default = applyToComponentTree;
|
|
71
|
-
exports.default = _default;
|
|
69
|
+
var _default = exports.default = applyToComponentTree;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _applyToComponentTree = _interopRequireDefault(require("./applyToComponentTree"));
|
|
4
|
-
function _interopRequireDefault(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
10
|
-
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); }
|
|
11
|
-
describe('utils.Component.applyToComponentTree', function () {
|
|
12
|
-
var SINGLE_COMP = {
|
|
4
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
|
+
// Local imports.
|
|
6
|
+
|
|
7
|
+
describe('utils.Component.applyToComponentTree', () => {
|
|
8
|
+
const SINGLE_COMP = {
|
|
13
9
|
type: 'text',
|
|
14
10
|
label: 'alpha'
|
|
15
11
|
};
|
|
16
|
-
|
|
12
|
+
const CONTAINER = {
|
|
17
13
|
type: 'container',
|
|
18
14
|
label: 'bravo',
|
|
19
15
|
components: [{
|
|
@@ -21,7 +17,7 @@ describe('utils.Component.applyToComponentTree', function () {
|
|
|
21
17
|
label: 'charlie'
|
|
22
18
|
}]
|
|
23
19
|
};
|
|
24
|
-
|
|
20
|
+
const COLLECTION = {
|
|
25
21
|
type: 'collection',
|
|
26
22
|
label: 'delta',
|
|
27
23
|
item: [{
|
|
@@ -29,7 +25,7 @@ describe('utils.Component.applyToComponentTree', function () {
|
|
|
29
25
|
label: 'echo'
|
|
30
26
|
}]
|
|
31
27
|
};
|
|
32
|
-
|
|
28
|
+
const COMP_WITH_NESTED = {
|
|
33
29
|
type: 'radios',
|
|
34
30
|
label: 'foxtrot',
|
|
35
31
|
data: {
|
|
@@ -46,44 +42,43 @@ describe('utils.Component.applyToComponentTree', function () {
|
|
|
46
42
|
}]
|
|
47
43
|
}
|
|
48
44
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
var result = (0, _applyToComponentTree.default)(undefined, CALLBACK);
|
|
45
|
+
const CALLBACK = component => ({
|
|
46
|
+
...component,
|
|
47
|
+
label: component.label.toUpperCase()
|
|
48
|
+
});
|
|
49
|
+
it('should return null when root is undefined', () => {
|
|
50
|
+
const result = (0, _applyToComponentTree.default)(undefined, CALLBACK);
|
|
56
51
|
expect(result).toEqual(null);
|
|
57
52
|
});
|
|
58
|
-
it('should return null when root is null',
|
|
59
|
-
|
|
53
|
+
it('should return null when root is null', () => {
|
|
54
|
+
const result = (0, _applyToComponentTree.default)(null, CALLBACK);
|
|
60
55
|
expect(result).toEqual(null);
|
|
61
56
|
});
|
|
62
|
-
it('should return root when callback is undefined',
|
|
63
|
-
|
|
57
|
+
it('should return root when callback is undefined', () => {
|
|
58
|
+
const result = (0, _applyToComponentTree.default)({
|
|
64
59
|
type: 'text'
|
|
65
60
|
}, undefined);
|
|
66
61
|
expect(result).toEqual({
|
|
67
62
|
type: 'text'
|
|
68
63
|
});
|
|
69
64
|
});
|
|
70
|
-
it('should return root when callback is null',
|
|
71
|
-
|
|
65
|
+
it('should return root when callback is null', () => {
|
|
66
|
+
const result = (0, _applyToComponentTree.default)({
|
|
72
67
|
type: 'text'
|
|
73
68
|
}, null);
|
|
74
69
|
expect(result).toEqual({
|
|
75
70
|
type: 'text'
|
|
76
71
|
});
|
|
77
72
|
});
|
|
78
|
-
it('should correctly call callback on a single component',
|
|
79
|
-
|
|
73
|
+
it('should correctly call callback on a single component', () => {
|
|
74
|
+
const result = (0, _applyToComponentTree.default)(SINGLE_COMP, CALLBACK);
|
|
80
75
|
expect(result).toEqual({
|
|
81
76
|
type: 'text',
|
|
82
77
|
label: 'ALPHA'
|
|
83
78
|
});
|
|
84
79
|
});
|
|
85
|
-
it('should correctly call callback on a container component',
|
|
86
|
-
|
|
80
|
+
it('should correctly call callback on a container component', () => {
|
|
81
|
+
const result = (0, _applyToComponentTree.default)(CONTAINER, CALLBACK);
|
|
87
82
|
expect(result).toEqual({
|
|
88
83
|
type: 'container',
|
|
89
84
|
label: 'BRAVO',
|
|
@@ -93,8 +88,8 @@ describe('utils.Component.applyToComponentTree', function () {
|
|
|
93
88
|
}]
|
|
94
89
|
});
|
|
95
90
|
});
|
|
96
|
-
it('should correctly call callback on a collection component',
|
|
97
|
-
|
|
91
|
+
it('should correctly call callback on a collection component', () => {
|
|
92
|
+
const result = (0, _applyToComponentTree.default)(COLLECTION, CALLBACK);
|
|
98
93
|
expect(result).toEqual({
|
|
99
94
|
type: 'collection',
|
|
100
95
|
label: 'DELTA',
|
|
@@ -104,8 +99,8 @@ describe('utils.Component.applyToComponentTree', function () {
|
|
|
104
99
|
}]
|
|
105
100
|
});
|
|
106
101
|
});
|
|
107
|
-
it('should correctly call callback on a component with nested components',
|
|
108
|
-
|
|
102
|
+
it('should correctly call callback on a component with nested components', () => {
|
|
103
|
+
const result = (0, _applyToComponentTree.default)(COMP_WITH_NESTED, CALLBACK);
|
|
109
104
|
expect(result).toEqual({
|
|
110
105
|
type: 'radios',
|
|
111
106
|
label: 'FOXTROT',
|
|
@@ -4,13 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.JSON_ONLY_PROPERTIES = void 0;
|
|
7
|
-
|
|
8
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
-
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; }
|
|
10
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
|
-
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); }
|
|
12
|
-
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); }
|
|
13
|
-
var JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additionalValidation', 'full_path', 'fullPath', 'formData'];
|
|
7
|
+
const JSON_ONLY_PROPERTIES = exports.JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additionalValidation', 'full_path', 'fullPath', 'formData'];
|
|
14
8
|
|
|
15
9
|
/**
|
|
16
10
|
* This method removes and properties that are entirely specific to the JSON
|
|
@@ -23,14 +17,16 @@ var JSON_ONLY_PROPERTIES = ['source', 'use', 'show_when', 'options', 'additional
|
|
|
23
17
|
* @param {Array} alsoRemove An array of additional properties to remove.
|
|
24
18
|
* @returns A clean(er) JSON object.
|
|
25
19
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return Object.keys(options).reduce(function (obj, key) {
|
|
20
|
+
const cleanAttributes = function (options) {
|
|
21
|
+
let alsoRemove = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
22
|
+
const removeKeys = Array.isArray(alsoRemove) ? [].concat(JSON_ONLY_PROPERTIES, alsoRemove) : JSON_ONLY_PROPERTIES;
|
|
23
|
+
if (options && typeof options === 'object') {
|
|
24
|
+
return Object.keys(options).reduce((obj, key) => {
|
|
32
25
|
if (!removeKeys.includes(key)) {
|
|
33
|
-
return
|
|
26
|
+
return {
|
|
27
|
+
...obj,
|
|
28
|
+
[key]: options[key]
|
|
29
|
+
};
|
|
34
30
|
}
|
|
35
31
|
;
|
|
36
32
|
return obj;
|
|
@@ -38,5 +34,4 @@ var cleanAttributes = function cleanAttributes(options) {
|
|
|
38
34
|
}
|
|
39
35
|
return {};
|
|
40
36
|
};
|
|
41
|
-
var _default = cleanAttributes;
|
|
42
|
-
exports.default = _default;
|
|
37
|
+
var _default = exports.default = cleanAttributes;
|
|
@@ -1,35 +1,34 @@
|
|
|
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 _cleanAttributes = _interopRequireWildcard(require("./cleanAttributes"));
|
|
5
|
-
function _getRequireWildcardCache(
|
|
6
|
-
function _interopRequireWildcard(
|
|
4
|
+
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); }
|
|
5
|
+
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; }
|
|
7
6
|
// Local imports
|
|
8
7
|
|
|
9
|
-
describe('utils',
|
|
10
|
-
describe('Component',
|
|
11
|
-
describe('clean',
|
|
12
|
-
it('should handle null options',
|
|
8
|
+
describe('utils', () => {
|
|
9
|
+
describe('Component', () => {
|
|
10
|
+
describe('clean', () => {
|
|
11
|
+
it('should handle null options', () => {
|
|
13
12
|
expect((0, _cleanAttributes.default)(null)).toEqual({});
|
|
14
13
|
});
|
|
15
|
-
it('should handle undefined options',
|
|
14
|
+
it('should handle undefined options', () => {
|
|
16
15
|
expect((0, _cleanAttributes.default)(undefined)).toEqual({});
|
|
17
16
|
});
|
|
18
|
-
it('should handle empty options',
|
|
17
|
+
it('should handle empty options', () => {
|
|
19
18
|
expect((0, _cleanAttributes.default)({}, null)).toEqual({});
|
|
20
19
|
});
|
|
21
|
-
it('should handle a non-object options',
|
|
20
|
+
it('should handle a non-object options', () => {
|
|
22
21
|
expect((0, _cleanAttributes.default)(23, null)).toEqual({});
|
|
23
22
|
});
|
|
24
|
-
it('should only remove properties specific to JSON',
|
|
25
|
-
|
|
23
|
+
it('should only remove properties specific to JSON', () => {
|
|
24
|
+
const OPTIONS = {
|
|
26
25
|
id: 'bob'
|
|
27
26
|
};
|
|
28
27
|
// Add a bunch of properties we know will need to be removed.
|
|
29
|
-
_cleanAttributes.JSON_ONLY_PROPERTIES.forEach(
|
|
28
|
+
_cleanAttributes.JSON_ONLY_PROPERTIES.forEach(p => {
|
|
30
29
|
OPTIONS[p] = 'value';
|
|
31
30
|
});
|
|
32
|
-
|
|
31
|
+
const RESULT = (0, _cleanAttributes.default)(OPTIONS);
|
|
33
32
|
|
|
34
33
|
// The original options should remain untouched.
|
|
35
34
|
expect(OPTIONS.id).toEqual('bob');
|
|
@@ -41,16 +40,16 @@ describe('utils', function () {
|
|
|
41
40
|
id: 'bob'
|
|
42
41
|
});
|
|
43
42
|
});
|
|
44
|
-
it('should also remove properties specified in the alsoRemove parameter',
|
|
45
|
-
|
|
43
|
+
it('should also remove properties specified in the alsoRemove parameter', () => {
|
|
44
|
+
const OPTIONS = {
|
|
46
45
|
id: 'bob',
|
|
47
46
|
fieldId: 'bobField'
|
|
48
47
|
};
|
|
49
48
|
// Add a bunch of properties we know will need to be removed.
|
|
50
|
-
_cleanAttributes.JSON_ONLY_PROPERTIES.forEach(
|
|
49
|
+
_cleanAttributes.JSON_ONLY_PROPERTIES.forEach(p => {
|
|
51
50
|
OPTIONS[p] = 'value';
|
|
52
51
|
});
|
|
53
|
-
|
|
52
|
+
const RESULT = (0, _cleanAttributes.default)(OPTIONS, ['fieldId']);
|
|
54
53
|
|
|
55
54
|
// The original options should remain untouched.
|
|
56
55
|
expect(OPTIONS.id).toEqual('bob');
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _Data = _interopRequireDefault(require("../Data"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/**
|
|
10
10
|
* Iterates over an array of components and brings any nested
|
|
11
11
|
* components that should be visible into the top level array.
|
|
@@ -32,15 +32,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
32
32
|
* @returns A new array consisting of components interspersed
|
|
33
33
|
* with any visible nested components.
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
components
|
|
38
|
-
var _component$data, _component$data$optio;
|
|
35
|
+
const elevateNestedComponents = (components, data) => {
|
|
36
|
+
let allComponents = [];
|
|
37
|
+
components?.forEach(component => {
|
|
39
38
|
allComponents.push(component);
|
|
40
|
-
|
|
39
|
+
component.data?.options?.forEach(option => {
|
|
41
40
|
// If this option has nested components and is
|
|
42
41
|
// selected, then add its nested components to the array.
|
|
43
|
-
|
|
42
|
+
const sourceData = data?.[component.id] || _Data.default.getSource(data, component.full_path);
|
|
44
43
|
if (Array.isArray(option.nested) && sourceData === option.value) {
|
|
45
44
|
allComponents = allComponents.concat(option.nested);
|
|
46
45
|
}
|
|
@@ -48,5 +47,4 @@ var elevateNestedComponents = function elevateNestedComponents(components, data)
|
|
|
48
47
|
});
|
|
49
48
|
return allComponents;
|
|
50
49
|
};
|
|
51
|
-
var _default = elevateNestedComponents;
|
|
52
|
-
exports.default = _default;
|
|
50
|
+
var _default = exports.default = elevateNestedComponents;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _elevateNestedComponents = _interopRequireDefault(require("./elevateNestedComponents"));
|
|
4
|
-
function _interopRequireDefault(
|
|
5
|
-
describe('utils.Component.elevateNestedComponents',
|
|
6
|
-
it('should return an empty array if components is undefined',
|
|
7
|
-
|
|
4
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
5
|
+
describe('utils.Component.elevateNestedComponents', () => {
|
|
6
|
+
it('should return an empty array if components is undefined', () => {
|
|
7
|
+
const DATA = {
|
|
8
8
|
alpha: 'abc'
|
|
9
9
|
};
|
|
10
10
|
expect((0, _elevateNestedComponents.default)(undefined, DATA)).toEqual([]);
|
|
11
11
|
});
|
|
12
|
-
it('should return an empty array if components is null',
|
|
13
|
-
|
|
12
|
+
it('should return an empty array if components is null', () => {
|
|
13
|
+
const DATA = {
|
|
14
14
|
alpha: 'abc'
|
|
15
15
|
};
|
|
16
16
|
expect((0, _elevateNestedComponents.default)(null, DATA)).toEqual([]);
|
|
17
17
|
});
|
|
18
|
-
it('should return an empty array if components is empty',
|
|
19
|
-
|
|
18
|
+
it('should return an empty array if components is empty', () => {
|
|
19
|
+
const DATA = {
|
|
20
20
|
alpha: 'abc'
|
|
21
21
|
};
|
|
22
22
|
expect((0, _elevateNestedComponents.default)([], DATA)).toEqual([]);
|
|
23
23
|
});
|
|
24
|
-
it('should return the original components if none have nested components',
|
|
25
|
-
|
|
24
|
+
it('should return the original components if none have nested components', () => {
|
|
25
|
+
const COMPONENTS = [{
|
|
26
26
|
id: 'textComp'
|
|
27
27
|
}, {
|
|
28
28
|
id: 'radiosComp',
|
|
@@ -36,13 +36,13 @@ describe('utils.Component.elevateNestedComponents', function () {
|
|
|
36
36
|
}]
|
|
37
37
|
}
|
|
38
38
|
}];
|
|
39
|
-
|
|
39
|
+
const DATA = {
|
|
40
40
|
alpha: 'abc'
|
|
41
41
|
};
|
|
42
42
|
expect((0, _elevateNestedComponents.default)(COMPONENTS, DATA)).toEqual(COMPONENTS);
|
|
43
43
|
});
|
|
44
|
-
it('should return the original components if data is null',
|
|
45
|
-
|
|
44
|
+
it('should return the original components if data is null', () => {
|
|
45
|
+
const COMPONENTS = [{
|
|
46
46
|
id: 'textComp'
|
|
47
47
|
}, {
|
|
48
48
|
id: 'radiosComp',
|
|
@@ -58,8 +58,8 @@ describe('utils.Component.elevateNestedComponents', function () {
|
|
|
58
58
|
}];
|
|
59
59
|
expect((0, _elevateNestedComponents.default)(COMPONENTS, null)).toEqual(COMPONENTS);
|
|
60
60
|
});
|
|
61
|
-
it('should return the original array with elevated nested components when they are visible',
|
|
62
|
-
|
|
61
|
+
it('should return the original array with elevated nested components when they are visible', () => {
|
|
62
|
+
const COMPONENTS = [{
|
|
63
63
|
id: 'textComp'
|
|
64
64
|
}, {
|
|
65
65
|
id: 'radiosComp',
|
|
@@ -78,7 +78,7 @@ describe('utils.Component.elevateNestedComponents', function () {
|
|
|
78
78
|
}]
|
|
79
79
|
}
|
|
80
80
|
}];
|
|
81
|
-
|
|
81
|
+
const DATA = {
|
|
82
82
|
radiosComp: 'yes'
|
|
83
83
|
};
|
|
84
84
|
expect((0, _elevateNestedComponents.default)(COMPONENTS, DATA)).toEqual([].concat(COMPONENTS, [{
|
|
@@ -87,8 +87,8 @@ describe('utils.Component.elevateNestedComponents', function () {
|
|
|
87
87
|
id: 'nestedTwo'
|
|
88
88
|
}]));
|
|
89
89
|
});
|
|
90
|
-
it('should return the original array with elevated nested components when a component has a full_path',
|
|
91
|
-
|
|
90
|
+
it('should return the original array with elevated nested components when a component has a full_path', () => {
|
|
91
|
+
const COMPONENTS = [{
|
|
92
92
|
id: 'textComp'
|
|
93
93
|
}, {
|
|
94
94
|
id: 'radiosComp',
|
|
@@ -108,7 +108,7 @@ describe('utils.Component.elevateNestedComponents', function () {
|
|
|
108
108
|
},
|
|
109
109
|
full_path: 'component.radiosComp'
|
|
110
110
|
}];
|
|
111
|
-
|
|
111
|
+
const DATA = {
|
|
112
112
|
component: {
|
|
113
113
|
radiosComp: 'yes'
|
|
114
114
|
}
|