@ukhomeoffice/cop-react-form-renderer 5.14.2 → 5.14.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (328) hide show
  1. package/dist/components/CheckYourAnswers/Answer.js +15 -15
  2. package/dist/components/CheckYourAnswers/Answer.test.js +94 -128
  3. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +99 -129
  4. package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +291 -501
  5. package/dist/components/CheckYourAnswers/index.js +2 -3
  6. package/dist/components/CollectionPage/CollectionPage.js +64 -58
  7. package/dist/components/CollectionPage/CollectionPage.test.js +212 -238
  8. package/dist/components/CollectionPage/index.js +2 -3
  9. package/dist/components/FormComponent/Collection.js +77 -113
  10. package/dist/components/FormComponent/Collection.test.js +688 -787
  11. package/dist/components/FormComponent/Container.js +44 -43
  12. package/dist/components/FormComponent/Container.test.js +316 -346
  13. package/dist/components/FormComponent/FormComponent.js +58 -64
  14. package/dist/components/FormComponent/FormComponent.test.js +180 -219
  15. package/dist/components/FormComponent/helpers/addLabel.js +5 -9
  16. package/dist/components/FormComponent/helpers/getComponentDisabled.js +2 -3
  17. package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +8 -8
  18. package/dist/components/FormComponent/helpers/getComponentError.js +4 -7
  19. package/dist/components/FormComponent/helpers/getComponentError.test.js +15 -15
  20. package/dist/components/FormComponent/helpers/getComponentFieldSet.js +2 -2
  21. package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +7 -7
  22. package/dist/components/FormComponent/helpers/index.js +5 -5
  23. package/dist/components/FormComponent/index.js +2 -3
  24. package/dist/components/FormPage/FormPage.js +65 -79
  25. package/dist/components/FormPage/FormPage.test.js +134 -170
  26. package/dist/components/FormPage/index.js +2 -3
  27. package/dist/components/FormRenderer/FormRenderer.js +151 -193
  28. package/dist/components/FormRenderer/FormRenderer.test.js +598 -920
  29. package/dist/components/FormRenderer/handlers/cyaAction.js +4 -5
  30. package/dist/components/FormRenderer/handlers/getPageId.js +2 -5
  31. package/dist/components/FormRenderer/handlers/getPageId.test.js +15 -15
  32. package/dist/components/FormRenderer/handlers/handlers.test.js +33 -33
  33. package/dist/components/FormRenderer/handlers/index.js +3 -4
  34. package/dist/components/FormRenderer/handlers/navigate.js +5 -6
  35. package/dist/components/FormRenderer/handlers/submissionError.js +2 -3
  36. package/dist/components/FormRenderer/helpers/canActionProceed.js +2 -3
  37. package/dist/components/FormRenderer/helpers/canActionProceed.test.js +10 -10
  38. package/dist/components/FormRenderer/helpers/canCYASubmit.js +2 -5
  39. package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +17 -21
  40. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +19 -27
  41. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +17 -17
  42. package/dist/components/FormRenderer/helpers/getCYA.js +6 -9
  43. package/dist/components/FormRenderer/helpers/getCYA.test.js +12 -12
  44. package/dist/components/FormRenderer/helpers/getFormState.js +7 -10
  45. package/dist/components/FormRenderer/helpers/getFormState.test.js +11 -11
  46. package/dist/components/FormRenderer/helpers/getNextPageId.js +19 -34
  47. package/dist/components/FormRenderer/helpers/getNextPageId.test.js +68 -68
  48. package/dist/components/FormRenderer/helpers/getPage.js +3 -6
  49. package/dist/components/FormRenderer/helpers/getPage.test.js +12 -12
  50. package/dist/components/FormRenderer/helpers/getRelevantPages.js +9 -13
  51. package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +15 -15
  52. package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +12 -13
  53. package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +98 -92
  54. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +66 -66
  55. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +72 -79
  56. package/dist/components/FormRenderer/helpers/index.js +3 -4
  57. package/dist/components/FormRenderer/index.js +2 -3
  58. package/dist/components/FormRenderer/onCYAAction.js +52 -62
  59. package/dist/components/FormRenderer/onCYAAction.test.js +146 -138
  60. package/dist/components/FormRenderer/onPageAction.js +48 -47
  61. package/dist/components/FormRenderer/onPageAction.test.js +219 -205
  62. package/dist/components/FormRenderer/onTaskAction.js +12 -17
  63. package/dist/components/FormRenderer/onTaskAction.test.js +94 -89
  64. package/dist/components/PageActions/ActionButton.js +15 -19
  65. package/dist/components/PageActions/ActionButton.test.js +58 -79
  66. package/dist/components/PageActions/PageActions.js +12 -13
  67. package/dist/components/PageActions/PageActions.test.js +88 -116
  68. package/dist/components/PageActions/index.js +2 -3
  69. package/dist/components/SummaryList/GroupAction.js +15 -23
  70. package/dist/components/SummaryList/GroupAction.test.js +41 -37
  71. package/dist/components/SummaryList/RowAction.js +14 -19
  72. package/dist/components/SummaryList/RowAction.test.js +41 -37
  73. package/dist/components/SummaryList/SummaryList.js +25 -30
  74. package/dist/components/SummaryList/SummaryList.test.js +160 -182
  75. package/dist/components/SummaryList/SummaryListHeadingRow.js +9 -8
  76. package/dist/components/SummaryList/SummaryListRow.js +9 -8
  77. package/dist/components/SummaryList/SummaryListTitleRow.js +8 -7
  78. package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +5 -8
  79. package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +24 -24
  80. package/dist/components/SummaryList/helpers/getRowActionAttributes.js +5 -8
  81. package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +24 -24
  82. package/dist/components/SummaryList/helpers/index.js +2 -2
  83. package/dist/components/SummaryList/index.js +2 -3
  84. package/dist/components/TaskList/Task.js +22 -33
  85. package/dist/components/TaskList/Task.test.js +84 -77
  86. package/dist/components/TaskList/TaskList.js +46 -75
  87. package/dist/components/TaskList/TaskList.test.js +118 -113
  88. package/dist/components/TaskList/TaskState.js +9 -9
  89. package/dist/components/TaskList/TaskState.test.js +56 -49
  90. package/dist/components/TaskList/index.js +2 -3
  91. package/dist/components/index.js +8 -8
  92. package/dist/context/HooksContext/HooksContext.js +59 -85
  93. package/dist/context/HooksContext/HooksContext.test.js +28 -36
  94. package/dist/context/HooksContext/index.js +4 -6
  95. package/dist/context/ValidationContext/ValidationContext.js +35 -76
  96. package/dist/context/ValidationContext/ValidationContext.test.js +50 -61
  97. package/dist/context/ValidationContext/index.js +4 -6
  98. package/dist/context/index.js +3 -3
  99. package/dist/hooks/index.js +10 -11
  100. package/dist/hooks/useAxios.js +17 -43
  101. package/dist/hooks/useGetRequest.js +61 -106
  102. package/dist/hooks/useHooks.js +2 -5
  103. package/dist/hooks/useRefData.js +29 -45
  104. package/dist/hooks/useValidation.js +2 -5
  105. package/dist/index.js +15 -17
  106. package/dist/models/CollectionLabels.js +2 -3
  107. package/dist/models/ComponentTypes.js +25 -26
  108. package/dist/models/EventTypes.js +5 -6
  109. package/dist/models/FormPages.js +5 -6
  110. package/dist/models/FormTypes.js +9 -10
  111. package/dist/models/HubFormats.js +4 -5
  112. package/dist/models/PageAction.js +45 -42
  113. package/dist/models/TaskStates.js +30 -31
  114. package/dist/models/index.js +11 -12
  115. package/dist/setupTests.js +20 -24
  116. package/dist/utils/CheckYourAnswers/getCYAAction.js +6 -7
  117. package/dist/utils/CheckYourAnswers/getCYAAction.test.js +53 -55
  118. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +18 -20
  119. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +21 -23
  120. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +17 -21
  121. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +18 -20
  122. package/dist/utils/CheckYourAnswers/getCYARow.js +8 -10
  123. package/dist/utils/CheckYourAnswers/getCYARow.test.js +72 -72
  124. package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +20 -27
  125. package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +16 -17
  126. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +41 -47
  127. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +72 -75
  128. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +71 -78
  129. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +133 -114
  130. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +27 -23
  131. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +112 -106
  132. package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +16 -23
  133. package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +77 -83
  134. package/dist/utils/CheckYourAnswers/index.js +3 -4
  135. package/dist/utils/CheckYourAnswers/showComponentCYA.js +7 -9
  136. package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +25 -25
  137. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +9 -16
  138. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +19 -20
  139. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +4 -8
  140. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +15 -15
  141. package/dist/utils/CollectionPage/index.js +3 -4
  142. package/dist/utils/CollectionPage/mergeCollectionPages.js +26 -29
  143. package/dist/utils/CollectionPage/mergeCollectionPages.test.js +15 -15
  144. package/dist/utils/Component/addShowWhen.js +5 -10
  145. package/dist/utils/Component/addShowWhen.test.js +38 -38
  146. package/dist/utils/Component/applyToComponentTree.js +20 -22
  147. package/dist/utils/Component/applyToComponentTree.test.js +28 -33
  148. package/dist/utils/Component/cleanAttributes.js +11 -16
  149. package/dist/utils/Component/cleanAttributes.test.js +17 -18
  150. package/dist/utils/Component/elevateNestedComponents.js +7 -9
  151. package/dist/utils/Component/elevateNestedComponents.test.js +19 -19
  152. package/dist/utils/Component/getComponent.js +91 -99
  153. package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +19 -18
  154. package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +51 -63
  155. package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +41 -49
  156. package/dist/utils/Component/getComponentTests/getComponent.date.test.js +33 -37
  157. package/dist/utils/Component/getComponentTests/getComponent.details.test.js +21 -19
  158. package/dist/utils/Component/getComponentTests/getComponent.email.test.js +19 -23
  159. package/dist/utils/Component/getComponentTests/getComponent.file.test.js +23 -27
  160. package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +12 -11
  161. package/dist/utils/Component/getComponentTests/getComponent.html.test.js +18 -16
  162. package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +10 -9
  163. package/dist/utils/Component/getComponentTests/getComponent.list.test.js +18 -16
  164. package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +24 -27
  165. package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +156 -175
  166. package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +18 -16
  167. package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +19 -23
  168. package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +59 -73
  169. package/dist/utils/Component/getComponentTests/getComponent.select.test.js +19 -23
  170. package/dist/utils/Component/getComponentTests/getComponent.text.test.js +19 -23
  171. package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +35 -41
  172. package/dist/utils/Component/getComponentTests/getComponent.time.test.js +24 -32
  173. package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +3 -3
  174. package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +10 -9
  175. package/dist/utils/Component/getDefaultValue.js +7 -9
  176. package/dist/utils/Component/getDefaultValue.test.js +14 -14
  177. package/dist/utils/Component/index.js +3 -4
  178. package/dist/utils/Component/isEditable.js +3 -7
  179. package/dist/utils/Component/isEditable.test.js +14 -15
  180. package/dist/utils/Component/optionIsSelected.js +2 -3
  181. package/dist/utils/Component/optionIsSelected.test.js +10 -10
  182. package/dist/utils/Component/setupContainerComponentsPath.js +30 -33
  183. package/dist/utils/Component/setupContainerComponentsPath.test.js +16 -16
  184. package/dist/utils/Component/showComponent.js +4 -6
  185. package/dist/utils/Component/showComponent.test.js +29 -29
  186. package/dist/utils/Component/wrapInFormGroup.js +6 -6
  187. package/dist/utils/Condition/index.js +3 -4
  188. package/dist/utils/Condition/meetsAllConditions.js +9 -10
  189. package/dist/utils/Condition/meetsAllConditions.test.js +18 -18
  190. package/dist/utils/Condition/meetsCondition.js +19 -27
  191. package/dist/utils/Condition/meetsCondition.test.js +377 -377
  192. package/dist/utils/Condition/meetsOneCondition.js +7 -8
  193. package/dist/utils/Condition/meetsOneCondition.test.js +17 -17
  194. package/dist/utils/Condition/setupConditions.js +15 -21
  195. package/dist/utils/Condition/setupConditions.test.js +8 -8
  196. package/dist/utils/Container/getEditableComponents.js +5 -8
  197. package/dist/utils/Container/getEditableComponents.test.js +44 -46
  198. package/dist/utils/Container/index.js +3 -4
  199. package/dist/utils/Container/setupNesting.js +17 -24
  200. package/dist/utils/Container/setupNesting.test.js +28 -31
  201. package/dist/utils/Container/showContainer.js +5 -10
  202. package/dist/utils/Container/showContainer.test.js +31 -31
  203. package/dist/utils/Data/applyFormula.js +41 -52
  204. package/dist/utils/Data/applyFormula.test.js +26 -26
  205. package/dist/utils/Data/getAutocompleteSource.js +11 -14
  206. package/dist/utils/Data/getAutocompleteSource.test.js +59 -59
  207. package/dist/utils/Data/getDataPath.js +21 -32
  208. package/dist/utils/Data/getDataPath.test.js +20 -20
  209. package/dist/utils/Data/getOptions.js +22 -28
  210. package/dist/utils/Data/getOptions.test.js +21 -21
  211. package/dist/utils/Data/getSourceData.js +7 -21
  212. package/dist/utils/Data/getSourceData.test.js +85 -81
  213. package/dist/utils/Data/index.js +3 -4
  214. package/dist/utils/Data/refDataToOptions.js +12 -17
  215. package/dist/utils/Data/refDataToOptions.test.js +20 -20
  216. package/dist/utils/Data/setDataItem.js +8 -10
  217. package/dist/utils/Data/setDataItem.test.js +38 -38
  218. package/dist/utils/Data/setupFormData.js +32 -48
  219. package/dist/utils/Data/setupFormData.test.js +99 -98
  220. package/dist/utils/Data/setupRefDataUrlForComponent.js +22 -30
  221. package/dist/utils/Data/setupRefDataUrlForComponent.test.js +28 -28
  222. package/dist/utils/FormPage/applyConditionalProperties.js +7 -12
  223. package/dist/utils/FormPage/applyConditionalProperties.test.js +16 -19
  224. package/dist/utils/FormPage/getFormPage.js +17 -19
  225. package/dist/utils/FormPage/getFormPage.test.js +49 -48
  226. package/dist/utils/FormPage/getFormPages.js +9 -15
  227. package/dist/utils/FormPage/getFormPages.test.js +22 -25
  228. package/dist/utils/FormPage/getPageActions.js +11 -19
  229. package/dist/utils/FormPage/getPageActions.test.js +33 -33
  230. package/dist/utils/FormPage/getParagraphFromText.js +6 -9
  231. package/dist/utils/FormPage/getParagraphFromText.test.js +7 -7
  232. package/dist/utils/FormPage/index.js +3 -4
  233. package/dist/utils/FormPage/showFormPage.js +5 -10
  234. package/dist/utils/FormPage/showFormPage.test.js +33 -33
  235. package/dist/utils/FormPage/showFormPageCYA.js +4 -5
  236. package/dist/utils/FormPage/showFormPageCYA.test.js +9 -9
  237. package/dist/utils/FormPage/useComponent.js +21 -29
  238. package/dist/utils/FormPage/useComponent.test.js +71 -73
  239. package/dist/utils/Format/formatData.js +2 -3
  240. package/dist/utils/Format/formatData.test.js +19 -19
  241. package/dist/utils/Format/formatDataForComponent.js +6 -9
  242. package/dist/utils/Format/formatDataForComponent.test.js +50 -78
  243. package/dist/utils/Format/formatDataForForm.js +7 -10
  244. package/dist/utils/Format/formatDataForForm.test.js +14 -17
  245. package/dist/utils/Format/formatDataForPage.js +4 -7
  246. package/dist/utils/Format/formatDataForPage.test.js +20 -25
  247. package/dist/utils/Format/index.js +3 -4
  248. package/dist/utils/Hub/getFormHub.js +3 -4
  249. package/dist/utils/Hub/getFormHub.test.js +29 -32
  250. package/dist/utils/Hub/index.js +3 -4
  251. package/dist/utils/Meta/constants.js +2 -4
  252. package/dist/utils/Meta/documents/getDocuments.js +2 -6
  253. package/dist/utils/Meta/documents/getDocuments.test.js +25 -17
  254. package/dist/utils/Meta/documents/index.js +3 -4
  255. package/dist/utils/Meta/documents/setDocumentsForField.js +16 -19
  256. package/dist/utils/Meta/documents/setDocumentsForField.test.js +69 -35
  257. package/dist/utils/Meta/index.js +3 -4
  258. package/dist/utils/Operate/checkValueIsTruthy.js +5 -6
  259. package/dist/utils/Operate/checkValueIsTruthy.test.js +17 -17
  260. package/dist/utils/Operate/getFirstOf.js +9 -10
  261. package/dist/utils/Operate/getFirstOf.test.js +33 -33
  262. package/dist/utils/Operate/getIndexOfMatchingValueIn.js +13 -14
  263. package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +47 -53
  264. package/dist/utils/Operate/index.js +3 -4
  265. package/dist/utils/Operate/persistValueInFormData.js +7 -8
  266. package/dist/utils/Operate/persistValueInFormData.test.js +23 -21
  267. package/dist/utils/Operate/runPageOperations.js +10 -11
  268. package/dist/utils/Operate/runPageOperations.test.js +36 -37
  269. package/dist/utils/Operate/setValueInFormData.js +6 -7
  270. package/dist/utils/Operate/setValueInFormData.test.js +17 -17
  271. package/dist/utils/Operate/shouldRun.js +9 -10
  272. package/dist/utils/Operate/shouldRun.test.js +22 -28
  273. package/dist/utils/Validate/additional/conditionallyRequired.js +5 -7
  274. package/dist/utils/Validate/additional/conditionallyRequired.test.js +19 -19
  275. package/dist/utils/Validate/additional/index.js +8 -9
  276. package/dist/utils/Validate/additional/index.test.js +13 -13
  277. package/dist/utils/Validate/additional/mustBeAfter.js +4 -5
  278. package/dist/utils/Validate/additional/mustBeAfter.test.js +41 -41
  279. package/dist/utils/Validate/additional/mustBeBefore.js +4 -5
  280. package/dist/utils/Validate/additional/mustBeBefore.test.js +29 -29
  281. package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +8 -14
  282. package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +34 -38
  283. package/dist/utils/Validate/additional/mustBeGreaterThan.js +3 -4
  284. package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +19 -19
  285. package/dist/utils/Validate/additional/mustBeInTheFuture.js +5 -6
  286. package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +13 -13
  287. package/dist/utils/Validate/additional/mustBeInThePast.js +6 -7
  288. package/dist/utils/Validate/additional/mustBeInThePast.test.js +13 -13
  289. package/dist/utils/Validate/additional/mustBeLessThan.js +3 -4
  290. package/dist/utils/Validate/additional/mustBeLessThan.test.js +18 -18
  291. package/dist/utils/Validate/additional/mustBeLongerThan.js +2 -3
  292. package/dist/utils/Validate/additional/mustBeLongerThan.test.js +17 -17
  293. package/dist/utils/Validate/additional/mustBeNumbersOnly.js +3 -4
  294. package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +21 -21
  295. package/dist/utils/Validate/additional/mustBeShorterThan.js +2 -3
  296. package/dist/utils/Validate/additional/mustBeShorterThan.test.js +17 -17
  297. package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +4 -7
  298. package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +15 -17
  299. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +2 -3
  300. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +13 -13
  301. package/dist/utils/Validate/additional/mustSelectOnlyOne.js +4 -7
  302. package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +29 -27
  303. package/dist/utils/Validate/additional/utils.js +9 -25
  304. package/dist/utils/Validate/index.js +3 -4
  305. package/dist/utils/Validate/validateCollection.js +22 -29
  306. package/dist/utils/Validate/validateCollection.test.js +85 -77
  307. package/dist/utils/Validate/validateComponent.js +19 -19
  308. package/dist/utils/Validate/validateComponent.test.js +169 -147
  309. package/dist/utils/Validate/validateContainer.js +16 -22
  310. package/dist/utils/Validate/validateContainer.test.js +52 -48
  311. package/dist/utils/Validate/validateDate.js +14 -21
  312. package/dist/utils/Validate/validateDate.test.js +28 -29
  313. package/dist/utils/Validate/validateEmail.js +8 -11
  314. package/dist/utils/Validate/validateEmail.test.js +26 -26
  315. package/dist/utils/Validate/validateMultifile.js +6 -10
  316. package/dist/utils/Validate/validateMultifile.test.js +17 -18
  317. package/dist/utils/Validate/validatePage.js +20 -22
  318. package/dist/utils/Validate/validatePage.test.js +146 -143
  319. package/dist/utils/Validate/validateRegex.js +6 -10
  320. package/dist/utils/Validate/validateRegex.test.js +17 -17
  321. package/dist/utils/Validate/validateRequired.js +6 -9
  322. package/dist/utils/Validate/validateRequired.test.js +19 -19
  323. package/dist/utils/Validate/validateTextArea.js +6 -9
  324. package/dist/utils/Validate/validateTextArea.test.js +21 -21
  325. package/dist/utils/Validate/validateTime.js +8 -16
  326. package/dist/utils/Validate/validateTime.test.js +15 -15
  327. package/dist/utils/index.js +10 -12
  328. package/package.json +9 -6
