@ukhomeoffice/cop-react-form-renderer 6.7.0-alpha → 6.12.0

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.
Files changed (382) hide show
  1. package/dist/components/CheckYourAnswers/Answer.js +22 -16
  2. package/dist/components/CheckYourAnswers/Answer.test.js +180 -92
  3. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +143 -105
  4. package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +942 -463
  5. package/dist/components/CollectionPage/CollectionPage.js +63 -73
  6. package/dist/components/CollectionPage/CollectionPage.test.js +366 -316
  7. package/dist/components/CollectionSummary/BannerStrip.js +13 -13
  8. package/dist/components/CollectionSummary/BannerStrip.test.js +76 -80
  9. package/dist/components/CollectionSummary/CollectionSummary.js +131 -102
  10. package/dist/components/CollectionSummary/CollectionSummary.scss +5 -0
  11. package/dist/components/CollectionSummary/CollectionSummary.test.js +233 -173
  12. package/dist/components/CollectionSummary/Confirmation.js +12 -14
  13. package/dist/components/CollectionSummary/Confirmation.test.js +63 -68
  14. package/dist/components/CollectionSummary/RenderListView.js +57 -48
  15. package/dist/components/CollectionSummary/RenderListView.scss +1 -1
  16. package/dist/components/CollectionSummary/RenderListView.test.js +77 -78
  17. package/dist/components/CollectionSummary/SummaryCard.js +156 -112
  18. package/dist/components/CollectionSummary/SummaryCard.scss +6 -0
  19. package/dist/components/CollectionSummary/SummaryCard.test.js +1023 -934
  20. package/dist/components/CollectionSummary/SummaryCardDetails.js +138 -94
  21. package/dist/components/CollectionSummary/SummaryCardDetails.scss +15 -4
  22. package/dist/components/CollectionSummary/SummaryCardDetails.test.js +331 -128
  23. package/dist/components/CollectionSummary/SummaryCardValidationContext.js +35 -30
  24. package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +74 -62
  25. package/dist/components/FormComponent/Collection.js +108 -74
  26. package/dist/components/FormComponent/Collection.test.js +1081 -909
  27. package/dist/components/FormComponent/Container.js +39 -40
  28. package/dist/components/FormComponent/Container.test.js +412 -312
  29. package/dist/components/FormComponent/FormComponent.js +73 -70
  30. package/dist/components/FormComponent/FormComponent.test.js +414 -353
  31. package/dist/components/FormComponent/helpers/addLabel.js +7 -4
  32. package/dist/components/FormComponent/helpers/getComponentDisabled.js +1 -1
  33. package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +7 -7
  34. package/dist/components/FormComponent/helpers/getComponentError.js +5 -3
  35. package/dist/components/FormComponent/helpers/getComponentError.test.js +14 -14
  36. package/dist/components/FormComponent/helpers/getComponentFieldSet.js +4 -3
  37. package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +6 -6
  38. package/dist/components/FormComponent/helpers/index.js +4 -4
  39. package/dist/components/FormPage/FormPage.js +93 -66
  40. package/dist/components/FormPage/FormPage.test.js +163 -127
  41. package/dist/components/FormRenderer/FormRenderer.js +180 -143
  42. package/dist/components/FormRenderer/FormRenderer.test.js +1115 -730
  43. package/dist/components/FormRenderer/handlers/cyaAction.js +2 -2
  44. package/dist/components/FormRenderer/handlers/getPageId.js +3 -1
  45. package/dist/components/FormRenderer/handlers/getPageId.test.js +14 -14
  46. package/dist/components/FormRenderer/handlers/handlers.test.js +32 -32
  47. package/dist/components/FormRenderer/handlers/index.js +1 -1
  48. package/dist/components/FormRenderer/handlers/navigate.js +3 -3
  49. package/dist/components/FormRenderer/handlers/submissionError.js +1 -1
  50. package/dist/components/FormRenderer/helpers/canActionProceed.js +1 -1
  51. package/dist/components/FormRenderer/helpers/canActionProceed.test.js +15 -15
  52. package/dist/components/FormRenderer/helpers/canCYASubmit.js +3 -1
  53. package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +20 -16
  54. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +39 -22
  55. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +74 -16
  56. package/dist/components/FormRenderer/helpers/getCYA.js +5 -3
  57. package/dist/components/FormRenderer/helpers/getCYA.test.js +11 -11
  58. package/dist/components/FormRenderer/helpers/getFormState.js +7 -5
  59. package/dist/components/FormRenderer/helpers/getFormState.test.js +10 -10
  60. package/dist/components/FormRenderer/helpers/getNextPageId.js +24 -13
  61. package/dist/components/FormRenderer/helpers/getNextPageId.test.js +67 -67
  62. package/dist/components/FormRenderer/helpers/getPage.js +4 -2
  63. package/dist/components/FormRenderer/helpers/getPage.test.js +11 -11
  64. package/dist/components/FormRenderer/helpers/getRelevantPages.js +9 -7
  65. package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +14 -14
  66. package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +5 -5
  67. package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +97 -103
  68. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +60 -62
  69. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +78 -71
  70. package/dist/components/FormRenderer/helpers/index.js +1 -1
  71. package/dist/components/FormRenderer/onCYAAction.js +51 -59
  72. package/dist/components/FormRenderer/onCYAAction.test.js +152 -164
  73. package/dist/components/FormRenderer/onPageAction.js +44 -44
  74. package/dist/components/FormRenderer/onPageAction.test.js +208 -223
  75. package/dist/components/FormRenderer/onTaskAction.js +13 -9
  76. package/dist/components/FormRenderer/onTaskAction.test.js +88 -93
  77. package/dist/components/PageActions/ActionButton.js +15 -12
  78. package/dist/components/PageActions/ActionButton.test.js +78 -56
  79. package/dist/components/PageActions/PageActions.js +10 -10
  80. package/dist/components/PageActions/PageActions.test.js +115 -86
  81. package/dist/components/SummaryList/GroupAction.js +17 -9
  82. package/dist/components/SummaryList/GroupAction.test.js +33 -37
  83. package/dist/components/SummaryList/RowAction.js +16 -11
  84. package/dist/components/SummaryList/RowAction.test.js +33 -37
  85. package/dist/components/SummaryList/SummaryList.js +34 -21
  86. package/dist/components/SummaryList/SummaryList.scss +15 -0
  87. package/dist/components/SummaryList/SummaryList.test.js +226 -143
  88. package/dist/components/SummaryList/SummaryListHeadingRow.js +4 -6
  89. package/dist/components/SummaryList/SummaryListHeadingRowWithAction.js +53 -0
  90. package/dist/components/SummaryList/SummaryListHeadingRowWithAction.scss +38 -0
  91. package/dist/components/SummaryList/SummaryListRow.js +4 -6
  92. package/dist/components/SummaryList/SummaryListTitleRow.js +3 -5
  93. package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +5 -3
  94. package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +22 -22
  95. package/dist/components/SummaryList/helpers/getRowActionAttributes.js +5 -3
  96. package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +22 -22
  97. package/dist/components/SummaryList/helpers/index.js +1 -1
  98. package/dist/components/TaskList/Task.js +29 -19
  99. package/dist/components/TaskList/Task.test.js +76 -83
  100. package/dist/components/TaskList/TaskList.js +92 -49
  101. package/dist/components/TaskList/TaskList.scss +24 -0
  102. package/dist/components/TaskList/TaskList.test.js +255 -113
  103. package/dist/components/TaskList/TaskState.js +5 -7
  104. package/dist/components/TaskList/TaskState.test.js +45 -52
  105. package/dist/components/index.js +7 -7
  106. package/dist/context/HooksContext/HooksContext.js +80 -57
  107. package/dist/context/HooksContext/HooksContext.test.js +35 -26
  108. package/dist/context/HooksContext/index.js +4 -3
  109. package/dist/context/ValidationContext/ValidationContext.js +94 -43
  110. package/dist/context/ValidationContext/ValidationContext.test.js +68 -56
  111. package/dist/context/ValidationContext/index.js +4 -3
  112. package/dist/context/index.js +2 -2
  113. package/dist/hooks/index.js +10 -9
  114. package/dist/hooks/useAxios.js +40 -14
  115. package/dist/hooks/useGetRequest.js +97 -61
  116. package/dist/hooks/useHooks.js +3 -1
  117. package/dist/hooks/useRefData.js +39 -26
  118. package/dist/hooks/useValidation.js +3 -1
  119. package/dist/index.js +14 -13
  120. package/dist/json/actions.json +17 -0
  121. package/dist/json/actionsNoSave.json +17 -0
  122. package/dist/models/CollectionLabels.js +1 -1
  123. package/dist/models/ComponentTypes.js +25 -25
  124. package/dist/models/EventTypes.js +4 -4
  125. package/dist/models/FormPages.js +4 -4
  126. package/dist/models/FormTypes.js +8 -8
  127. package/dist/models/HubFormats.js +3 -3
  128. package/dist/models/PageAction.js +38 -44
  129. package/dist/models/TaskStates.js +28 -29
  130. package/dist/models/index.js +9 -9
  131. package/dist/setupTests.js +31 -30
  132. package/dist/utils/CheckYourAnswers/getCYAAction.js +5 -5
  133. package/dist/utils/CheckYourAnswers/getCYAAction.test.js +54 -52
  134. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +25 -15
  135. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +35 -33
  136. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +31 -17
  137. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +44 -42
  138. package/dist/utils/CheckYourAnswers/getCYARow.js +6 -6
  139. package/dist/utils/CheckYourAnswers/getCYARow.test.js +86 -86
  140. package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +24 -18
  141. package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +16 -15
  142. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +36 -33
  143. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +61 -58
  144. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +113 -89
  145. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +320 -162
  146. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +20 -25
  147. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +97 -103
  148. package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +18 -13
  149. package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +76 -70
  150. package/dist/utils/CheckYourAnswers/getSummaryListRowForDetails.js +42 -0
  151. package/dist/utils/CheckYourAnswers/getSummaryListRowForDetails.test.js +56 -0
  152. package/dist/utils/CheckYourAnswers/index.js +1 -1
  153. package/dist/utils/CheckYourAnswers/showComponentCYA.js +4 -4
  154. package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +25 -25
  155. package/dist/utils/CollectionPage/addCollectionPageEntry.js +2 -2
  156. package/dist/utils/CollectionPage/addCollectionPageEntry.test.js +5 -5
  157. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +2 -2
  158. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +18 -17
  159. package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +22 -12
  160. package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +38 -47
  161. package/dist/utils/CollectionPage/getCollectionPageActiveId.js +2 -2
  162. package/dist/utils/CollectionPage/getCollectionPageActiveId.test.js +10 -10
  163. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +11 -7
  164. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +22 -22
  165. package/dist/utils/CollectionPage/getCollectionPageData.js +12 -8
  166. package/dist/utils/CollectionPage/getCollectionPageData.test.js +19 -19
  167. package/dist/utils/CollectionPage/getErrorsForCollection.js +24 -24
  168. package/dist/utils/CollectionPage/getErrorsForCollection.test.js +22 -20
  169. package/dist/utils/CollectionPage/getQuickEditPage.js +31 -35
  170. package/dist/utils/CollectionPage/getQuickEditPage.test.js +27 -15
  171. package/dist/utils/CollectionPage/index.js +1 -1
  172. package/dist/utils/CollectionPage/mergeCollectionPages.js +43 -31
  173. package/dist/utils/CollectionPage/mergeCollectionPages.test.js +26 -26
  174. package/dist/utils/CollectionPage/removeCollectionPageEntry.js +6 -4
  175. package/dist/utils/CollectionPage/removeCollectionPageEntry.test.js +10 -10
  176. package/dist/utils/CollectionPage/setCollectionPageData.js +16 -10
  177. package/dist/utils/CollectionPage/setCollectionPageData.test.js +24 -24
  178. package/dist/utils/Component/addShowWhen.js +8 -4
  179. package/dist/utils/Component/addShowWhen.test.js +37 -37
  180. package/dist/utils/Component/applyToComponentTree.js +18 -18
  181. package/dist/utils/Component/applyToComponentTree.test.js +32 -27
  182. package/dist/utils/Component/cleanAttributes.js +13 -10
  183. package/dist/utils/Component/cleanAttributes.test.js +18 -17
  184. package/dist/utils/Component/elevateNestedComponents.js +7 -6
  185. package/dist/utils/Component/elevateNestedComponents.test.js +68 -30
  186. package/dist/utils/Component/getComponent.js +94 -88
  187. package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +17 -18
  188. package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +59 -46
  189. package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +48 -39
  190. package/dist/utils/Component/getComponentTests/getComponent.date.test.js +33 -23
  191. package/dist/utils/Component/getComponentTests/getComponent.details.test.js +18 -20
  192. package/dist/utils/Component/getComponentTests/getComponent.email.test.js +22 -17
  193. package/dist/utils/Component/getComponentTests/getComponent.file.test.js +25 -20
  194. package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +9 -10
  195. package/dist/utils/Component/getComponentTests/getComponent.html.test.js +15 -17
  196. package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +8 -9
  197. package/dist/utils/Component/getComponentTests/getComponent.list.test.js +15 -17
  198. package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +26 -22
  199. package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +175 -155
  200. package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +15 -17
  201. package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +22 -17
  202. package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +72 -57
  203. package/dist/utils/Component/getComponentTests/getComponent.select.test.js +22 -17
  204. package/dist/utils/Component/getComponentTests/getComponent.text.test.js +22 -17
  205. package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +38 -31
  206. package/dist/utils/Component/getComponentTests/getComponent.time.test.js +29 -20
  207. package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +2 -2
  208. package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +8 -9
  209. package/dist/utils/Component/getDefaultValue.js +8 -6
  210. package/dist/utils/Component/getDefaultValue.test.js +12 -12
  211. package/dist/utils/Component/getDefaultValueFromConfig.js +21 -22
  212. package/dist/utils/Component/getDefaultValueFromConfig.test.js +31 -31
  213. package/dist/utils/Component/index.js +1 -1
  214. package/dist/utils/Component/isEditable.js +4 -2
  215. package/dist/utils/Component/isEditable.test.js +15 -14
  216. package/dist/utils/Component/optionIsSelected.js +6 -1
  217. package/dist/utils/Component/optionIsSelected.test.js +35 -9
  218. package/dist/utils/Component/setupContainerComponentsPath.js +29 -27
  219. package/dist/utils/Component/setupContainerComponentsPath.test.js +11 -11
  220. package/dist/utils/Component/showComponent.js +1 -1
  221. package/dist/utils/Component/showComponent.test.js +28 -28
  222. package/dist/utils/Component/wrapInFormGroup.js +2 -2
  223. package/dist/utils/Condition/index.js +1 -1
  224. package/dist/utils/Condition/meetsAllConditions.js +8 -8
  225. package/dist/utils/Condition/meetsAllConditions.test.js +20 -20
  226. package/dist/utils/Condition/meetsCondition.js +25 -16
  227. package/dist/utils/Condition/meetsCondition.test.js +402 -402
  228. package/dist/utils/Condition/meetsOneCondition.js +5 -5
  229. package/dist/utils/Condition/meetsOneCondition.test.js +16 -16
  230. package/dist/utils/Condition/setupConditions.js +18 -13
  231. package/dist/utils/Condition/setupConditions.test.js +7 -7
  232. package/dist/utils/Container/getEditableComponents.js +5 -3
  233. package/dist/utils/Container/getEditableComponents.test.js +45 -43
  234. package/dist/utils/Container/index.js +1 -1
  235. package/dist/utils/Container/setupNesting.js +20 -16
  236. package/dist/utils/Container/setupNesting.test.js +30 -27
  237. package/dist/utils/Container/showContainer.js +7 -3
  238. package/dist/utils/Container/showContainer.test.js +30 -30
  239. package/dist/utils/Data/applyFormula.js +48 -38
  240. package/dist/utils/Data/applyFormula.test.js +20 -20
  241. package/dist/utils/Data/deleteValues.js +22 -0
  242. package/dist/utils/Data/deleteValues.test.js +57 -0
  243. package/dist/utils/Data/getAutocompleteSource.js +26 -18
  244. package/dist/utils/Data/getAutocompleteSource.test.js +100 -85
  245. package/dist/utils/Data/getDataPath.js +28 -18
  246. package/dist/utils/Data/getDataPath.test.js +12 -12
  247. package/dist/utils/Data/getOptions.js +31 -24
  248. package/dist/utils/Data/getOptions.test.js +53 -35
  249. package/dist/utils/Data/getSourceData.js +19 -6
  250. package/dist/utils/Data/getSourceData.test.js +80 -84
  251. package/dist/utils/Data/index.js +3 -1
  252. package/dist/utils/Data/nestInRefdataOptions.js +16 -9
  253. package/dist/utils/Data/nestInRefdataOptions.test.js +16 -16
  254. package/dist/utils/Data/refDataToOptions.js +13 -10
  255. package/dist/utils/Data/refDataToOptions.test.js +19 -19
  256. package/dist/utils/Data/setDataItem.js +8 -7
  257. package/dist/utils/Data/setDataItem.test.js +37 -37
  258. package/dist/utils/Data/setupFormData.js +21 -13
  259. package/dist/utils/Data/setupFormData.test.js +50 -51
  260. package/dist/utils/Data/setupRefDataUrlForComponent.js +26 -20
  261. package/dist/utils/Data/setupRefDataUrlForComponent.test.js +24 -24
  262. package/dist/utils/FormPage/applyConditionalProperties.js +9 -5
  263. package/dist/utils/FormPage/applyConditionalProperties.test.js +18 -15
  264. package/dist/utils/FormPage/getConditionalText.js +3 -3
  265. package/dist/utils/FormPage/getConditionalText.test.js +29 -29
  266. package/dist/utils/FormPage/getFormPage.js +16 -15
  267. package/dist/utils/FormPage/getFormPage.test.js +46 -47
  268. package/dist/utils/FormPage/getFormPages.js +12 -7
  269. package/dist/utils/FormPage/getFormPages.test.js +23 -20
  270. package/dist/utils/FormPage/getPageActions.js +15 -9
  271. package/dist/utils/FormPage/getPageActions.test.js +32 -32
  272. package/dist/utils/FormPage/getParagraphFromText.js +7 -5
  273. package/dist/utils/FormPage/getParagraphFromText.test.js +6 -6
  274. package/dist/utils/FormPage/index.js +4 -2
  275. package/dist/utils/FormPage/showFormPage.js +7 -3
  276. package/dist/utils/FormPage/showFormPage.test.js +32 -32
  277. package/dist/utils/FormPage/showFormPageCYA.js +1 -1
  278. package/dist/utils/FormPage/showFormPageCYA.test.js +8 -8
  279. package/dist/utils/FormPage/useComponent.js +28 -21
  280. package/dist/utils/FormPage/useComponent.test.js +79 -77
  281. package/dist/utils/Format/formatData.js +1 -1
  282. package/dist/utils/Format/formatData.test.js +18 -18
  283. package/dist/utils/Format/formatDataForComponent.js +6 -5
  284. package/dist/utils/Format/formatDataForComponent.test.js +78 -50
  285. package/dist/utils/Format/formatDataForForm.js +8 -6
  286. package/dist/utils/Format/formatDataForForm.test.js +16 -13
  287. package/dist/utils/Format/formatDataForPage.js +5 -4
  288. package/dist/utils/Format/formatDataForPage.test.js +25 -20
  289. package/dist/utils/Format/index.js +1 -1
  290. package/dist/utils/Hub/getFormHub.js +1 -1
  291. package/dist/utils/Hub/getFormHub.test.js +31 -28
  292. package/dist/utils/Hub/index.js +1 -1
  293. package/dist/utils/Meta/constants.js +2 -2
  294. package/dist/utils/Meta/documents/getDocuments.js +1 -1
  295. package/dist/utils/Meta/documents/getDocuments.test.js +16 -24
  296. package/dist/utils/Meta/documents/index.js +1 -1
  297. package/dist/utils/Meta/documents/setDocumentsForField.js +16 -14
  298. package/dist/utils/Meta/documents/setDocumentsForField.test.js +34 -68
  299. package/dist/utils/Meta/index.js +1 -1
  300. package/dist/utils/Operate/checkValueIsTruthy.js +2 -2
  301. package/dist/utils/Operate/checkValueIsTruthy.test.js +16 -16
  302. package/dist/utils/Operate/deleteValueInFormData.js +26 -0
  303. package/dist/utils/Operate/deleteValueInFormData.test.js +60 -0
  304. package/dist/utils/Operate/getFirstOf.js +5 -5
  305. package/dist/utils/Operate/getFirstOf.test.js +31 -31
  306. package/dist/utils/Operate/getIndexOfMatchingValueIn.js +10 -10
  307. package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +52 -46
  308. package/dist/utils/Operate/getLength.js +50 -0
  309. package/dist/utils/Operate/getLength.test.js +89 -0
  310. package/dist/utils/Operate/index.js +1 -1
  311. package/dist/utils/Operate/persistValueInFormData.js +3 -3
  312. package/dist/utils/Operate/persistValueInFormData.test.js +20 -22
  313. package/dist/utils/Operate/runPageOperations.js +11 -7
  314. package/dist/utils/Operate/runPageOperations.test.js +36 -35
  315. package/dist/utils/Operate/setValueInFormData.js +2 -2
  316. package/dist/utils/Operate/setValueInFormData.test.js +16 -16
  317. package/dist/utils/Operate/shouldRun.js +6 -6
  318. package/dist/utils/Operate/shouldRun.test.js +27 -21
  319. package/dist/utils/Validate/additional/conditionallyRequired.js +4 -4
  320. package/dist/utils/Validate/additional/conditionallyRequired.test.js +18 -18
  321. package/dist/utils/Validate/additional/index.js +10 -7
  322. package/dist/utils/Validate/additional/index.test.js +78 -12
  323. package/dist/utils/Validate/additional/mustBeAfter.js +2 -2
  324. package/dist/utils/Validate/additional/mustBeAfter.test.js +40 -40
  325. package/dist/utils/Validate/additional/mustBeBefore.js +2 -2
  326. package/dist/utils/Validate/additional/mustBeBefore.test.js +28 -28
  327. package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +11 -7
  328. package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +41 -37
  329. package/dist/utils/Validate/additional/mustBeGreaterThan.js +2 -2
  330. package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +18 -18
  331. package/dist/utils/Validate/additional/mustBeInTheFuture.js +2 -2
  332. package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +12 -12
  333. package/dist/utils/Validate/additional/mustBeInThePast.js +3 -3
  334. package/dist/utils/Validate/additional/mustBeInThePast.test.js +12 -12
  335. package/dist/utils/Validate/additional/mustBeLessThan.js +2 -2
  336. package/dist/utils/Validate/additional/mustBeLessThan.test.js +17 -17
  337. package/dist/utils/Validate/additional/mustBeLongerThan.js +1 -1
  338. package/dist/utils/Validate/additional/mustBeLongerThan.test.js +16 -16
  339. package/dist/utils/Validate/additional/mustBeNumbersOnly.js +2 -2
  340. package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +20 -20
  341. package/dist/utils/Validate/additional/mustBeOneOf.js +21 -0
  342. package/dist/utils/Validate/additional/mustBeOneOf.test.js +36 -0
  343. package/dist/utils/Validate/additional/mustBeShorterThan.js +1 -1
  344. package/dist/utils/Validate/additional/mustBeShorterThan.test.js +16 -16
  345. package/dist/utils/Validate/additional/mustBeUniqueInCollection.js +4 -4
  346. package/dist/utils/Validate/additional/mustBeUniqueInCollection.test.js +39 -35
  347. package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +2 -2
  348. package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +16 -14
  349. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +1 -1
  350. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +12 -12
  351. package/dist/utils/Validate/additional/mustNotContainSql.js +4 -3
  352. package/dist/utils/Validate/additional/mustNotContainSql.test.js +14 -14
  353. package/dist/utils/Validate/additional/mustSelectOnlyOne.js +2 -2
  354. package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +26 -28
  355. package/dist/utils/Validate/additional/utils.js +22 -9
  356. package/dist/utils/Validate/index.js +1 -1
  357. package/dist/utils/Validate/validateCollection.js +25 -19
  358. package/dist/utils/Validate/validateCollection.test.js +66 -74
  359. package/dist/utils/Validate/validateComponent.js +21 -18
  360. package/dist/utils/Validate/validateComponent.test.js +176 -166
  361. package/dist/utils/Validate/validateContainer.js +20 -15
  362. package/dist/utils/Validate/validateContainer.test.js +52 -58
  363. package/dist/utils/Validate/validateDate.js +21 -15
  364. package/dist/utils/Validate/validateDate.test.js +32 -31
  365. package/dist/utils/Validate/validateEmail.js +8 -6
  366. package/dist/utils/Validate/validateEmail.test.js +25 -25
  367. package/dist/utils/Validate/validateMultifile.js +7 -5
  368. package/dist/utils/Validate/validateMultifile.test.js +18 -17
  369. package/dist/utils/Validate/validatePage.js +22 -19
  370. package/dist/utils/Validate/validatePage.test.js +203 -215
  371. package/dist/utils/Validate/validateRegex.js +5 -3
  372. package/dist/utils/Validate/validateRegex.test.js +14 -14
  373. package/dist/utils/Validate/validateRequired.js +6 -4
  374. package/dist/utils/Validate/validateRequired.test.js +18 -18
  375. package/dist/utils/Validate/validateTextArea.js +6 -4
  376. package/dist/utils/Validate/validateTextArea.test.js +20 -20
  377. package/dist/utils/Validate/validateTime.js +26 -11
  378. package/dist/utils/Validate/validateTime.test.js +62 -16
  379. package/dist/utils/index.js +9 -7
  380. package/package.json +2 -2
  381. package/dist/utils/CheckYourAnswers/getComponentRowForCYA.js +0 -37
  382. package/dist/utils/CheckYourAnswers/getComponentRowForCYA.test.js +0 -41