@@ -2,14 +2,14 @@
2
2
 
3
3
  var _models = require("../../../models");
4
4
  var _getRelevantPages = _interopRequireDefault(require("./getRelevantPages"));
5
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
5
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
6
6
  // Local imports
7
7
 
8
- describe('components', function () {
9
- describe('FormRenderer', function () {
10
- describe('helpers', function () {
11
- describe('getRelevantPages', function () {
12
- var pages = [{
8
+ describe('components', () => {
9
+ describe('FormRenderer', () => {
10
+ describe('helpers', () => {
11
+ describe('getRelevantPages', () => {
12
+ const pages = [{
13
13
  id: 'page1'
14
14
  }, {
15
15
  id: 'page2'
@@ -20,7 +20,7 @@ describe('components', function () {
20
20
  }, {
21
21
  id: 'page5'
22
22
  }];
23
- var taskListPages = [{
23
+ const taskListPages = [{
24
24
  id: 'taskPage1'
25
25
  }, {
26
26
  id: 'taskPage2'
@@ -31,8 +31,8 @@ describe('components', function () {
31
31
  }, {
32
32
  id: 'taskPage5'
33
33
  }];
34
- it('return all pages from the start of the given list to the current page outside of a task when the page type is partial-cya', function () {
35
- var formState = {
34
+ it('return all pages from the start of the given list to the current page outside of a task when the page type is partial-cya', () => {
35
+ const formState = {
36
36
  page: {
37
37
  type: _models.FormPages.PARTIAL_CYA
38
38
  },
@@ -40,8 +40,8 @@ describe('components', function () {
40
40
  };
41
41
  expect((0, _getRelevantPages.default)(formState, pages, undefined)).toEqual(pages.slice(0, 2));
42
42
  });
43
- it('return all pages from the start of the given list to the current page in a task when the page type is partial-cya', function () {
44
- var formState = {
43
+ it('return all pages from the start of the given list to the current page in a task when the page type is partial-cya', () => {
44
+ const formState = {
45
45
  page: {
46
46
  type: _models.FormPages.PARTIAL_CYA
47
47
  },
@@ -49,15 +49,15 @@ describe('components', function () {
49
49
  };
50
50
  expect((0, _getRelevantPages.default)(formState, pages, taskListPages)).toEqual(taskListPages.slice(0, 3));
51
51
  });
52
- it('return all pages when the page type is not partial-cya', function () {
53
- var formState = {
52
+ it('return all pages when the page type is not partial-cya', () => {
53
+ const formState = {
54
54
  page: {},
55
55
  pageId: 'page2'
56
56
  };
57
57
  expect((0, _getRelevantPages.default)(formState, pages, undefined)).toEqual(pages);
58
58
  });
59
- it('return all task pages when the page type is not partial-cya', function () {
60
- var formState = {
59
+ it('return all task pages when the page type is not partial-cya', () => {
60
+ const formState = {
61
61
  page: {},
62
62
  pageId: 'taskPage2'
63
63
  };
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _models = require("../../../models");
8
8
  var _getNextPageId = _interopRequireDefault(require("./getNextPageId"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- var getSubmissionStatus = function getSubmissionStatus(formType, pages, currentPageId, action, formData, currentTask, isCompleted, sections) {
9
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
+ const getSubmissionStatus = (formType, pages, currentPageId, action, formData, currentTask, isCompleted, sections) => {
11
11
  if (formType === _models.FormTypes.TASK || formType === _models.FormTypes.FORM_WITH_TASK) {
12
- var formStatus = formData.formStatus || {};
12
+ const formStatus = formData.formStatus || {};
13
13
  formStatus.tasks = formStatus.tasks || {};
14
14
  formStatus.tasks[currentTask.name] = formStatus.tasks[currentTask.name] || {};
15
15
  if (currentPageId === (_models.FormPages.CYA || 'submitForm') && isCompleted) {
@@ -20,15 +20,15 @@ var getSubmissionStatus = function getSubmissionStatus(formType, pages, currentP
20
20
  // in this case check whether the page is part of a section defined in the hub sections
21
21
  // if it is, set the section to complete as long as isCompleted == true
22
22
  if (sections) {
23
- sections.forEach(function (section) {
24
- section.tasks.forEach(function (task) {
25
- var lastPage = task.pages[task.pages.length - 1];
26
- if ((lastPage === currentPageId || lastPage.id === currentPageId) && isCompleted && (task === null || task === void 0 ? void 0 : task.type) === 'pre-task-list') {
23
+ sections.forEach(section => {
24
+ section.tasks.forEach(task => {
25
+ const lastPage = task.pages[task.pages.length - 1];
26
+ if ((lastPage === currentPageId || lastPage.id === currentPageId) && isCompleted && task?.type === 'pre-task-list') {
27
27
  formStatus.tasks[task.name] = {
28
28
  complete: isCompleted,
29
29
  currentPage: currentPageId
30
30
  };
31
- } else if (task.pages.includes(currentPageId) && (task === null || task === void 0 ? void 0 : task.type) === 'pre-task-list') {
31
+ } else if (task.pages.includes(currentPageId) && task?.type === 'pre-task-list') {
32
32
  formStatus.tasks[task.name] = {
33
33
  complete: false,
34
34
  currentPage: currentPageId
@@ -37,21 +37,21 @@ var getSubmissionStatus = function getSubmissionStatus(formType, pages, currentP
37
37
  });
38
38
  });
39
39
  }
40
- } else if ((action === null || action === void 0 ? void 0 : action.type) === _models.PageAction.TYPES.SAVE_AND_NAVIGATE) {
40
+ } else if (action?.type === _models.PageAction.TYPES.SAVE_AND_NAVIGATE) {
41
41
  formStatus.tasks[currentTask.name] = {
42
42
  complete: false,
43
43
  currentPage: (0, _getNextPageId.default)(formType, pages, currentPageId, action, formData)
44
44
  };
45
45
  } else {
46
46
  formStatus.tasks[currentTask.name] = {
47
- complete: !!(action !== null && action !== void 0 && action.complete),
47
+ complete: !!action?.complete,
48
48
  currentPage: currentPageId
49
49
  };
50
50
  }
51
51
  formStatus.taskPage = formStatus.tasks[currentTask.name].currentPage;
52
52
  return formStatus;
53
53
  }
54
- if ((action === null || action === void 0 ? void 0 : action.type) === _models.PageAction.TYPES.SAVE_AND_RETURN) {
54
+ if (action?.type === _models.PageAction.TYPES.SAVE_AND_RETURN) {
55
55
  return {
56
56
  page: currentPageId
57
57
  };
@@ -60,5 +60,4 @@ var getSubmissionStatus = function getSubmissionStatus(formType, pages, currentP
60
60
  page: (0, _getNextPageId.default)(formType, pages, currentPageId, action, formData)
61
61
  };
62
62
  };
63
- var _default = getSubmissionStatus;
64
- exports.default = _default;
63
+ var _default = exports.default = getSubmissionStatus;
@@ -3,23 +3,21 @@
3
3
  var _models = require("../../../models");
4
4
  var _PageAction = require("../../../models/PageAction");
5
5
  var _getSubmissionStatus = _interopRequireDefault(require("./getSubmissionStatus"));
6
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
7
- 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); }
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); }
11
- describe('components', function () {
12
- describe('FormRenderer', function () {
13
- describe('helpers', function () {
14
- describe('getSubmissionStatus', function () {
15
- var OPTIONS = [{
6
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
+ // Local imports
8
+
9
+ describe('components', () => {
10
+ describe('FormRenderer', () => {
11
+ describe('helpers', () => {
12
+ describe('getSubmissionStatus', () => {
13
+ const OPTIONS = [{
16
14
  value: 'romeo',
17
15
  label: 'Romeo'
18
16
  }, {
19
17
  value: 'juliet',
20
18
  label: 'Juliet'
21
19
  }];
22
- var RADIOS = {
20
+ const RADIOS = {
23
21
  id: 'radios',
24
22
  fieldId: 'radios',
25
23
  type: _models.ComponentTypes.RADIOS,
@@ -27,29 +25,29 @@ describe('components', function () {
27
25
  options: OPTIONS
28
26
  }
29
27
  };
30
- var TEXT = {
28
+ const TEXT = {
31
29
  id: 'text',
32
30
  fieldId: 'text',
33
31
  type: _models.ComponentTypes.TEXT
34
32
  };
35
- var HTML = {
33
+ const HTML = {
36
34
  type: _models.ComponentTypes.HTML,
37
35
  content: 'HTML'
38
36
  };
39
- var SHOW_WHEN_JULIET = {
37
+ const SHOW_WHEN_JULIET = {
40
38
  field: RADIOS.fieldId,
41
39
  op: '=',
42
40
  value: OPTIONS[1].value
43
41
  };
44
- var SHOW_WHEN_ROMEO = {
42
+ const SHOW_WHEN_ROMEO = {
45
43
  field: RADIOS.fieldId,
46
44
  op: '=',
47
45
  value: OPTIONS[0].value
48
46
  };
49
- var FORM_DATA = {
47
+ const FORM_DATA = {
50
48
  radios: OPTIONS[0].value
51
49
  }; // 'romeo'
52
- var PAGES = [{
50
+ const PAGES = [{
53
51
  id: 'alpha'
54
52
  }, {
55
53
  id: 'bravo'
@@ -68,18 +66,18 @@ describe('components', function () {
68
66
  components: [TEXT],
69
67
  show_when: SHOW_WHEN_ROMEO
70
68
  }];
71
- describe("when the action type is '".concat(_models.PageAction.TYPES.NAVIGATE, "'"), function () {
72
- it('should return undefined if the action has no page property', function () {
73
- var ACTION = {
69
+ describe(`when the action type is '${_models.PageAction.TYPES.NAVIGATE}'`, () => {
70
+ it('should return undefined if the action has no page property', () => {
71
+ const ACTION = {
74
72
  type: _models.PageAction.TYPES.NAVIGATE
75
73
  };
76
74
  expect((0, _getSubmissionStatus.default)(_models.FormTypes.HUB, PAGES, PAGES[0].id, ACTION, FORM_DATA)).toMatchObject({
77
75
  page: undefined
78
76
  });
79
77
  });
80
- it('should return the page on the action if it exists among the pages', function () {
81
- var PAGE = PAGES[1].id;
82
- var ACTION = {
78
+ it('should return the page on the action if it exists among the pages', () => {
79
+ const PAGE = PAGES[1].id;
80
+ const ACTION = {
83
81
  type: _models.PageAction.TYPES.NAVIGATE,
84
82
  page: PAGE
85
83
  };
@@ -87,9 +85,9 @@ describe('components', function () {
87
85
  page: PAGE
88
86
  });
89
87
  });
90
- it('should return undefined if the page on the action does not exist among the pages', function () {
91
- var PAGE = 'golf';
92
- var ACTION = {
88
+ it('should return undefined if the page on the action does not exist among the pages', () => {
89
+ const PAGE = 'golf';
90
+ const ACTION = {
93
91
  type: _models.PageAction.TYPES.NAVIGATE,
94
92
  page: PAGE
95
93
  };
@@ -98,11 +96,11 @@ describe('components', function () {
98
96
  });
99
97
  });
100
98
  });
101
- describe("when the action type is '".concat(_models.PageAction.TYPES.SAVE_AND_RETURN, "'"), function () {
102
- Object.values(_models.FormTypes).forEach(function (formType) {
99
+ describe(`when the action type is '${_models.PageAction.TYPES.SAVE_AND_RETURN}'`, () => {
100
+ Object.values(_models.FormTypes).forEach(formType => {
103
101
  if (formType !== _models.FormTypes.TASK && formType !== _models.FormTypes.FORM_WITH_TASK) {
104
- it("should return the current page if the form type is '".concat(formType, "'"), function () {
105
- var ACTION = _models.PageAction.DEFAULTS.saveAndReturn;
102
+ it(`should return the current page if the form type is '${formType}'`, () => {
103
+ const ACTION = _models.PageAction.DEFAULTS.saveAndReturn;
106
104
  expect((0, _getSubmissionStatus.default)(formType, PAGES, PAGES[0].id, ACTION, FORM_DATA)).toMatchObject({
107
105
  page: PAGES[0].id
108
106
  });
@@ -110,15 +108,15 @@ describe('components', function () {
110
108
  }
111
109
  });
112
110
  });
113
- describe("when the form type is '".concat(_models.FormTypes.HUB, "'"), function () {
114
- var FORM_TYPE = _models.FormTypes.HUB;
115
- it("should return '".concat(_models.FormPages.HUB, "' by default"), function () {
111
+ describe(`when the form type is '${_models.FormTypes.HUB}'`, () => {
112
+ const FORM_TYPE = _models.FormTypes.HUB;
113
+ it(`should return '${_models.FormPages.HUB}' by default`, () => {
116
114
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES)).toMatchObject({
117
115
  page: _models.FormPages.HUB
118
116
  });
119
117
  });
120
- it('should return action.page if specified', function () {
121
- var ACTION = {
118
+ it('should return action.page if specified', () => {
119
+ const ACTION = {
122
120
  page: 'bob'
123
121
  };
124
122
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, undefined, ACTION, FORM_DATA)).toMatchObject({
@@ -126,63 +124,63 @@ describe('components', function () {
126
124
  });
127
125
  });
128
126
  });
129
- describe("when the form type is '".concat(_models.FormTypes.CYA, "'"), function () {
130
- var FORM_TYPE = _models.FormTypes.CYA;
131
- var ACTION = _models.PageAction.DEFAULTS.saveAndContinue;
132
- it('should return the first page by default', function () {
127
+ describe(`when the form type is '${_models.FormTypes.CYA}'`, () => {
128
+ const FORM_TYPE = _models.FormTypes.CYA;
129
+ const ACTION = _models.PageAction.DEFAULTS.saveAndContinue;
130
+ it('should return the first page by default', () => {
133
131
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, ACTION, FORM_DATA)).toMatchObject({
134
132
  page: PAGES[0].id
135
133
  });
136
134
  });
137
- it('should return the second page when on the first page', function () {
135
+ it('should return the second page when on the first page', () => {
138
136
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, PAGES[0].id, ACTION, FORM_DATA)).toMatchObject({
139
137
  page: PAGES[1].id
140
138
  });
141
139
  });
142
- it('should return the third page when on the second page', function () {
140
+ it('should return the third page when on the second page', () => {
143
141
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, PAGES[1].id, ACTION, FORM_DATA)).toMatchObject({
144
142
  page: PAGES[2].id
145
143
  });
146
144
  });
147
- it("should return the fifth page when on the third page because the fourth page show_when is not met", function () {
145
+ it(`should return the fifth page when on the third page because the fourth page show_when is not met`, () => {
148
146
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, PAGES[2].id, ACTION, FORM_DATA)).toMatchObject({
149
147
  page: PAGES[4].id
150
148
  });
151
149
  });
152
- it("should return the sixth page when on the fifth page because the sixth page show_when is met", function () {
150
+ it(`should return the sixth page when on the fifth page because the sixth page show_when is met`, () => {
153
151
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, PAGES[4].id, ACTION, FORM_DATA)).toMatchObject({
154
152
  page: PAGES[5].id
155
153
  });
156
154
  });
157
- it("should return '".concat(_models.FormPages.CYA, "' when on the sixth (last) page"), function () {
158
- var lastPageIndex = PAGES.length - 1;
155
+ it(`should return '${_models.FormPages.CYA}' when on the sixth (last) page`, () => {
156
+ const lastPageIndex = PAGES.length - 1;
159
157
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, PAGES[lastPageIndex].id, ACTION, FORM_DATA)).toMatchObject({
160
158
  page: _models.FormPages.CYA
161
159
  });
162
160
  });
163
161
  });
164
- describe("when the form type is '".concat(_models.FormTypes.WIZARD, "'"), function () {
165
- var FORM_TYPE = _models.FormTypes.WIZARD;
166
- it('should return the first page by default', function () {
162
+ describe(`when the form type is '${_models.FormTypes.WIZARD}'`, () => {
163
+ const FORM_TYPE = _models.FormTypes.WIZARD;
164
+ it('should return the first page by default', () => {
167
165
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES)).toMatchObject({
168
166
  page: PAGES[0].id
169
167
  });
170
168
  });
171
- it('should return the second page when on the first page', function () {
169
+ it('should return the second page when on the first page', () => {
172
170
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, PAGES[0].id)).toMatchObject({
173
171
  page: PAGES[1].id
174
172
  });
175
173
  });
176
- it('should return undefined when on the last page', function () {
174
+ it('should return undefined when on the last page', () => {
177
175
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, PAGES[PAGES.length - 1].id)).toMatchObject({
178
176
  page: undefined
179
177
  });
180
178
  });
181
179
  });
182
- describe("when the form type is '".concat(_models.FormTypes.FORM, "'"), function () {
183
- var FORM_TYPE = _models.FormTypes.FORM;
184
- it("should always return the first page if there any pages and the action is not '".concat(_models.PageAction.TYPES.SAVE_AND_RETURN, "'"), function () {
185
- var ACTION = {
180
+ describe(`when the form type is '${_models.FormTypes.FORM}'`, () => {
181
+ const FORM_TYPE = _models.FormTypes.FORM;
182
+ it(`should always return the first page if there any pages and the action is not '${_models.PageAction.TYPES.SAVE_AND_RETURN}'`, () => {
183
+ const ACTION = {
186
184
  type: _models.PageAction.TYPES.SUBMIT,
187
185
  nextPageId: 'bob'
188
186
  };
@@ -199,79 +197,87 @@ describe('components', function () {
199
197
  page: PAGES[0].id
200
198
  });
201
199
  });
202
- it('should return undefined if there are no pages', function () {
200
+ it('should return undefined if there are no pages', () => {
203
201
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, [])).toMatchObject({
204
202
  page: undefined
205
203
  });
206
204
  });
207
205
  });
208
- describe("when the form type is '".concat(_models.FormTypes.TASK, "'"), function () {
209
- var FORM_TYPE = _models.FormTypes.TASK;
210
- it("should mark the current task as complete if the current page is '".concat(_models.FormPages.CYA, "' and it is marked as complete"), function () {
211
- var CURRENT_PAGE_ID = _models.FormPages.CYA;
212
- var TASK_NAME = 'taskName';
213
- var CURRENT_TASK = {
206
+ describe(`when the form type is '${_models.FormTypes.TASK}'`, () => {
207
+ const FORM_TYPE = _models.FormTypes.TASK;
208
+ it(`should mark the current task as complete if the current page is '${_models.FormPages.CYA}' and it is marked as complete`, () => {
209
+ const CURRENT_PAGE_ID = _models.FormPages.CYA;
210
+ const TASK_NAME = 'taskName';
211
+ const CURRENT_TASK = {
214
212
  name: TASK_NAME
215
213
  };
216
214
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, CURRENT_PAGE_ID, undefined, {}, CURRENT_TASK, true)).toMatchObject({
217
- tasks: _defineProperty({}, TASK_NAME, {
218
- complete: true
219
- })
215
+ tasks: {
216
+ [TASK_NAME]: {
217
+ complete: true
218
+ }
219
+ }
220
220
  });
221
221
  });
222
- it("should update the current task with the current page and a false complete flag if the next page is not '".concat(_models.FormPages.CYA, "'"), function () {
223
- var CURRENT_PAGE_ID = 'eventDate';
224
- var TASK_NAME = 'taskName';
225
- var CURRENT_TASK = {
222
+ it(`should update the current task with the current page and a false complete flag if the next page is not '${_models.FormPages.CYA}'`, () => {
223
+ const CURRENT_PAGE_ID = 'eventDate';
224
+ const TASK_NAME = 'taskName';
225
+ const CURRENT_TASK = {
226
226
  name: TASK_NAME
227
227
  };
228
- var NEXT_PAGE_ID = 'eventMode';
229
- var ACTION = {
228
+ const NEXT_PAGE_ID = 'eventMode';
229
+ const ACTION = {
230
230
  type: _PageAction.PageActionTypes.SAVE_AND_NAVIGATE,
231
231
  page: NEXT_PAGE_ID
232
232
  };
233
233
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, CURRENT_PAGE_ID, ACTION, {}, CURRENT_TASK)).toMatchObject({
234
- tasks: _defineProperty({}, TASK_NAME, {
235
- complete: false,
236
- currentPage: NEXT_PAGE_ID
237
- })
234
+ tasks: {
235
+ [TASK_NAME]: {
236
+ complete: false,
237
+ currentPage: NEXT_PAGE_ID
238
+ }
239
+ }
238
240
  });
239
241
  });
240
- it("should mark the current task as complete if the action indicates as much", function () {
241
- var CURRENT_PAGE_ID = PAGES[0].id;
242
- var TASK_NAME = 'taskName';
243
- var CURRENT_TASK = {
242
+ it(`should mark the current task as complete if the action indicates as much`, () => {
243
+ const CURRENT_PAGE_ID = PAGES[0].id;
244
+ const TASK_NAME = 'taskName';
245
+ const CURRENT_TASK = {
244
246
  name: TASK_NAME
245
247
  };
246
- var ACTION = {
248
+ const ACTION = {
247
249
  complete: true
248
250
  };
249
251
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, CURRENT_PAGE_ID, ACTION, {}, CURRENT_TASK, true)).toMatchObject({
250
- tasks: _defineProperty({}, TASK_NAME, {
251
- complete: true
252
- })
252
+ tasks: {
253
+ [TASK_NAME]: {
254
+ complete: true
255
+ }
256
+ }
253
257
  });
254
258
  });
255
- it("should mark the current task as complete if the current task is a pre-task-list task", function () {
256
- var CURRENT_PAGE_ID = PAGES[PAGES.length - 1].id;
257
- var TASK_NAME = undefined;
258
- var CURRENT_TASK = {
259
+ it(`should mark the current task as complete if the current task is a pre-task-list task`, () => {
260
+ const CURRENT_PAGE_ID = PAGES[PAGES.length - 1].id;
261
+ const TASK_NAME = undefined;
262
+ const CURRENT_TASK = {
259
263
  name: TASK_NAME
260
264
  };
261
- var ACTION = {
265
+ const ACTION = {
262
266
  complete: true
263
267
  };
264
- var TASKS = [{
268
+ const TASKS = [{
265
269
  type: 'pre-task-list',
266
270
  pages: PAGES
267
271
  }];
268
- var SECTIONS = [{
272
+ const SECTIONS = [{
269
273
  tasks: TASKS
270
274
  }];
271
275
  expect((0, _getSubmissionStatus.default)(FORM_TYPE, PAGES, CURRENT_PAGE_ID, ACTION, {}, CURRENT_TASK, true, SECTIONS)).toMatchObject({
272
- tasks: _defineProperty({}, TASK_NAME, {
273
- complete: true
274
- })
276
+ tasks: {
277
+ [TASK_NAME]: {
278
+ complete: true
279
+ }
280
+ }
275
281
  });
276
282
  });
277
283
  });