@@ -2,13 +2,17 @@
2
2
 
3
3
  var _getCYACollectionDeleteAction = _interopRequireDefault(require("./getCYACollectionDeleteAction"));
4
4
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5
- // Local imports
6
-
7
- describe('utils', () => {
8
- describe('CheckYourAnswers', () => {
9
- describe('getCYACollectionDeleteAction', () => {
10
- it('should remove selected item from the form data', () => {
11
- const PAGE = {
5
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ 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; }
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); } // Local imports
11
+ describe('utils', function () {
12
+ describe('CheckYourAnswers', function () {
13
+ describe('getCYACollectionDeleteAction', function () {
14
+ it('should remove selected item from the form data', function () {
15
+ var PAGE = {
12
16
  id: 'pageid',
13
17
  collection: {
14
18
  name: 'collectionName',
@@ -17,13 +21,11 @@ describe('utils', () => {
17
21
  }
18
22
  }
19
23
  };
20
- const ITEM = {
24
+ var ITEM = {
21
25
  id: 2
22
26
  };
23
- const TEST_DATA = {
24
- page: {
25
- ...PAGE
26
- },
27
+ var TEST_DATA = {
28
+ page: _objectSpread({}, PAGE),
27
29
  collectionName: [{
28
30
  id: 1
29
31
  }, {
@@ -32,27 +34,27 @@ describe('utils', () => {
32
34
  id: 3
33
35
  }]
34
36
  };
35
- let data = null;
36
- const ON_ACTION = (_, callback) => {
37
+ var data = null;
38
+ var ON_ACTION = function ON_ACTION(_, callback) {
37
39
  data = callback(TEST_DATA);
38
40
  };
39
- const action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {}, {});
41
+ var action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {}, {});
40
42
  action.action.onAction();
41
43
  expect(data.collectionName.length).toEqual(2);
42
44
  expect(data.collectionName[0].id).toEqual(1);
43
45
  expect(data.collectionName[1].id).toEqual(3);
44
46
  });
45
- it('should remove nested item from the form data', () => {
46
- const PAGE = {
47
+ it('should remove nested item from the form data', function () {
48
+ var PAGE = {
47
49
  id: 'pageid',
48
50
  collection: {
49
51
  name: 'parent.child.grandchild'
50
52
  }
51
53
  };
52
- const ITEM = {
54
+ var ITEM = {
53
55
  id: '001'
54
56
  };
55
- const TEST_DATA = {
57
+ var TEST_DATA = {
56
58
  parentActiveId: '000',
57
59
  childActiveId: '000',
58
60
  grandchildActiveId: '000',
@@ -72,16 +74,16 @@ describe('utils', () => {
72
74
  }]
73
75
  }]
74
76
  };
75
- const ACTIVE_IDS = {
77
+ var ACTIVE_IDS = {
76
78
  parentActiveId: '001',
77
79
  childActiveId: '001',
78
80
  grandchildActiveId: '001'
79
81
  };
80
- let data = null;
81
- const ON_ACTION = (_, callback) => {
82
+ var data = null;
83
+ var ON_ACTION = function ON_ACTION(_, callback) {
82
84
  data = callback(TEST_DATA);
83
85
  };
84
- const action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {}, ACTIVE_IDS);
86
+ var action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {}, ACTIVE_IDS);
85
87
  action.action.onAction();
86
88
  expect(data.parentActiveId).toEqual('001');
87
89
  expect(data.childActiveId).toEqual('001');
@@ -89,17 +91,17 @@ describe('utils', () => {
89
91
  expect(data.parent[1].child[1].grandchild.length).toEqual(1);
90
92
  expect(data.parent[1].child[1].grandchild[0].id).toEqual('000');
91
93
  });
92
- it('should do nothing if activeIds are not provided', () => {
93
- const PAGE = {
94
+ it('should do nothing if activeIds are not provided', function () {
95
+ var PAGE = {
94
96
  id: 'pageid',
95
97
  collection: {
96
98
  name: 'parent.child.grandchild'
97
99
  }
98
100
  };
99
- const ITEM = {
101
+ var ITEM = {
100
102
  id: '001'
101
103
  };
102
- const TEST_DATA = {
104
+ var TEST_DATA = {
103
105
  parentActiveId: '000',
104
106
  childActiveId: '000',
105
107
  grandchildActiveId: '000',
@@ -119,28 +121,28 @@ describe('utils', () => {
119
121
  }]
120
122
  }]
121
123
  };
122
- let data = null;
123
- const ON_ACTION = (_, callback) => {
124
+ var data = null;
125
+ var ON_ACTION = function ON_ACTION(_, callback) {
124
126
  data = callback(TEST_DATA);
125
127
  };
126
- const action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {});
128
+ var action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {});
127
129
  action.action.onAction();
128
130
  expect(data.parentActiveId).toEqual('000');
129
131
  expect(data.childActiveId).toEqual('000');
130
132
  expect(data.grandchildActiveId).toEqual('000');
131
133
  expect(data.parent[1].child[1].grandchild.length).toEqual(2);
132
134
  });
133
- it('should do nothing if the activeIds point to an non-existant entry', () => {
134
- const PAGE = {
135
+ it('should do nothing if the activeIds point to an non-existant entry', function () {
136
+ var PAGE = {
135
137
  id: 'pageid',
136
138
  collection: {
137
139
  name: 'parent.child.grandchild'
138
140
  }
139
141
  };
140
- const ITEM = {
142
+ var ITEM = {
141
143
  id: '001'
142
144
  };
143
- const TEST_DATA = {
145
+ var TEST_DATA = {
144
146
  parentActiveId: '000',
145
147
  childActiveId: '000',
146
148
  grandchildActiveId: '000',
@@ -160,21 +162,21 @@ describe('utils', () => {
160
162
  }]
161
163
  }]
162
164
  };
163
- const ACTIVE_IDS = {
165
+ var ACTIVE_IDS = {
164
166
  parentActiveId: 'wrong',
165
167
  childActiveId: 'bad',
166
168
  grandchildActiveId: 'no'
167
169
  };
168
- let data = null;
169
- const ON_ACTION = (_, callback) => {
170
+ var data = null;
171
+ var ON_ACTION = function ON_ACTION(_, callback) {
170
172
  data = callback(TEST_DATA);
171
173
  };
172
- const action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {}, ACTIVE_IDS);
174
+ var action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, ON_ACTION, 0, {}, ACTIVE_IDS);
173
175
  action.action.onAction();
174
176
  expect(data.parent[1].child[1].grandchild.length).toEqual(2);
175
177
  });
176
- it('should get label to custom value', () => {
177
- const PAGE = {
178
+ it('should get label to custom value', function () {
179
+ var PAGE = {
178
180
  id: 'pageid',
179
181
  collection: {
180
182
  name: 'collectionName',
@@ -183,10 +185,10 @@ describe('utils', () => {
183
185
  }
184
186
  }
185
187
  };
186
- const ITEM = {
188
+ var ITEM = {
187
189
  id: 2
188
190
  };
189
- const action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, () => {}, 0, {
191
+ var action = (0, _getCYACollectionDeleteAction.default)(PAGE, ITEM, function () {}, 0, {
190
192
  label: "customName"
191
193
  }, {});
192
194
  expect(action.action.label).toEqual('customName');
@@ -13,13 +13,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
13
13
 
14
14
  // Local imports
15
15
 
16
- const setNestedValue = (component, page) => {
16
+ var setNestedValue = function setNestedValue(component, page) {
17
17
  var _component$data;
18
- (_component$data = component.data) === null || _component$data === void 0 || (_component$data = _component$data.options) === null || _component$data === void 0 || _component$data.forEach(option => {
18
+ (_component$data = component.data) === null || _component$data === void 0 || (_component$data = _component$data.options) === null || _component$data === void 0 || _component$data.forEach(function (option) {
19
19
  // check if option is selected and has nested component
20
20
  if (Array.isArray(option.nested) && (0, _optionIsSelected.default)(page.formData[component.id], option)) {
21
- option.nested.forEach(paramChild => {
22
- const child = paramChild;
21
+ option.nested.forEach(function (paramChild) {
22
+ var child = paramChild;
23
23
  child.value = page.formData[child.id];
24
24
  });
25
25
  }
@@ -35,9 +35,9 @@ const setNestedValue = (component, page) => {
35
35
  *
36
36
  * @returns A configuration object for a Check your answers row.
37
37
  */
38
- const getCYARow = (page, component, onAction) => {
38
+ var getCYARow = function getCYARow(page, component, onAction) {
39
39
  var _page$cya_link;
40
- let value = '';
40
+ var value = '';
41
41
  if (page.formData && component.fieldId) {
42
42
  value = page.formData[component.fieldId];
43
43
  setNestedValue(component, page);
@@ -3,27 +3,29 @@
3
3
  var _setupTests = require("../../setupTests");
4
4
  var _getCYARow = _interopRequireDefault(require("./getCYARow"));
5
5
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
6
- // Local imports
7
-
8
- describe('utils', () => {
9
- describe('CheckYourAnswers', () => {
10
- describe('getCYARow', () => {
11
- it('should get an appropriate row for a readonly text component', () => {
12
- const PAGE = {
6
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
7
+ 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; }
8
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
9
+ 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); } // Local imports
10
+ describe('utils', function () {
11
+ describe('CheckYourAnswers', function () {
12
+ describe('getCYARow', function () {
13
+ it('should get an appropriate row for a readonly text component', function () {
14
+ var PAGE = {
13
15
  id: 'page',
14
16
  formData: {
15
17
  a: 'Bravo'
16
18
  }
17
19
  };
18
- const COMPONENT = {
20
+ var COMPONENT = {
19
21
  type: 'text',
20
22
  readonly: true,
21
23
  id: 'a',
22
24
  fieldId: 'a',
23
25
  label: 'Alpha'
24
26
  };
25
- const ON_ACTION = () => {};
26
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
27
+ var ON_ACTION = function ON_ACTION() {};
28
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
27
29
  (0, _setupTests.expectObjectLike)(ROW, {
28
30
  pageId: PAGE.id,
29
31
  fieldId: COMPONENT.fieldId,
@@ -33,19 +35,19 @@ describe('utils', () => {
33
35
  action: null
34
36
  });
35
37
  });
36
- it('should get an appropriate row for a readonly text component with no value', () => {
37
- const PAGE = {
38
+ it('should get an appropriate row for a readonly text component with no value', function () {
39
+ var PAGE = {
38
40
  id: 'page',
39
41
  formData: {}
40
42
  };
41
- const COMPONENT = {
43
+ var COMPONENT = {
42
44
  type: 'text',
43
45
  readonly: true,
44
46
  id: 'a',
45
47
  fieldId: 'a',
46
48
  label: 'Alpha'
47
49
  };
48
- const ON_ACTION = () => {};
50
+ var ON_ACTION = function ON_ACTION() {};
49
51
  expect((0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION)).toEqual({
50
52
  pageId: PAGE.id,
51
53
  id: COMPONENT.id,
@@ -56,21 +58,21 @@ describe('utils', () => {
56
58
  action: null
57
59
  });
58
60
  });
59
- it('should get an appropriate row for a readonly non-editable component', () => {
60
- const PAGE = {
61
+ it('should get an appropriate row for a readonly non-editable component', function () {
62
+ var PAGE = {
61
63
  id: 'page',
62
64
  formData: {
63
65
  a: 'BLAH'
64
66
  }
65
67
  };
66
- const COMPONENT = {
68
+ var COMPONENT = {
67
69
  type: 'blah',
68
70
  readonly: true,
69
71
  id: 'a',
70
72
  fieldId: 'a',
71
73
  label: 'Alpha'
72
74
  };
73
- const ON_ACTION = () => {};
75
+ var ON_ACTION = function ON_ACTION() {};
74
76
  expect((0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION)).toEqual({
75
77
  pageId: PAGE.id,
76
78
  id: COMPONENT.id,
@@ -80,22 +82,22 @@ describe('utils', () => {
80
82
  action: null
81
83
  });
82
84
  });
83
- it('should use the cya_label where there is no label', () => {
84
- const PAGE = {
85
+ it('should use the cya_label where there is no label', function () {
86
+ var PAGE = {
85
87
  id: 'page',
86
88
  formData: {
87
89
  a: 'Bravo'
88
90
  }
89
91
  };
90
- const COMPONENT = {
92
+ var COMPONENT = {
91
93
  type: 'text',
92
94
  readonly: true,
93
95
  id: 'a',
94
96
  fieldId: 'a',
95
97
  cya_label: 'CYA Alpha'
96
98
  };
97
- const ON_ACTION = () => {};
98
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
99
+ var ON_ACTION = function ON_ACTION() {};
100
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
99
101
  (0, _setupTests.expectObjectLike)(ROW, {
100
102
  pageId: PAGE.id,
101
103
  fieldId: COMPONENT.fieldId,
@@ -105,22 +107,22 @@ describe('utils', () => {
105
107
  value: 'Bravo'
106
108
  });
107
109
  });
108
- it('should get an appropriate row for an editable text component', () => {
109
- const PAGE = {
110
+ it('should get an appropriate row for an editable text component', function () {
111
+ var PAGE = {
110
112
  id: 'page',
111
113
  formData: {
112
114
  a: 'Bravo'
113
115
  },
114
116
  cya_link: {}
115
117
  };
116
- const COMPONENT = {
118
+ var COMPONENT = {
117
119
  type: 'text',
118
120
  id: 'a',
119
121
  fieldId: 'a',
120
122
  label: 'Alpha'
121
123
  };
122
- const ON_ACTION = () => {};
123
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
124
+ var ON_ACTION = function ON_ACTION() {};
125
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
124
126
  (0, _setupTests.expectObjectLike)(ROW, {
125
127
  pageId: PAGE.id,
126
128
  fieldId: COMPONENT.fieldId,
@@ -132,19 +134,18 @@ describe('utils', () => {
132
134
  onAction: ON_ACTION
133
135
  });
134
136
  });
135
- it('should update any nested components in radios with corresponding values from the stored formdata', () => {
136
- const SELECTED_VALUE = 'selectedValue';
137
- const NESTED_ID = 'nestedId';
138
- const NESTED_VALUE = 'nestedValue';
139
- const PAGE = {
137
+ it('should update any nested components in radios with corresponding values from the stored formdata', function () {
138
+ var SELECTED_VALUE = 'selectedValue';
139
+ var NESTED_ID = 'nestedId';
140
+ var NESTED_VALUE = 'nestedValue';
141
+ var PAGE = {
140
142
  id: 'page',
141
- formData: {
142
- a: SELECTED_VALUE,
143
- [NESTED_ID]: NESTED_VALUE
144
- },
143
+ formData: _defineProperty({
144
+ a: SELECTED_VALUE
145
+ }, NESTED_ID, NESTED_VALUE),
145
146
  cya_link: {}
146
147
  };
147
- const COMPONENT = {
148
+ var COMPONENT = {
148
149
  type: 'radios',
149
150
  id: 'a',
150
151
  fieldId: 'a',
@@ -157,17 +158,17 @@ describe('utils', () => {
157
158
  }]
158
159
  }
159
160
  };
160
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, () => {});
161
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, function () {});
161
162
  expect(ROW.component.data.options[0].nested[0].value).toEqual(NESTED_VALUE);
162
163
  });
163
- it('should handle an undefined formData when attempting to set nested values in radios', () => {
164
- const SELECTED_VALUE = 'selectedValue';
165
- const NESTED_ID = 'nestedId';
166
- const PAGE = {
164
+ it('should handle an undefined formData when attempting to set nested values in radios', function () {
165
+ var SELECTED_VALUE = 'selectedValue';
166
+ var NESTED_ID = 'nestedId';
167
+ var PAGE = {
167
168
  id: 'page',
168
169
  cya_link: {}
169
170
  };
170
- const COMPONENT = {
171
+ var COMPONENT = {
171
172
  type: 'radios',
172
173
  id: 'a',
173
174
  fieldId: 'a',
@@ -180,22 +181,21 @@ describe('utils', () => {
180
181
  }]
181
182
  }
182
183
  };
183
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, () => {});
184
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, function () {});
184
185
  expect(ROW.component.data.options[0].nested[0].value).toBeUndefined();
185
186
  });
186
- it('should update any nested components in checkboxes with corresponding values from the stored formdata', () => {
187
- const SELECTED_VALUE = 'selectedValue';
188
- const NESTED_ID = 'nestedId';
189
- const NESTED_VALUE = 'nestedValue';
190
- const PAGE = {
187
+ it('should update any nested components in checkboxes with corresponding values from the stored formdata', function () {
188
+ var SELECTED_VALUE = 'selectedValue';
189
+ var NESTED_ID = 'nestedId';
190
+ var NESTED_VALUE = 'nestedValue';
191
+ var PAGE = {
191
192
  id: 'page',
192
- formData: {
193
- a: [SELECTED_VALUE],
194
- [NESTED_ID]: NESTED_VALUE
195
- },
193
+ formData: _defineProperty({
194
+ a: [SELECTED_VALUE]
195
+ }, NESTED_ID, NESTED_VALUE),
196
196
  cya_link: {}
197
197
  };
198
- const COMPONENT = {
198
+ var COMPONENT = {
199
199
  type: 'checkboxes',
200
200
  id: 'a',
201
201
  fieldId: 'a',
@@ -208,17 +208,17 @@ describe('utils', () => {
208
208
  }]
209
209
  }
210
210
  };
211
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, () => {});
211
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, function () {});
212
212
  expect(ROW.component.data.options[0].nested[0].value).toEqual(NESTED_VALUE);
213
213
  });
214
- it('should handle an undefined formData when attempting to set nested values in checkboxes', () => {
215
- const SELECTED_VALUE = 'selectedValue';
216
- const NESTED_ID = 'nestedId';
217
- const PAGE = {
214
+ it('should handle an undefined formData when attempting to set nested values in checkboxes', function () {
215
+ var SELECTED_VALUE = 'selectedValue';
216
+ var NESTED_ID = 'nestedId';
217
+ var PAGE = {
218
218
  id: 'page',
219
219
  cya_link: {}
220
220
  };
221
- const COMPONENT = {
221
+ var COMPONENT = {
222
222
  type: 'checkboxes',
223
223
  id: 'a',
224
224
  fieldId: 'a',
@@ -231,25 +231,25 @@ describe('utils', () => {
231
231
  }]
232
232
  }
233
233
  };
234
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, () => {});
234
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, function () {});
235
235
  expect(ROW.component.data.options[0].nested[0].value).toBeUndefined();
236
236
  });
237
- it('should get an appropriate row for a readonly text component with no value and interpolated label', () => {
238
- const PAGE = {
237
+ it('should get an appropriate row for a readonly text component with no value and interpolated label', function () {
238
+ var PAGE = {
239
239
  id: 'page',
240
240
  formData: {
241
241
  text: 'Smith'
242
242
  }
243
243
  };
244
244
  // eslint-disable-next-line no-template-curly-in-string
245
- const COMPONENT = {
245
+ var COMPONENT = {
246
246
  type: 'text',
247
247
  readonly: true,
248
248
  id: 'a',
249
249
  fieldId: 'a',
250
250
  label: 'Alpha ${text}'
251
251
  };
252
- const ON_ACTION = () => {};
252
+ var ON_ACTION = function ON_ACTION() {};
253
253
  expect((0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION)).toEqual({
254
254
  pageId: PAGE.id,
255
255
  id: COMPONENT.id,
@@ -260,23 +260,23 @@ describe('utils', () => {
260
260
  action: null
261
261
  });
262
262
  });
263
- it('should use the interolated cya_label where there is no label', () => {
264
- const PAGE = {
263
+ it('should use the interolated cya_label where there is no label', function () {
264
+ var PAGE = {
265
265
  id: 'page',
266
266
  formData: {
267
267
  a: 'Bravo'
268
268
  }
269
269
  };
270
270
  // eslint-disable-next-line no-template-curly-in-string
271
- const COMPONENT = {
271
+ var COMPONENT = {
272
272
  type: 'text',
273
273
  readonly: true,
274
274
  id: 'a',
275
275
  fieldId: 'a',
276
276
  cya_label: 'CYA Alpha ${a}'
277
277
  };
278
- const ON_ACTION = () => {};
279
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
278
+ var ON_ACTION = function ON_ACTION() {};
279
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
280
280
  (0, _setupTests.expectObjectLike)(ROW, {
281
281
  pageId: PAGE.id,
282
282
  fieldId: COMPONENT.fieldId,
@@ -286,14 +286,14 @@ describe('utils', () => {
286
286
  value: 'Bravo'
287
287
  });
288
288
  });
289
- it('should use the cya_label where there is a label', () => {
290
- const PAGE = {
289
+ it('should use the cya_label where there is a label', function () {
290
+ var PAGE = {
291
291
  id: 'page',
292
292
  formData: {
293
293
  a: 'Bravo'
294
294
  }
295
295
  };
296
- const COMPONENT = {
296
+ var COMPONENT = {
297
297
  type: 'text',
298
298
  readonly: true,
299
299
  id: 'a',
@@ -301,8 +301,8 @@ describe('utils', () => {
301
301
  cya_label: 'CYA Alpha',
302
302
  label: 'Alpha'
303
303
  };
304
- const ON_ACTION = () => {};
305
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
304
+ var ON_ACTION = function ON_ACTION() {};
305
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
306
306
  (0, _setupTests.expectObjectLike)(ROW, {
307
307
  pageId: PAGE.id,
308
308
  fieldId: COMPONENT.fieldId,
@@ -312,22 +312,22 @@ describe('utils', () => {
312
312
  value: 'Bravo'
313
313
  });
314
314
  });
315
- it('should use the label where there is no cya_label', () => {
316
- const PAGE = {
315
+ it('should use the label where there is no cya_label', function () {
316
+ var PAGE = {
317
317
  id: 'page',
318
318
  formData: {
319
319
  a: 'Bravo'
320
320
  }
321
321
  };
322
- const COMPONENT = {
322
+ var COMPONENT = {
323
323
  type: 'text',
324
324
  readonly: true,
325
325
  id: 'a',
326
326
  fieldId: 'a',
327
327
  label: 'Alpha'
328
328
  };
329
- const ON_ACTION = () => {};
330
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
329
+ var ON_ACTION = function ON_ACTION() {};
330
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
331
331
  (0, _setupTests.expectObjectLike)(ROW, {
332
332
  pageId: PAGE.id,
333
333
  fieldId: COMPONENT.fieldId,
@@ -337,8 +337,8 @@ describe('utils', () => {
337
337
  value: 'Bravo'
338
338
  });
339
339
  });
340
- it('should not produce an action when the page is configured to have a single change link', () => {
341
- const PAGE = {
340
+ it('should not produce an action when the page is configured to have a single change link', function () {
341
+ var PAGE = {
342
342
  id: 'page',
343
343
  formData: {
344
344
  a: 'Bravo'
@@ -349,15 +349,15 @@ describe('utils', () => {
349
349
  singleChangeLink: true
350
350
  }
351
351
  };
352
- const COMPONENT = {
352
+ var COMPONENT = {
353
353
  type: 'text',
354
354
  readonly: true,
355
355
  id: 'a',
356
356
  fieldId: 'a',
357
357
  label: 'Alpha'
358
358
  };
359
- const ON_ACTION = () => {};
360
- const ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
359
+ var ON_ACTION = function ON_ACTION() {};
360
+ var ROW = (0, _getCYARow.default)(PAGE, COMPONENT, ON_ACTION);
361
361
  (0, _setupTests.expectObjectLike)(ROW, {
362
362
  pageId: PAGE.id,
363
363
  fieldId: COMPONENT.fieldId,