@ukhomeoffice/cop-react-form-renderer 5.45.2-alpha → 5.48.1-alpha

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 (353) hide show
  1. package/dist/components/CheckYourAnswers/Answer.js +12 -12
  2. package/dist/components/CheckYourAnswers/Answer.test.js +127 -92
  3. package/dist/components/CheckYourAnswers/CheckYourAnswers.js +131 -101
  4. package/dist/components/CheckYourAnswers/CheckYourAnswers.test.js +769 -464
  5. package/dist/components/CollectionPage/CollectionPage.js +58 -66
  6. package/dist/components/CollectionPage/CollectionPage.test.js +342 -300
  7. package/dist/components/CollectionSummary/BannerStrip.js +12 -12
  8. package/dist/components/CollectionSummary/BannerStrip.test.js +59 -63
  9. package/dist/components/CollectionSummary/CollectionSummary.js +88 -61
  10. package/dist/components/CollectionSummary/CollectionSummary.test.js +96 -102
  11. package/dist/components/CollectionSummary/Confirmation.js +12 -14
  12. package/dist/components/CollectionSummary/Confirmation.test.js +63 -68
  13. package/dist/components/CollectionSummary/SummaryCard.js +148 -109
  14. package/dist/components/CollectionSummary/SummaryCard.scss +1 -1
  15. package/dist/components/CollectionSummary/SummaryCard.test.js +927 -905
  16. package/dist/components/CollectionSummary/SummaryCardValidationContext.js +29 -23
  17. package/dist/components/CollectionSummary/SummaryCardValidationContext.test.js +73 -61
  18. package/dist/components/FormComponent/Collection.js +107 -73
  19. package/dist/components/FormComponent/Collection.test.js +945 -809
  20. package/dist/components/FormComponent/Container.js +38 -40
  21. package/dist/components/FormComponent/Container.test.js +345 -314
  22. package/dist/components/FormComponent/FormComponent.js +70 -67
  23. package/dist/components/FormComponent/FormComponent.test.js +342 -284
  24. package/dist/components/FormComponent/helpers/addLabel.js +7 -4
  25. package/dist/components/FormComponent/helpers/getComponentDisabled.js +1 -1
  26. package/dist/components/FormComponent/helpers/getComponentDisabled.test.js +7 -7
  27. package/dist/components/FormComponent/helpers/getComponentError.js +5 -3
  28. package/dist/components/FormComponent/helpers/getComponentError.test.js +14 -14
  29. package/dist/components/FormComponent/helpers/getComponentFieldSet.js +4 -3
  30. package/dist/components/FormComponent/helpers/getComponentFieldSet.test.js +6 -6
  31. package/dist/components/FormComponent/helpers/index.js +4 -4
  32. package/dist/components/FormPage/FormPage.js +80 -65
  33. package/dist/components/FormPage/FormPage.test.js +163 -127
  34. package/dist/components/FormRenderer/FormRenderer.js +181 -144
  35. package/dist/components/FormRenderer/FormRenderer.test.js +1115 -730
  36. package/dist/components/FormRenderer/handlers/cyaAction.js +2 -2
  37. package/dist/components/FormRenderer/handlers/getPageId.js +3 -1
  38. package/dist/components/FormRenderer/handlers/getPageId.test.js +14 -14
  39. package/dist/components/FormRenderer/handlers/handlers.test.js +32 -32
  40. package/dist/components/FormRenderer/handlers/index.js +1 -1
  41. package/dist/components/FormRenderer/handlers/navigate.js +3 -3
  42. package/dist/components/FormRenderer/handlers/submissionError.js +1 -1
  43. package/dist/components/FormRenderer/helpers/canActionProceed.js +5 -1
  44. package/dist/components/FormRenderer/helpers/canActionProceed.test.js +47 -11
  45. package/dist/components/FormRenderer/helpers/canCYASubmit.js +3 -1
  46. package/dist/components/FormRenderer/helpers/canCYASubmit.test.js +20 -16
  47. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.js +22 -17
  48. package/dist/components/FormRenderer/helpers/cleanHiddenNestedData.test.js +16 -16
  49. package/dist/components/FormRenderer/helpers/getCYA.js +5 -3
  50. package/dist/components/FormRenderer/helpers/getCYA.test.js +11 -11
  51. package/dist/components/FormRenderer/helpers/getFormState.js +7 -5
  52. package/dist/components/FormRenderer/helpers/getFormState.test.js +10 -10
  53. package/dist/components/FormRenderer/helpers/getNextPageId.js +24 -13
  54. package/dist/components/FormRenderer/helpers/getNextPageId.test.js +67 -67
  55. package/dist/components/FormRenderer/helpers/getPage.js +4 -2
  56. package/dist/components/FormRenderer/helpers/getPage.test.js +11 -11
  57. package/dist/components/FormRenderer/helpers/getRelevantPages.js +9 -7
  58. package/dist/components/FormRenderer/helpers/getRelevantPages.test.js +14 -14
  59. package/dist/components/FormRenderer/helpers/getSubmissionStatus.js +5 -5
  60. package/dist/components/FormRenderer/helpers/getSubmissionStatus.test.js +91 -97
  61. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.js +60 -62
  62. package/dist/components/FormRenderer/helpers/getUpdatedSectionStates.test.js +73 -71
  63. package/dist/components/FormRenderer/helpers/index.js +1 -1
  64. package/dist/components/FormRenderer/onCYAAction.js +51 -59
  65. package/dist/components/FormRenderer/onCYAAction.test.js +152 -164
  66. package/dist/components/FormRenderer/onPageAction.js +40 -44
  67. package/dist/components/FormRenderer/onPageAction.test.js +206 -223
  68. package/dist/components/FormRenderer/onTaskAction.js +13 -9
  69. package/dist/components/FormRenderer/onTaskAction.test.js +88 -93
  70. package/dist/components/PageActions/ActionButton.js +15 -12
  71. package/dist/components/PageActions/ActionButton.test.js +78 -56
  72. package/dist/components/PageActions/PageActions.js +10 -10
  73. package/dist/components/PageActions/PageActions.test.js +115 -86
  74. package/dist/components/SummaryList/GroupAction.js +17 -9
  75. package/dist/components/SummaryList/GroupAction.test.js +33 -37
  76. package/dist/components/SummaryList/RowAction.js +16 -11
  77. package/dist/components/SummaryList/RowAction.test.js +33 -37
  78. package/dist/components/SummaryList/SummaryList.js +26 -21
  79. package/dist/components/SummaryList/SummaryList.test.js +166 -143
  80. package/dist/components/SummaryList/SummaryListHeadingRow.js +4 -6
  81. package/dist/components/SummaryList/SummaryListRow.js +4 -6
  82. package/dist/components/SummaryList/SummaryListTitleRow.js +3 -5
  83. package/dist/components/SummaryList/helpers/getGroupActionAttributes.js +5 -3
  84. package/dist/components/SummaryList/helpers/getGroupActionAttributes.test.js +22 -22
  85. package/dist/components/SummaryList/helpers/getRowActionAttributes.js +5 -3
  86. package/dist/components/SummaryList/helpers/getRowActionAttributes.test.js +22 -22
  87. package/dist/components/SummaryList/helpers/index.js +1 -1
  88. package/dist/components/TaskList/Task.js +29 -19
  89. package/dist/components/TaskList/Task.test.js +76 -83
  90. package/dist/components/TaskList/TaskList.js +71 -45
  91. package/dist/components/TaskList/TaskList.test.js +111 -113
  92. package/dist/components/TaskList/TaskState.js +5 -7
  93. package/dist/components/TaskList/TaskState.test.js +45 -52
  94. package/dist/components/index.js +7 -7
  95. package/dist/context/HooksContext/HooksContext.js +79 -58
  96. package/dist/context/HooksContext/HooksContext.test.js +35 -26
  97. package/dist/context/HooksContext/index.js +4 -3
  98. package/dist/context/ValidationContext/ValidationContext.js +72 -32
  99. package/dist/context/ValidationContext/ValidationContext.test.js +59 -47
  100. package/dist/context/ValidationContext/index.js +4 -3
  101. package/dist/context/index.js +2 -2
  102. package/dist/hooks/index.js +10 -9
  103. package/dist/hooks/useAxios.js +40 -14
  104. package/dist/hooks/useGetRequest.js +97 -61
  105. package/dist/hooks/useHooks.js +3 -1
  106. package/dist/hooks/useRefData.js +39 -26
  107. package/dist/hooks/useValidation.js +3 -1
  108. package/dist/index.js +14 -13
  109. package/dist/models/CollectionLabels.js +1 -1
  110. package/dist/models/ComponentTypes.js +25 -25
  111. package/dist/models/EventTypes.js +4 -4
  112. package/dist/models/FormPages.js +4 -4
  113. package/dist/models/FormTypes.js +8 -8
  114. package/dist/models/HubFormats.js +3 -3
  115. package/dist/models/PageAction.js +38 -44
  116. package/dist/models/TaskStates.js +28 -30
  117. package/dist/models/index.js +9 -9
  118. package/dist/setupTests.js +31 -30
  119. package/dist/utils/CheckYourAnswers/getCYAAction.js +5 -5
  120. package/dist/utils/CheckYourAnswers/getCYAAction.test.js +54 -52
  121. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.js +25 -15
  122. package/dist/utils/CheckYourAnswers/getCYACollectionChangeAction.test.js +35 -33
  123. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.js +31 -17
  124. package/dist/utils/CheckYourAnswers/getCYACollectionDeleteAction.test.js +44 -42
  125. package/dist/utils/CheckYourAnswers/getCYARow.js +6 -6
  126. package/dist/utils/CheckYourAnswers/getCYARow.test.js +86 -86
  127. package/dist/utils/CheckYourAnswers/getCYARowForGroup.js +24 -18
  128. package/dist/utils/CheckYourAnswers/getCYARowForGroup.test.js +16 -15
  129. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.js +36 -33
  130. package/dist/utils/CheckYourAnswers/getCYARowsForCollection.test.js +60 -58
  131. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.js +88 -79
  132. package/dist/utils/CheckYourAnswers/getCYARowsForCollectionPage.test.js +124 -146
  133. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.js +20 -25
  134. package/dist/utils/CheckYourAnswers/getCYARowsForContainer.test.js +97 -103
  135. package/dist/utils/CheckYourAnswers/getCYARowsForPage.js +18 -13
  136. package/dist/utils/CheckYourAnswers/getCYARowsForPage.test.js +76 -70
  137. package/dist/utils/CheckYourAnswers/index.js +1 -1
  138. package/dist/utils/CheckYourAnswers/showComponentCYA.js +4 -4
  139. package/dist/utils/CheckYourAnswers/showComponentCYA.test.js +24 -24
  140. package/dist/utils/CollectionPage/addCollectionPageEntry.js +1 -1
  141. package/dist/utils/CollectionPage/addCollectionPageEntry.test.js +5 -5
  142. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.js +2 -2
  143. package/dist/utils/CollectionPage/duplicateCollectionPageActiveEntry.test.js +17 -17
  144. package/dist/utils/CollectionPage/duplicateCollectionPageEntry.js +18 -9
  145. package/dist/utils/CollectionPage/duplicateCollectionPageEntry.test.js +22 -27
  146. package/dist/utils/CollectionPage/getCollectionPageActiveId.js +2 -2
  147. package/dist/utils/CollectionPage/getCollectionPageActiveId.test.js +10 -10
  148. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.js +11 -7
  149. package/dist/utils/CollectionPage/getCollectionPageActiveIndex.test.js +22 -22
  150. package/dist/utils/CollectionPage/getCollectionPageData.js +12 -8
  151. package/dist/utils/CollectionPage/getCollectionPageData.test.js +19 -19
  152. package/dist/utils/CollectionPage/getQuickEditPage.js +19 -19
  153. package/dist/utils/CollectionPage/getQuickEditPage.test.js +16 -12
  154. package/dist/utils/CollectionPage/index.js +1 -1
  155. package/dist/utils/CollectionPage/mergeCollectionPages.js +30 -29
  156. package/dist/utils/CollectionPage/mergeCollectionPages.test.js +17 -17
  157. package/dist/utils/CollectionPage/removeCollectionPageEntry.js +6 -4
  158. package/dist/utils/CollectionPage/removeCollectionPageEntry.test.js +10 -10
  159. package/dist/utils/CollectionPage/setCollectionPageData.js +12 -8
  160. package/dist/utils/CollectionPage/setCollectionPageData.test.js +17 -17
  161. package/dist/utils/Component/addShowWhen.js +8 -4
  162. package/dist/utils/Component/addShowWhen.test.js +37 -37
  163. package/dist/utils/Component/applyToComponentTree.js +18 -18
  164. package/dist/utils/Component/applyToComponentTree.test.js +32 -27
  165. package/dist/utils/Component/cleanAttributes.js +13 -10
  166. package/dist/utils/Component/cleanAttributes.test.js +18 -17
  167. package/dist/utils/Component/elevateNestedComponents.js +5 -5
  168. package/dist/utils/Component/elevateNestedComponents.test.js +30 -30
  169. package/dist/utils/Component/getComponent.js +94 -88
  170. package/dist/utils/Component/getComponentTests/getComponent.autocomplete.test.js +17 -18
  171. package/dist/utils/Component/getComponentTests/getComponent.calculation.test.js +59 -46
  172. package/dist/utils/Component/getComponentTests/getComponent.checkboxes.test.js +48 -39
  173. package/dist/utils/Component/getComponentTests/getComponent.date.test.js +33 -23
  174. package/dist/utils/Component/getComponentTests/getComponent.details.test.js +18 -20
  175. package/dist/utils/Component/getComponentTests/getComponent.email.test.js +22 -17
  176. package/dist/utils/Component/getComponentTests/getComponent.file.test.js +25 -20
  177. package/dist/utils/Component/getComponentTests/getComponent.heading.test.js +9 -10
  178. package/dist/utils/Component/getComponentTests/getComponent.html.test.js +15 -17
  179. package/dist/utils/Component/getComponentTests/getComponent.insetText.test.js +8 -9
  180. package/dist/utils/Component/getComponentTests/getComponent.list.test.js +15 -17
  181. package/dist/utils/Component/getComponentTests/getComponent.multifile.test.js +26 -22
  182. package/dist/utils/Component/getComponentTests/getComponent.nested.test.js +175 -155
  183. package/dist/utils/Component/getComponentTests/getComponent.paragraph.test.js +15 -17
  184. package/dist/utils/Component/getComponentTests/getComponent.phoneNumber.test.js +22 -17
  185. package/dist/utils/Component/getComponentTests/getComponent.radios.test.js +70 -57
  186. package/dist/utils/Component/getComponentTests/getComponent.select.test.js +22 -17
  187. package/dist/utils/Component/getComponentTests/getComponent.text.test.js +22 -17
  188. package/dist/utils/Component/getComponentTests/getComponent.textArea.test.js +38 -31
  189. package/dist/utils/Component/getComponentTests/getComponent.time.test.js +29 -20
  190. package/dist/utils/Component/getComponentTests/getComponent.unknown.test.js +2 -2
  191. package/dist/utils/Component/getComponentTests/getComponent.warningText.test.js +8 -9
  192. package/dist/utils/Component/getDefaultValue.js +8 -6
  193. package/dist/utils/Component/getDefaultValue.test.js +12 -12
  194. package/dist/utils/Component/getDefaultValueFromConfig.js +21 -22
  195. package/dist/utils/Component/getDefaultValueFromConfig.test.js +31 -31
  196. package/dist/utils/Component/index.js +1 -1
  197. package/dist/utils/Component/isEditable.js +4 -2
  198. package/dist/utils/Component/isEditable.test.js +15 -14
  199. package/dist/utils/Component/optionIsSelected.js +1 -1
  200. package/dist/utils/Component/optionIsSelected.test.js +9 -9
  201. package/dist/utils/Component/setupContainerComponentsPath.js +29 -27
  202. package/dist/utils/Component/setupContainerComponentsPath.test.js +11 -11
  203. package/dist/utils/Component/showComponent.js +1 -1
  204. package/dist/utils/Component/showComponent.test.js +28 -28
  205. package/dist/utils/Component/wrapInFormGroup.js +2 -2
  206. package/dist/utils/Condition/index.js +1 -1
  207. package/dist/utils/Condition/meetsAllConditions.js +7 -7
  208. package/dist/utils/Condition/meetsAllConditions.test.js +17 -17
  209. package/dist/utils/Condition/meetsCondition.js +17 -14
  210. package/dist/utils/Condition/meetsCondition.test.js +376 -376
  211. package/dist/utils/Condition/meetsOneCondition.js +5 -5
  212. package/dist/utils/Condition/meetsOneCondition.test.js +16 -16
  213. package/dist/utils/Condition/setupConditions.js +18 -13
  214. package/dist/utils/Condition/setupConditions.test.js +7 -7
  215. package/dist/utils/Container/getEditableComponents.js +5 -3
  216. package/dist/utils/Container/getEditableComponents.test.js +45 -43
  217. package/dist/utils/Container/index.js +1 -1
  218. package/dist/utils/Container/setupNesting.js +20 -16
  219. package/dist/utils/Container/setupNesting.test.js +30 -27
  220. package/dist/utils/Container/showContainer.js +7 -3
  221. package/dist/utils/Container/showContainer.test.js +30 -30
  222. package/dist/utils/Data/applyFormula.js +48 -38
  223. package/dist/utils/Data/applyFormula.test.js +20 -20
  224. package/dist/utils/Data/getAutocompleteSource.js +26 -18
  225. package/dist/utils/Data/getAutocompleteSource.test.js +86 -80
  226. package/dist/utils/Data/getDataPath.js +28 -18
  227. package/dist/utils/Data/getDataPath.test.js +12 -12
  228. package/dist/utils/Data/getOptions.js +25 -19
  229. package/dist/utils/Data/getOptions.test.js +20 -20
  230. package/dist/utils/Data/getSourceData.js +19 -6
  231. package/dist/utils/Data/getSourceData.test.js +80 -84
  232. package/dist/utils/Data/index.js +1 -1
  233. package/dist/utils/Data/refDataToOptions.js +13 -10
  234. package/dist/utils/Data/refDataToOptions.test.js +19 -19
  235. package/dist/utils/Data/setDataItem.js +8 -7
  236. package/dist/utils/Data/setDataItem.test.js +37 -37
  237. package/dist/utils/Data/setupFormData.js +21 -13
  238. package/dist/utils/Data/setupFormData.test.js +50 -51
  239. package/dist/utils/Data/setupRefDataUrlForComponent.js +26 -20
  240. package/dist/utils/Data/setupRefDataUrlForComponent.test.js +24 -24
  241. package/dist/utils/FormPage/applyConditionalProperties.js +9 -5
  242. package/dist/utils/FormPage/applyConditionalProperties.test.js +18 -15
  243. package/dist/utils/FormPage/getFormPage.js +16 -15
  244. package/dist/utils/FormPage/getFormPage.test.js +46 -47
  245. package/dist/utils/FormPage/getFormPages.js +12 -7
  246. package/dist/utils/FormPage/getFormPages.test.js +23 -20
  247. package/dist/utils/FormPage/getPageActions.js +15 -9
  248. package/dist/utils/FormPage/getPageActions.test.js +32 -32
  249. package/dist/utils/FormPage/getPageTitle.js +2 -2
  250. package/dist/utils/FormPage/getPageTitle.test.js +22 -22
  251. package/dist/utils/FormPage/getParagraphFromText.js +7 -5
  252. package/dist/utils/FormPage/getParagraphFromText.test.js +6 -6
  253. package/dist/utils/FormPage/index.js +1 -1
  254. package/dist/utils/FormPage/showFormPage.js +7 -3
  255. package/dist/utils/FormPage/showFormPage.test.js +32 -32
  256. package/dist/utils/FormPage/showFormPageCYA.js +1 -1
  257. package/dist/utils/FormPage/showFormPageCYA.test.js +8 -8
  258. package/dist/utils/FormPage/useComponent.js +28 -21
  259. package/dist/utils/FormPage/useComponent.test.js +79 -78
  260. package/dist/utils/Format/formatData.js +1 -1
  261. package/dist/utils/Format/formatData.test.js +18 -18
  262. package/dist/utils/Format/formatDataForComponent.js +6 -5
  263. package/dist/utils/Format/formatDataForComponent.test.js +77 -50
  264. package/dist/utils/Format/formatDataForForm.js +8 -6
  265. package/dist/utils/Format/formatDataForForm.test.js +15 -13
  266. package/dist/utils/Format/formatDataForPage.js +5 -4
  267. package/dist/utils/Format/formatDataForPage.test.js +23 -20
  268. package/dist/utils/Format/index.js +1 -1
  269. package/dist/utils/Hub/getFormHub.js +1 -1
  270. package/dist/utils/Hub/getFormHub.test.js +31 -28
  271. package/dist/utils/Hub/index.js +1 -1
  272. package/dist/utils/Meta/constants.js +2 -2
  273. package/dist/utils/Meta/documents/getDocuments.js +1 -1
  274. package/dist/utils/Meta/documents/getDocuments.test.js +16 -24
  275. package/dist/utils/Meta/documents/index.js +1 -1
  276. package/dist/utils/Meta/documents/setDocumentsForField.js +16 -14
  277. package/dist/utils/Meta/documents/setDocumentsForField.test.js +34 -68
  278. package/dist/utils/Meta/index.js +1 -1
  279. package/dist/utils/Operate/checkValueIsTruthy.js +2 -2
  280. package/dist/utils/Operate/checkValueIsTruthy.test.js +16 -16
  281. package/dist/utils/Operate/getFirstOf.js +5 -5
  282. package/dist/utils/Operate/getFirstOf.test.js +31 -31
  283. package/dist/utils/Operate/getIndexOfMatchingValueIn.js +10 -10
  284. package/dist/utils/Operate/getIndexOfMatchingValueIn.test.js +46 -46
  285. package/dist/utils/Operate/index.js +1 -1
  286. package/dist/utils/Operate/persistValueInFormData.js +3 -3
  287. package/dist/utils/Operate/persistValueInFormData.test.js +20 -22
  288. package/dist/utils/Operate/runPageOperations.js +7 -7
  289. package/dist/utils/Operate/runPageOperations.test.js +36 -35
  290. package/dist/utils/Operate/setValueInFormData.js +2 -2
  291. package/dist/utils/Operate/setValueInFormData.test.js +16 -16
  292. package/dist/utils/Operate/shouldRun.js +6 -6
  293. package/dist/utils/Operate/shouldRun.test.js +26 -21
  294. package/dist/utils/Validate/additional/conditionallyRequired.js +4 -4
  295. package/dist/utils/Validate/additional/conditionallyRequired.test.js +18 -18
  296. package/dist/utils/Validate/additional/index.js +10 -8
  297. package/dist/utils/Validate/additional/index.test.js +12 -12
  298. package/dist/utils/Validate/additional/mustBeAfter.js +2 -2
  299. package/dist/utils/Validate/additional/mustBeAfter.test.js +40 -40
  300. package/dist/utils/Validate/additional/mustBeBefore.js +2 -2
  301. package/dist/utils/Validate/additional/mustBeBefore.test.js +28 -28
  302. package/dist/utils/Validate/additional/mustBeEarlierDateTime.js +11 -7
  303. package/dist/utils/Validate/additional/mustBeEarlierDateTime.test.js +41 -37
  304. package/dist/utils/Validate/additional/mustBeGreaterThan.js +2 -2
  305. package/dist/utils/Validate/additional/mustBeGreaterThan.test.js +18 -18
  306. package/dist/utils/Validate/additional/mustBeInTheFuture.js +2 -2
  307. package/dist/utils/Validate/additional/mustBeInTheFuture.test.js +12 -12
  308. package/dist/utils/Validate/additional/mustBeInThePast.js +3 -3
  309. package/dist/utils/Validate/additional/mustBeInThePast.test.js +12 -12
  310. package/dist/utils/Validate/additional/mustBeLessThan.js +2 -2
  311. package/dist/utils/Validate/additional/mustBeLessThan.test.js +17 -17
  312. package/dist/utils/Validate/additional/mustBeLongerThan.js +1 -1
  313. package/dist/utils/Validate/additional/mustBeLongerThan.test.js +16 -16
  314. package/dist/utils/Validate/additional/mustBeNumbersOnly.js +2 -2
  315. package/dist/utils/Validate/additional/mustBeNumbersOnly.test.js +20 -20
  316. package/dist/utils/Validate/additional/mustBeShorterThan.js +1 -1
  317. package/dist/utils/Validate/additional/mustBeShorterThan.test.js +16 -16
  318. package/dist/utils/Validate/additional/mustBeUniqueInCollection.js +35 -0
  319. package/dist/utils/Validate/additional/mustBeUniqueInCollection.test.js +127 -0
  320. package/dist/utils/Validate/additional/mustEnterAtLeastOne.js +2 -2
  321. package/dist/utils/Validate/additional/mustEnterAtLeastOne.test.js +16 -14
  322. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.js +1 -1
  323. package/dist/utils/Validate/additional/mustHaveLessThanDecimalPlaces.test.js +12 -12
  324. package/dist/utils/Validate/additional/mustNotContainSql.js +4 -3
  325. package/dist/utils/Validate/additional/mustNotContainSql.test.js +14 -14
  326. package/dist/utils/Validate/additional/mustSelectOnlyOne.js +2 -2
  327. package/dist/utils/Validate/additional/mustSelectOnlyOne.test.js +26 -28
  328. package/dist/utils/Validate/additional/utils.js +22 -9
  329. package/dist/utils/Validate/index.js +1 -1
  330. package/dist/utils/Validate/validateCollection.js +25 -19
  331. package/dist/utils/Validate/validateCollection.test.js +66 -74
  332. package/dist/utils/Validate/validateComponent.js +16 -18
  333. package/dist/utils/Validate/validateComponent.test.js +146 -167
  334. package/dist/utils/Validate/validateContainer.js +19 -14
  335. package/dist/utils/Validate/validateContainer.test.js +45 -49
  336. package/dist/utils/Validate/validateDate.js +17 -11
  337. package/dist/utils/Validate/validateDate.test.js +29 -28
  338. package/dist/utils/Validate/validateEmail.js +8 -6
  339. package/dist/utils/Validate/validateEmail.test.js +25 -25
  340. package/dist/utils/Validate/validateMultifile.js +7 -5
  341. package/dist/utils/Validate/validateMultifile.test.js +18 -17
  342. package/dist/utils/Validate/validatePage.js +18 -17
  343. package/dist/utils/Validate/validatePage.test.js +182 -185
  344. package/dist/utils/Validate/validateRegex.js +5 -3
  345. package/dist/utils/Validate/validateRegex.test.js +14 -14
  346. package/dist/utils/Validate/validateRequired.js +6 -4
  347. package/dist/utils/Validate/validateRequired.test.js +18 -18
  348. package/dist/utils/Validate/validateTextArea.js +6 -4
  349. package/dist/utils/Validate/validateTextArea.test.js +20 -20
  350. package/dist/utils/Validate/validateTime.js +14 -7
  351. package/dist/utils/Validate/validateTime.test.js +14 -14
  352. package/dist/utils/index.js +9 -7
  353. package/package.json +2 -2
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ 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); }
3
4
  var _react = require("@testing-library/react");
4
5
  var _react2 = _interopRequireDefault(require("react"));
5
6
  var _copReactComponents = require("@ukhomeoffice/cop-react-components");
@@ -8,17 +9,22 @@ var _setupTests = require("../../setupTests");
8
9
  var _SummaryCard = _interopRequireWildcard(require("./SummaryCard"));
9
10
  var _BannerStrip = require("./BannerStrip");
10
11
  var _SummaryCardValidationContext = _interopRequireDefault(require("./SummaryCardValidationContext"));
11
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
12
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
13
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- // Global imports.
15
-
15
+ 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; }
16
+ 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; }
17
+ 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; }
18
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
19
+ 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); }
20
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
21
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
22
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } // Global imports.
16
23
  // Local imports.
17
-
18
- describe('components.CollectionSummary.SummaryCard', () => {
19
- const classes = _copReactComponents.Utils.classBuilder(_SummaryCard.DEFAULT_CLASS, [], '');
20
- const ID = 'summaryCardId';
21
- const ENTRY = {
24
+ describe('components.CollectionSummary.SummaryCard', function () {
25
+ var classes = _copReactComponents.Utils.classBuilder(_SummaryCard.DEFAULT_CLASS, [], '');
26
+ var ID = 'summaryCardId';
27
+ var ENTRY = {
22
28
  id: '001',
23
29
  bannerText: 'A banner',
24
30
  titleText: 'A title',
@@ -26,229 +32,217 @@ describe('components.CollectionSummary.SummaryCard', () => {
26
32
  index: 0,
27
33
  summaryText: 'Full details'
28
34
  };
29
- const checkSetup = container => {
30
- const cardDiv = container.children[0];
35
+ var checkSetup = function checkSetup(container) {
36
+ var cardDiv = container.children[0];
31
37
  expect(cardDiv.tagName).toEqual('DIV');
32
38
  expect(cardDiv.classList).toContain(_SummaryCard.DEFAULT_CLASS);
33
- const headerDiv = cardDiv.children[0];
39
+ var headerDiv = cardDiv.children[0];
34
40
  expect(headerDiv.tagName).toEqual('DIV');
35
41
  expect(headerDiv.classList).toContain(classes('header'));
36
- const headerContentDiv = headerDiv.children[0];
42
+ var headerContentDiv = headerDiv.children[0];
37
43
  expect(headerContentDiv.tagName).toEqual('DIV');
38
44
  expect(headerContentDiv.classList).toContain(classes('header-content'));
39
- const headerActionDiv = headerDiv.children[1];
45
+ var headerActionDiv = headerDiv.children[1];
40
46
  expect(headerActionDiv.tagName).toEqual('DIV');
41
47
  expect(headerActionDiv.className).toContain(classes('header-actions'));
42
- const bodyDiv = cardDiv.children[1];
48
+ var bodyDiv = cardDiv.children[1];
43
49
  expect(bodyDiv.tagName).toEqual('DIV');
44
50
  expect(bodyDiv.classList).toContain(classes('body'));
45
51
  return {
46
- cardDiv,
47
- headerDiv,
48
- headerContentDiv,
49
- headerActionDiv,
50
- bodyDiv
52
+ cardDiv: cardDiv,
53
+ headerDiv: headerDiv,
54
+ headerContentDiv: headerContentDiv,
55
+ headerActionDiv: headerActionDiv,
56
+ bodyDiv: bodyDiv
51
57
  };
52
58
  };
53
- it('should correctly render a SummaryCard component', () => {
54
- const CONFIG = {
59
+ it('should correctly render a SummaryCard component', function () {
60
+ var CONFIG = {
55
61
  banners: ['Alpha', 'Bravo'],
56
62
  title: 'Title text',
57
63
  details: 'Detail text'
58
64
  };
59
- const {
60
- container
61
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
62
- id: ID,
63
- entryData: ENTRY,
64
- config: CONFIG,
65
- parentCollectionName: "parent",
66
- pages: [],
67
- formData: {},
68
- masterPage: {
69
- childPages: []
70
- }
71
- }));
72
- const {
73
- headerContentDiv
74
- } = checkSetup(container);
65
+ var _renderWithValidation = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
66
+ id: ID,
67
+ entryData: ENTRY,
68
+ config: CONFIG,
69
+ parentCollectionName: "parent",
70
+ pages: [],
71
+ formData: {},
72
+ masterPage: {
73
+ childPages: []
74
+ }
75
+ })),
76
+ container = _renderWithValidation.container;
77
+ var _checkSetup = checkSetup(container),
78
+ headerContentDiv = _checkSetup.headerContentDiv;
75
79
  expect(headerContentDiv.children.length).toEqual(3);
76
- const headerBanners = headerContentDiv.children[0];
80
+ var headerBanners = headerContentDiv.children[0];
77
81
  expect(headerBanners.tagName).toEqual('DIV');
78
82
  expect(headerBanners.classList).toContain(_BannerStrip.DEFAULT_CLASS);
79
- const headerTitle = headerContentDiv.children[1];
83
+ var headerTitle = headerContentDiv.children[1];
80
84
  expect(headerTitle.tagName).toEqual('DIV');
81
85
  expect(headerTitle.classList).toContain(classes('header-content-title'));
82
86
  expect(headerTitle.textContent).toEqual(CONFIG.title);
83
- const headerDetails = headerContentDiv.children[2];
87
+ var headerDetails = headerContentDiv.children[2];
84
88
  expect(headerDetails.tagName).toEqual('DIV');
85
89
  expect(headerDetails.classList).toContain(classes('header-content-detail'));
86
90
  expect(headerDetails.textContent).toEqual(CONFIG.details);
87
91
  });
88
- it('should not render a banner if none are supplied', () => {
89
- const CONFIG = {
92
+ it('should not render a banner if none are supplied', function () {
93
+ var CONFIG = {
90
94
  title: 'Title text',
91
95
  details: 'Detail text'
92
96
  };
93
- const {
94
- container
95
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
96
- id: ID,
97
- entryData: ENTRY,
98
- config: CONFIG,
99
- parentCollectionName: "parent",
100
- pages: [],
101
- formData: {},
102
- masterPage: {
103
- childPages: []
104
- }
105
- }));
106
- const {
107
- headerContentDiv
108
- } = checkSetup(container);
97
+ var _renderWithValidation2 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
98
+ id: ID,
99
+ entryData: ENTRY,
100
+ config: CONFIG,
101
+ parentCollectionName: "parent",
102
+ pages: [],
103
+ formData: {},
104
+ masterPage: {
105
+ childPages: []
106
+ }
107
+ })),
108
+ container = _renderWithValidation2.container;
109
+ var _checkSetup2 = checkSetup(container),
110
+ headerContentDiv = _checkSetup2.headerContentDiv;
109
111
  expect(headerContentDiv.children.length).toEqual(2);
110
112
 
111
113
  // The only two children of the content div should be the title
112
114
  // and the details.
113
115
 
114
- const headerTitle = headerContentDiv.children[0];
116
+ var headerTitle = headerContentDiv.children[0];
115
117
  expect(headerTitle.tagName).toEqual('DIV');
116
118
  expect(headerTitle.classList).toContain(classes('header-content-title'));
117
119
  expect(headerTitle.textContent).toEqual(CONFIG.title);
118
- const headerDetails = headerContentDiv.children[1];
120
+ var headerDetails = headerContentDiv.children[1];
119
121
  expect(headerDetails.tagName).toEqual('DIV');
120
122
  expect(headerDetails.classList).toContain(classes('header-content-detail'));
121
123
  expect(headerDetails.textContent).toEqual(CONFIG.details);
122
124
  });
123
- it('should not render details if none are supplied', () => {
124
- const CONFIG = {
125
+ it('should not render details if none are supplied', function () {
126
+ var CONFIG = {
125
127
  banners: ['Alpha', 'Bravo'],
126
128
  title: 'Title text'
127
129
  };
128
- const {
129
- container
130
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
131
- id: ID,
132
- entryData: ENTRY,
133
- config: CONFIG,
134
- parentCollectionName: "parent",
135
- pages: [],
136
- formData: {},
137
- masterPage: {
138
- childPages: []
139
- }
140
- }));
141
- const {
142
- headerContentDiv
143
- } = checkSetup(container);
130
+ var _renderWithValidation3 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
131
+ id: ID,
132
+ entryData: ENTRY,
133
+ config: CONFIG,
134
+ parentCollectionName: "parent",
135
+ pages: [],
136
+ formData: {},
137
+ masterPage: {
138
+ childPages: []
139
+ }
140
+ })),
141
+ container = _renderWithValidation3.container;
142
+ var _checkSetup3 = checkSetup(container),
143
+ headerContentDiv = _checkSetup3.headerContentDiv;
144
144
  expect(headerContentDiv.children.length).toEqual(2);
145
- const headerBanners = headerContentDiv.children[0];
145
+ var headerBanners = headerContentDiv.children[0];
146
146
  expect(headerBanners.tagName).toEqual('DIV');
147
147
  expect(headerBanners.classList).toContain(_BannerStrip.DEFAULT_CLASS);
148
148
 
149
149
  // The only two children of the content div should be the banner and
150
150
  // the title.
151
151
 
152
- const headerTitle = headerContentDiv.children[1];
152
+ var headerTitle = headerContentDiv.children[1];
153
153
  expect(headerTitle.tagName).toEqual('DIV');
154
154
  expect(headerTitle.classList).toContain(classes('header-content-title'));
155
155
  expect(headerTitle.textContent).toEqual(CONFIG.title);
156
156
  });
157
- it('should correctly interpolate the title', () => {
158
- const CONFIG = {
157
+ it('should correctly interpolate the title', function () {
158
+ var CONFIG = {
159
159
  // eslint-disable-next-line no-template-curly-in-string
160
160
  title: '${titleText} that is interpolated'
161
161
  };
162
- const {
163
- container
164
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
165
- id: ID,
166
- entryData: ENTRY,
167
- config: CONFIG,
168
- parentCollectionName: "parent",
169
- pages: [],
170
- formData: {},
171
- masterPage: {
172
- childPages: []
173
- }
174
- }));
175
- const {
176
- headerContentDiv
177
- } = checkSetup(container);
178
- const headerTitle = headerContentDiv.children[0];
162
+ var _renderWithValidation4 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
163
+ id: ID,
164
+ entryData: ENTRY,
165
+ config: CONFIG,
166
+ parentCollectionName: "parent",
167
+ pages: [],
168
+ formData: {},
169
+ masterPage: {
170
+ childPages: []
171
+ }
172
+ })),
173
+ container = _renderWithValidation4.container;
174
+ var _checkSetup4 = checkSetup(container),
175
+ headerContentDiv = _checkSetup4.headerContentDiv;
176
+ var headerTitle = headerContentDiv.children[0];
179
177
  expect(headerTitle.tagName).toEqual('DIV');
180
178
  expect(headerTitle.classList).toContain(classes('header-content-title'));
181
179
  expect(headerTitle.textContent).toEqual("".concat(ENTRY.titleText, " that is interpolated"));
182
180
  });
183
- it('should correctly interpolate the details', () => {
184
- const CONFIG = {
181
+ it('should correctly interpolate the details', function () {
182
+ var CONFIG = {
185
183
  title: 'Title',
186
184
  // eslint-disable-next-line no-template-curly-in-string
187
185
  details: '${detailsText} that are interpolated'
188
186
  };
189
- const {
190
- container
191
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
192
- id: ID,
193
- entryData: ENTRY,
194
- config: CONFIG,
195
- parentCollectionName: "parent",
196
- pages: [],
197
- formData: {},
198
- masterPage: {
199
- childPages: []
200
- }
201
- }));
202
- const {
203
- headerContentDiv
204
- } = checkSetup(container);
205
- const headerDetails = headerContentDiv.children[1];
187
+ var _renderWithValidation5 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
188
+ id: ID,
189
+ entryData: ENTRY,
190
+ config: CONFIG,
191
+ parentCollectionName: "parent",
192
+ pages: [],
193
+ formData: {},
194
+ masterPage: {
195
+ childPages: []
196
+ }
197
+ })),
198
+ container = _renderWithValidation5.container;
199
+ var _checkSetup5 = checkSetup(container),
200
+ headerContentDiv = _checkSetup5.headerContentDiv;
201
+ var headerDetails = headerContentDiv.children[1];
206
202
  expect(headerDetails.tagName).toEqual('DIV');
207
203
  expect(headerDetails.classList).toContain(classes('header-content-detail'));
208
204
  expect(headerDetails.textContent).toEqual("".concat(ENTRY.detailsText, " that are interpolated"));
209
205
  });
210
- describe('Change action button', () => {
211
- let isDuplicatedValue = true;
212
- let onChangeArgs = [];
213
- let onChangeCalls = 0;
214
- const ON_CHANGE = (page, id) => {
206
+ describe('Change action button', function () {
207
+ var inErrorValue = true;
208
+ var onChangeArgs = [];
209
+ var onChangeCalls = 0;
210
+ var ON_CHANGE = function ON_CHANGE(page, id) {
215
211
  onChangeArgs.push({
216
- page,
217
- id
212
+ page: page,
213
+ id: id
218
214
  });
219
215
  onChangeCalls += 1;
220
- isDuplicatedValue = false;
216
+ inErrorValue = false;
221
217
  };
222
- beforeEach(() => {
218
+ beforeEach(function () {
223
219
  onChangeArgs = [];
224
220
  onChangeCalls = 0;
225
221
  });
226
- it('should render correctly', () => {
227
- const CONFIG = {
222
+ it('should render correctly', function () {
223
+ var CONFIG = {
228
224
  changeAction: {
229
225
  label: 'Change label',
230
226
  page: 'testPage'
231
227
  }
232
228
  };
233
- const {
234
- container
235
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
236
- id: ID,
237
- entryData: ENTRY,
238
- config: CONFIG,
239
- onChange: ON_CHANGE,
240
- parentCollectionName: "parent",
241
- pages: [],
242
- formData: {},
243
- masterPage: {
244
- childPages: []
245
- }
246
- }));
247
- const {
248
- headerActionDiv
249
- } = checkSetup(container);
229
+ var _renderWithValidation6 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
230
+ id: ID,
231
+ entryData: ENTRY,
232
+ config: CONFIG,
233
+ onChange: ON_CHANGE,
234
+ parentCollectionName: "parent",
235
+ pages: [],
236
+ formData: {},
237
+ masterPage: {
238
+ childPages: []
239
+ }
240
+ })),
241
+ container = _renderWithValidation6.container;
242
+ var _checkSetup6 = checkSetup(container),
243
+ headerActionDiv = _checkSetup6.headerActionDiv;
250
244
  expect(headerActionDiv.children.length).toEqual(1);
251
- const changeButton = headerActionDiv.children[0];
245
+ var changeButton = headerActionDiv.children[0];
252
246
  expect(changeButton.tagName).toEqual('BUTTON');
253
247
  expect(changeButton.textContent).toEqual(CONFIG.changeAction.label);
254
248
  _react.fireEvent.click(changeButton, {});
@@ -258,33 +252,31 @@ describe('components.CollectionSummary.SummaryCard', () => {
258
252
  id: ENTRY.id
259
253
  });
260
254
  });
261
- it('should render correctly when isDuplicated is true', () => {
262
- const CONFIG = {
255
+ it('should render correctly when inError is true', function () {
256
+ var CONFIG = {
263
257
  changeAction: {
264
258
  label: 'Change label',
265
259
  page: 'testPage'
266
260
  }
267
261
  };
268
- const {
269
- container
270
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
271
- id: ID,
272
- entryData: ENTRY,
273
- config: CONFIG,
274
- onChange: ON_CHANGE,
275
- parentCollectionName: "parent",
276
- pages: [],
277
- formData: {},
278
- masterPage: {
279
- childPages: []
280
- },
281
- isDuplicated: isDuplicatedValue
282
- }));
283
- const {
284
- headerActionDiv
285
- } = checkSetup(container);
262
+ var _renderWithValidation7 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
263
+ id: ID,
264
+ entryData: ENTRY,
265
+ config: CONFIG,
266
+ onChange: ON_CHANGE,
267
+ parentCollectionName: "parent",
268
+ pages: [],
269
+ formData: {},
270
+ masterPage: {
271
+ childPages: []
272
+ },
273
+ inError: inErrorValue
274
+ })),
275
+ container = _renderWithValidation7.container;
276
+ var _checkSetup7 = checkSetup(container),
277
+ headerActionDiv = _checkSetup7.headerActionDiv;
286
278
  expect(headerActionDiv.children.length).toEqual(1);
287
- const changeButton = headerActionDiv.children[0];
279
+ var changeButton = headerActionDiv.children[0];
288
280
  expect(changeButton.tagName).toEqual('BUTTON');
289
281
  expect(changeButton.textContent).toEqual(CONFIG.changeAction.label);
290
282
  _react.fireEvent.click(changeButton, {});
@@ -294,341 +286,318 @@ describe('components.CollectionSummary.SummaryCard', () => {
294
286
  id: ENTRY.id
295
287
  });
296
288
 
297
- // Check that the isDuplicated prop is now false
298
- expect(isDuplicatedValue).toBe(false);
289
+ // Check that the inError prop is now false
290
+ expect(inErrorValue).toBe(false);
299
291
  });
300
- it('should use the default label when one is not provided', () => {
301
- const CONFIG = {
292
+ it('should use the default label when one is not provided', function () {
293
+ var CONFIG = {
302
294
  changeAction: {
303
295
  page: 'testPage'
304
296
  }
305
297
  };
306
- const {
307
- container
308
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
309
- id: ID,
310
- entryData: ENTRY,
311
- config: CONFIG,
312
- onChange: ON_CHANGE,
313
- parentCollectionName: "parent",
314
- pages: [],
315
- formData: {},
316
- masterPage: {
317
- childPages: []
318
- }
319
- }));
320
- const {
321
- headerActionDiv
322
- } = checkSetup(container);
298
+ var _renderWithValidation8 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
299
+ id: ID,
300
+ entryData: ENTRY,
301
+ config: CONFIG,
302
+ onChange: ON_CHANGE,
303
+ parentCollectionName: "parent",
304
+ pages: [],
305
+ formData: {},
306
+ masterPage: {
307
+ childPages: []
308
+ }
309
+ })),
310
+ container = _renderWithValidation8.container;
311
+ var _checkSetup8 = checkSetup(container),
312
+ headerActionDiv = _checkSetup8.headerActionDiv;
323
313
  expect(headerActionDiv.children.length).toEqual(1);
324
- const changeButton = headerActionDiv.children[0];
314
+ var changeButton = headerActionDiv.children[0];
325
315
  expect(changeButton.tagName).toEqual('BUTTON');
326
316
  expect(changeButton.textContent).toEqual(_SummaryCard.DEFAULT_CHANGE_BUTTON_LABEL);
327
317
  });
328
- it('should not render when no config is provided for it', () => {
329
- const {
330
- container
331
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
332
- id: ID,
333
- entryData: ENTRY,
334
- config: {},
335
- onChange: ON_CHANGE,
336
- parentCollectionName: "parent",
337
- pages: [],
338
- formData: {},
339
- masterPage: {
340
- childPages: []
341
- }
342
- }));
343
- const {
344
- headerActionDiv
345
- } = checkSetup(container);
318
+ it('should not render when no config is provided for it', function () {
319
+ var _renderWithValidation9 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
320
+ id: ID,
321
+ entryData: ENTRY,
322
+ config: {},
323
+ onChange: ON_CHANGE,
324
+ parentCollectionName: "parent",
325
+ pages: [],
326
+ formData: {},
327
+ masterPage: {
328
+ childPages: []
329
+ }
330
+ })),
331
+ container = _renderWithValidation9.container;
332
+ var _checkSetup9 = checkSetup(container),
333
+ headerActionDiv = _checkSetup9.headerActionDiv;
346
334
  expect(headerActionDiv.children.length).toEqual(0);
347
335
  });
348
- it('should not render when onChange is not supplied', () => {
349
- const CONFIG = {
336
+ it('should not render when onChange is not supplied', function () {
337
+ var CONFIG = {
350
338
  changeAction: {
351
339
  label: 'Change label',
352
340
  page: 'testPage'
353
341
  }
354
342
  };
355
- const {
356
- container
357
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
358
- id: ID,
359
- entryData: ENTRY,
360
- config: CONFIG,
361
- parentCollectionName: "parent",
362
- pages: [],
363
- formData: {},
364
- masterPage: {
365
- childPages: []
366
- }
367
- }));
368
- const {
369
- headerActionDiv
370
- } = checkSetup(container);
343
+ var _renderWithValidation10 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
344
+ id: ID,
345
+ entryData: ENTRY,
346
+ config: CONFIG,
347
+ parentCollectionName: "parent",
348
+ pages: [],
349
+ formData: {},
350
+ masterPage: {
351
+ childPages: []
352
+ }
353
+ })),
354
+ container = _renderWithValidation10.container;
355
+ var _checkSetup10 = checkSetup(container),
356
+ headerActionDiv = _checkSetup10.headerActionDiv;
371
357
  expect(headerActionDiv.children.length).toEqual(0);
372
358
  });
373
359
  });
374
- describe('Delete action button', () => {
375
- let onDeleteArgs = [];
376
- let onDeleteCalls = 0;
377
- const ON_DELETE = entry => {
360
+ describe('Delete action button', function () {
361
+ var onDeleteArgs = [];
362
+ var onDeleteCalls = 0;
363
+ var ON_DELETE = function ON_DELETE(entry) {
378
364
  onDeleteArgs.push(entry);
379
365
  onDeleteCalls += 1;
380
366
  };
381
- beforeEach(() => {
367
+ beforeEach(function () {
382
368
  onDeleteArgs = [];
383
369
  onDeleteCalls = 0;
384
370
  });
385
- it('should render correctly', () => {
386
- const CONFIG = {
371
+ it('should render correctly', function () {
372
+ var CONFIG = {
387
373
  deleteAction: {
388
374
  label: 'Delete label'
389
375
  }
390
376
  };
391
- const {
392
- container
393
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
394
- id: ID,
395
- entryData: ENTRY,
396
- config: CONFIG,
397
- onDelete: ON_DELETE,
398
- parentCollectionName: "parent",
399
- pages: [],
400
- formData: {},
401
- masterPage: {
402
- childPages: []
403
- }
404
- }));
405
- const {
406
- headerActionDiv
407
- } = checkSetup(container);
377
+ var _renderWithValidation11 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
378
+ id: ID,
379
+ entryData: ENTRY,
380
+ config: CONFIG,
381
+ onDelete: ON_DELETE,
382
+ parentCollectionName: "parent",
383
+ pages: [],
384
+ formData: {},
385
+ masterPage: {
386
+ childPages: []
387
+ }
388
+ })),
389
+ container = _renderWithValidation11.container;
390
+ var _checkSetup11 = checkSetup(container),
391
+ headerActionDiv = _checkSetup11.headerActionDiv;
408
392
  expect(headerActionDiv.children.length).toEqual(1);
409
- const deleteButton = headerActionDiv.children[0];
393
+ var deleteButton = headerActionDiv.children[0];
410
394
  expect(deleteButton.tagName).toEqual('BUTTON');
411
395
  expect(deleteButton.textContent).toEqual(CONFIG.deleteAction.label);
412
396
  _react.fireEvent.click(deleteButton, {});
413
397
  expect(onDeleteCalls).toEqual(1);
414
398
  expect(onDeleteArgs[0]).toMatchObject(ENTRY);
415
399
  });
416
- it('should use the default label when one is not provided', () => {
417
- const CONFIG = {
400
+ it('should use the default label when one is not provided', function () {
401
+ var CONFIG = {
418
402
  deleteAction: {}
419
403
  };
420
- const {
421
- container
422
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
423
- id: ID,
424
- entryData: ENTRY,
425
- config: CONFIG,
426
- onDelete: ON_DELETE,
427
- parentCollectionName: "parent",
428
- pages: [],
429
- formData: {},
430
- masterPage: {
431
- childPages: []
432
- }
433
- }));
434
- const {
435
- headerActionDiv
436
- } = checkSetup(container);
404
+ var _renderWithValidation12 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
405
+ id: ID,
406
+ entryData: ENTRY,
407
+ config: CONFIG,
408
+ onDelete: ON_DELETE,
409
+ parentCollectionName: "parent",
410
+ pages: [],
411
+ formData: {},
412
+ masterPage: {
413
+ childPages: []
414
+ }
415
+ })),
416
+ container = _renderWithValidation12.container;
417
+ var _checkSetup12 = checkSetup(container),
418
+ headerActionDiv = _checkSetup12.headerActionDiv;
437
419
  expect(headerActionDiv.children.length).toEqual(1);
438
- const deleteButton = headerActionDiv.children[0];
420
+ var deleteButton = headerActionDiv.children[0];
439
421
  expect(deleteButton.tagName).toEqual('BUTTON');
440
422
  expect(deleteButton.textContent).toEqual(_SummaryCard.DEFAULT_DELETE_BUTTON_LABEL);
441
423
  });
442
- it('should not render when no config is provided for it', () => {
443
- const {
444
- container
445
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
446
- id: ID,
447
- entryData: ENTRY,
448
- config: {},
449
- onDelete: ON_DELETE,
450
- parentCollectionName: "parent",
451
- pages: [],
452
- formData: {},
453
- masterPage: {
454
- childPages: []
455
- }
456
- }));
457
- const {
458
- headerActionDiv
459
- } = checkSetup(container);
424
+ it('should not render when no config is provided for it', function () {
425
+ var _renderWithValidation13 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
426
+ id: ID,
427
+ entryData: ENTRY,
428
+ config: {},
429
+ onDelete: ON_DELETE,
430
+ parentCollectionName: "parent",
431
+ pages: [],
432
+ formData: {},
433
+ masterPage: {
434
+ childPages: []
435
+ }
436
+ })),
437
+ container = _renderWithValidation13.container;
438
+ var _checkSetup13 = checkSetup(container),
439
+ headerActionDiv = _checkSetup13.headerActionDiv;
460
440
  expect(headerActionDiv.children.length).toEqual(0);
461
441
  });
462
- it('should not render when onDelete is not supplied', () => {
463
- const CONFIG = {
442
+ it('should not render when onDelete is not supplied', function () {
443
+ var CONFIG = {
464
444
  deleteAction: {
465
445
  label: 'Delete label'
466
446
  }
467
447
  };
468
- const {
469
- container
470
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
471
- id: ID,
472
- entryData: ENTRY,
473
- config: CONFIG,
474
- parentCollectionName: "parent",
475
- pages: [],
476
- formData: {},
477
- masterPage: {
478
- childPages: []
479
- }
480
- }));
481
- const {
482
- headerActionDiv
483
- } = checkSetup(container);
448
+ var _renderWithValidation14 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
449
+ id: ID,
450
+ entryData: ENTRY,
451
+ config: CONFIG,
452
+ parentCollectionName: "parent",
453
+ pages: [],
454
+ formData: {},
455
+ masterPage: {
456
+ childPages: []
457
+ }
458
+ })),
459
+ container = _renderWithValidation14.container;
460
+ var _checkSetup14 = checkSetup(container),
461
+ headerActionDiv = _checkSetup14.headerActionDiv;
484
462
  expect(headerActionDiv.children.length).toEqual(0);
485
463
  });
486
- it('should correctly render the Details section with entry data', () => {
487
- const CONFIG = {
464
+ it('should correctly render the Details section with entry data', function () {
465
+ var CONFIG = {
488
466
  deleteAction: {
489
467
  label: 'Delete label'
490
468
  }
491
469
  };
492
- const {
493
- container
494
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
495
- id: ID,
496
- entryData: ENTRY,
497
- config: CONFIG,
498
- parentCollectionName: "parent",
499
- pages: [],
500
- formData: {},
501
- masterPage: {
502
- childPages: []
503
- }
504
- }));
505
- const detailsSection = container.querySelector('.details');
470
+ var _renderWithValidation15 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
471
+ id: ID,
472
+ entryData: ENTRY,
473
+ config: CONFIG,
474
+ parentCollectionName: "parent",
475
+ pages: [],
476
+ formData: {},
477
+ masterPage: {
478
+ childPages: []
479
+ }
480
+ })),
481
+ container = _renderWithValidation15.container;
482
+ var detailsSection = container.querySelector('.details');
506
483
  expect(detailsSection).not.toBeNull();
507
484
  expect(detailsSection.textContent).toContain(ENTRY.summaryText);
508
485
  });
509
486
  });
510
- describe('Duplicate action button', () => {
511
- let onDuplicateArgs = [];
512
- let onDuplicateCalls = 0;
513
- const ON_DUPLICATE = entry => {
487
+ describe('Duplicate action button', function () {
488
+ var onDuplicateArgs = [];
489
+ var onDuplicateCalls = 0;
490
+ var ON_DUPLICATE = function ON_DUPLICATE(entry) {
514
491
  onDuplicateArgs.push(entry);
515
492
  onDuplicateCalls += 1;
516
493
  };
517
- beforeEach(() => {
494
+ beforeEach(function () {
518
495
  onDuplicateArgs = [];
519
496
  onDuplicateCalls = 0;
520
497
  });
521
- it('should render correctly', () => {
522
- const CONFIG = {
498
+ it('should render correctly', function () {
499
+ var CONFIG = {
523
500
  duplicateAction: {
524
501
  label: 'Duplicate label'
525
502
  }
526
503
  };
527
- const {
528
- container
529
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
530
- id: ID,
531
- entryData: ENTRY,
532
- config: CONFIG,
533
- onDuplicate: ON_DUPLICATE,
534
- parentCollectionName: "parent",
535
- pages: [],
536
- formData: {},
537
- masterPage: {
538
- childPages: []
539
- }
540
- }));
541
- const {
542
- headerActionDiv
543
- } = checkSetup(container);
504
+ var _renderWithValidation16 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
505
+ id: ID,
506
+ entryData: ENTRY,
507
+ config: CONFIG,
508
+ onDuplicate: ON_DUPLICATE,
509
+ parentCollectionName: "parent",
510
+ pages: [],
511
+ formData: {},
512
+ masterPage: {
513
+ childPages: []
514
+ }
515
+ })),
516
+ container = _renderWithValidation16.container;
517
+ var _checkSetup15 = checkSetup(container),
518
+ headerActionDiv = _checkSetup15.headerActionDiv;
544
519
  expect(headerActionDiv.children.length).toEqual(1);
545
- const duplicateButton = headerActionDiv.children[0];
520
+ var duplicateButton = headerActionDiv.children[0];
546
521
  expect(duplicateButton.tagName).toEqual('BUTTON');
547
522
  expect(duplicateButton.textContent).toEqual(CONFIG.duplicateAction.label);
548
523
  _react.fireEvent.click(duplicateButton, {});
549
524
  expect(onDuplicateCalls).toEqual(1);
550
525
  expect(onDuplicateArgs[0]).toMatchObject(ENTRY);
551
526
  });
552
- it('should use the default label when one is not provided', () => {
553
- const CONFIG = {
527
+ it('should use the default label when one is not provided', function () {
528
+ var CONFIG = {
554
529
  duplicateAction: {}
555
530
  };
556
- const {
557
- container
558
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
559
- id: ID,
560
- entryData: ENTRY,
561
- config: CONFIG,
562
- onDuplicate: ON_DUPLICATE,
563
- parentCollectionName: "parent",
564
- pages: [],
565
- formData: {},
566
- masterPage: {
567
- childPages: []
568
- }
569
- }));
570
- const {
571
- headerActionDiv
572
- } = checkSetup(container);
531
+ var _renderWithValidation17 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
532
+ id: ID,
533
+ entryData: ENTRY,
534
+ config: CONFIG,
535
+ onDuplicate: ON_DUPLICATE,
536
+ parentCollectionName: "parent",
537
+ pages: [],
538
+ formData: {},
539
+ masterPage: {
540
+ childPages: []
541
+ }
542
+ })),
543
+ container = _renderWithValidation17.container;
544
+ var _checkSetup16 = checkSetup(container),
545
+ headerActionDiv = _checkSetup16.headerActionDiv;
573
546
  expect(headerActionDiv.children.length).toEqual(1);
574
- const duplicateButton = headerActionDiv.children[0];
547
+ var duplicateButton = headerActionDiv.children[0];
575
548
  expect(duplicateButton.tagName).toEqual('BUTTON');
576
549
  expect(duplicateButton.textContent).toEqual(_SummaryCard.DEFAULT_DUPLICATE_BUTTON_LABEL);
577
550
  });
578
- it('should not render when no config is provided for it', () => {
579
- const {
580
- container
581
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
582
- id: ID,
583
- entryData: ENTRY,
584
- config: {},
585
- onDuplicate: ON_DUPLICATE,
586
- parentCollectionName: "parent",
587
- pages: [],
588
- formData: {},
589
- masterPage: {
590
- childPages: []
591
- }
592
- }));
593
- const {
594
- headerActionDiv
595
- } = checkSetup(container);
551
+ it('should not render when no config is provided for it', function () {
552
+ var _renderWithValidation18 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
553
+ id: ID,
554
+ entryData: ENTRY,
555
+ config: {},
556
+ onDuplicate: ON_DUPLICATE,
557
+ parentCollectionName: "parent",
558
+ pages: [],
559
+ formData: {},
560
+ masterPage: {
561
+ childPages: []
562
+ }
563
+ })),
564
+ container = _renderWithValidation18.container;
565
+ var _checkSetup17 = checkSetup(container),
566
+ headerActionDiv = _checkSetup17.headerActionDiv;
596
567
  expect(headerActionDiv.children.length).toEqual(0);
597
568
  });
598
- it('should not render when onDuplicate is not supplied', () => {
599
- const CONFIG = {
569
+ it('should not render when onDuplicate is not supplied', function () {
570
+ var CONFIG = {
600
571
  duplicateAction: {
601
572
  label: 'Duplicate label'
602
573
  }
603
574
  };
604
- const {
605
- container
606
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
607
- id: ID,
608
- entryData: ENTRY,
609
- config: CONFIG,
610
- parentCollectionName: "parent",
611
- pages: [],
612
- formData: {},
613
- masterPage: {
614
- childPages: []
615
- }
616
- }));
617
- const {
618
- headerActionDiv
619
- } = checkSetup(container);
575
+ var _renderWithValidation19 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
576
+ id: ID,
577
+ entryData: ENTRY,
578
+ config: CONFIG,
579
+ parentCollectionName: "parent",
580
+ pages: [],
581
+ formData: {},
582
+ masterPage: {
583
+ childPages: []
584
+ }
585
+ })),
586
+ container = _renderWithValidation19.container;
587
+ var _checkSetup18 = checkSetup(container),
588
+ headerActionDiv = _checkSetup18.headerActionDiv;
620
589
  expect(headerActionDiv.children.length).toEqual(0);
621
590
  });
622
591
  });
623
- describe('Quick Edit action button', () => {
624
- const CONFIG = {
592
+ describe('Quick Edit action button', function () {
593
+ var CONFIG = {
625
594
  quickEdit: {
626
595
  components: [{
627
596
  use: 'testText'
628
597
  }]
629
598
  }
630
599
  };
631
- const PAGES = [{
600
+ var PAGES = [{
632
601
  id: 'parentPage',
633
602
  name: 'parentPage',
634
603
  components: [{
@@ -650,28 +619,26 @@ describe('components.CollectionSummary.SummaryCard', () => {
650
619
  }]
651
620
  }
652
621
  }];
653
- it('should render correctly', () => {
654
- const {
655
- container
656
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
657
- id: ID,
658
- entryData: ENTRY,
659
- config: CONFIG,
660
- pages: PAGES,
661
- parentCollectionName: "parent",
662
- formData: {},
663
- masterPage: {
664
- childPages: []
665
- },
666
- isDuplicated: true
667
- }));
668
- const {
669
- headerActionDiv
670
- } = checkSetup(container);
622
+ it('should render correctly', function () {
623
+ var _renderWithValidation20 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
624
+ id: ID,
625
+ entryData: ENTRY,
626
+ config: CONFIG,
627
+ pages: PAGES,
628
+ parentCollectionName: "parent",
629
+ formData: {},
630
+ masterPage: {
631
+ childPages: []
632
+ },
633
+ inError: true
634
+ })),
635
+ container = _renderWithValidation20.container;
636
+ var _checkSetup19 = checkSetup(container),
637
+ headerActionDiv = _checkSetup19.headerActionDiv;
671
638
  expect(headerActionDiv.children.length).toEqual(1);
672
639
 
673
640
  // Shows edit button but no quick edit
674
- const editButton = headerActionDiv.children[0];
641
+ var editButton = headerActionDiv.children[0];
675
642
  expect(editButton.tagName).toEqual('BUTTON');
676
643
  expect(editButton.textContent).toEqual('Quick Edit');
677
644
  expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
@@ -679,13 +646,13 @@ describe('components.CollectionSummary.SummaryCard', () => {
679
646
  // shows quickedit once clicked
680
647
  _react.fireEvent.click(editButton, {});
681
648
  expect(container.childNodes[0].childNodes.length).toEqual(3); // Quick edit shown
682
- const quickEdit = container.childNodes[0].childNodes[1];
649
+ var quickEdit = container.childNodes[0].childNodes[1];
683
650
  expect(quickEdit.textContent).toContain('Test text');
684
651
 
685
652
  // quick edit has proper buttons
686
- const quickEditButtons = quickEdit.childNodes[2];
687
- const saveButton = quickEditButtons.childNodes[0];
688
- const cancelButton = quickEditButtons.childNodes[1];
653
+ var quickEditButtons = quickEdit.childNodes[2];
654
+ var saveButton = quickEditButtons.childNodes[0];
655
+ var cancelButton = quickEditButtons.childNodes[1];
689
656
  expect(saveButton.textContent).toContain('Save');
690
657
  expect(cancelButton.textContent).toContain('Cancel');
691
658
 
@@ -694,40 +661,38 @@ describe('components.CollectionSummary.SummaryCard', () => {
694
661
  expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
695
662
  });
696
663
 
697
- it('should not render when no config is provided for it', () => {
698
- const {
699
- container
700
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
701
- id: ID,
702
- entryData: ENTRY,
703
- config: {},
704
- parentCollectionName: "parent",
705
- pages: [],
706
- formData: {},
707
- masterPage: {
708
- childPages: []
709
- },
710
- isDuplicated: true
711
- }));
712
- const {
713
- headerActionDiv
714
- } = checkSetup(container);
664
+ it('should not render when no config is provided for it', function () {
665
+ var _renderWithValidation21 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
666
+ id: ID,
667
+ entryData: ENTRY,
668
+ config: {},
669
+ parentCollectionName: "parent",
670
+ pages: [],
671
+ formData: {},
672
+ masterPage: {
673
+ childPages: []
674
+ },
675
+ inError: true
676
+ })),
677
+ container = _renderWithValidation21.container;
678
+ var _checkSetup20 = checkSetup(container),
679
+ headerActionDiv = _checkSetup20.headerActionDiv;
715
680
  expect(headerActionDiv.children.length).toEqual(0);
716
681
  });
717
682
  });
718
- describe('Quick Edit errors', () => {
719
- const CUSTOM_ENTRY = {
683
+ describe('Quick Edit errors', function () {
684
+ var CUSTOM_ENTRY = {
720
685
  id: '123',
721
686
  testText: 'value'
722
687
  };
723
- const CONFIG = {
688
+ var CONFIG = {
724
689
  quickEdit: {
725
690
  components: [{
726
691
  use: 'testText'
727
692
  }]
728
693
  }
729
694
  };
730
- const PAGES = [{
695
+ var PAGES = [{
731
696
  id: 'parentPage',
732
697
  name: 'parentPage',
733
698
  components: [{
@@ -751,36 +716,34 @@ describe('components.CollectionSummary.SummaryCard', () => {
751
716
  }]
752
717
  }
753
718
  }];
754
- it('should initally show errors passed in from top-level', () => {
755
- const TOP_LEVEL_ERRORS = [{
719
+ it('should initally show errors passed in from top-level', function () {
720
+ var TOP_LEVEL_ERRORS = [{
756
721
  id: 'testText',
757
722
  entryId: '123',
758
723
  error: 'top-level error message'
759
724
  }];
760
- const {
761
- container
762
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCardValidationContext.default, {
763
- entryId: CUSTOM_ENTRY.id,
764
- topLevelErrors: TOP_LEVEL_ERRORS
765
- }, /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
766
- id: ID,
767
- entryData: CUSTOM_ENTRY,
768
- config: CONFIG,
769
- pages: PAGES,
770
- parentCollectionName: "parent",
771
- formData: {},
772
- masterPage: {
773
- childPages: []
774
- },
775
- isDuplicated: true
776
- })));
777
- const {
778
- headerActionDiv
779
- } = checkSetup(container);
725
+ var _renderWithValidation22 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCardValidationContext.default, {
726
+ entryId: CUSTOM_ENTRY.id,
727
+ topLevelErrors: TOP_LEVEL_ERRORS
728
+ }, /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
729
+ id: ID,
730
+ entryData: CUSTOM_ENTRY,
731
+ config: CONFIG,
732
+ pages: PAGES,
733
+ parentCollectionName: "parent",
734
+ formData: {},
735
+ masterPage: {
736
+ childPages: []
737
+ },
738
+ inError: true
739
+ }))),
740
+ container = _renderWithValidation22.container;
741
+ var _checkSetup21 = checkSetup(container),
742
+ headerActionDiv = _checkSetup21.headerActionDiv;
780
743
  expect(headerActionDiv.children.length).toEqual(1);
781
744
 
782
745
  // Shows edit button but no quick edit
783
- const editButton = headerActionDiv.children[0];
746
+ var editButton = headerActionDiv.children[0];
784
747
  expect(editButton.tagName).toEqual('BUTTON');
785
748
  expect(editButton.textContent).toEqual('Quick Edit');
786
749
  expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
@@ -788,91 +751,114 @@ describe('components.CollectionSummary.SummaryCard', () => {
788
751
  // shows quickedit once clicked
789
752
  _react.fireEvent.click(editButton, {});
790
753
  expect(container.childNodes[0].childNodes.length).toEqual(3); // Quick edit shown
791
- const quickEdit = container.childNodes[0].childNodes[1];
754
+ var quickEdit = container.childNodes[0].childNodes[1];
792
755
  expect(quickEdit.textContent).toContain('Test text');
793
756
 
794
757
  // quick edit is showing top-level error
795
- const errorSummary = quickEdit.childNodes[0];
758
+ var errorSummary = quickEdit.childNodes[0];
796
759
  expect(errorSummary.textContent).toContain(TOP_LEVEL_ERRORS[0].error);
797
760
  });
798
- it('should only show errors from validation when it happens, ignoring top-level errors', async () => {
799
- const TOP_LEVEL_ERRORS = [{
800
- id: 'testText',
801
- entryId: '123',
802
- error: 'top-level error message'
803
- }];
804
- const {
805
- container
806
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCardValidationContext.default, {
807
- entryId: CUSTOM_ENTRY.id,
808
- topLevelErrors: TOP_LEVEL_ERRORS
809
- }, /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
810
- id: ID,
811
- entryData: CUSTOM_ENTRY,
812
- config: CONFIG,
813
- pages: PAGES,
814
- parentCollectionName: "parent",
815
- formData: {},
816
- masterPage: {
817
- childPages: []
818
- },
819
- onQuickEdit: () => {},
820
- isDuplicated: true
821
- })));
822
- const {
823
- headerActionDiv
824
- } = checkSetup(container);
825
- expect(headerActionDiv.children.length).toEqual(1);
761
+ it('should only show errors from validation when it happens, ignoring top-level errors', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
762
+ var TOP_LEVEL_ERRORS, _renderWithValidation23, container, _checkSetup22, headerActionDiv, editButton, quickEdit, errorSummary, component, componentInput, quickEditButtons, saveButton;
763
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
764
+ while (1) switch (_context3.prev = _context3.next) {
765
+ case 0:
766
+ TOP_LEVEL_ERRORS = [{
767
+ id: 'testText',
768
+ entryId: '123',
769
+ error: 'top-level error message'
770
+ }];
771
+ _renderWithValidation23 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCardValidationContext.default, {
772
+ entryId: CUSTOM_ENTRY.id,
773
+ topLevelErrors: TOP_LEVEL_ERRORS
774
+ }, /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
775
+ id: ID,
776
+ entryData: CUSTOM_ENTRY,
777
+ config: CONFIG,
778
+ pages: PAGES,
779
+ parentCollectionName: "parent",
780
+ formData: {},
781
+ masterPage: {
782
+ childPages: []
783
+ },
784
+ onQuickEdit: function onQuickEdit() {},
785
+ inError: true
786
+ }))), container = _renderWithValidation23.container;
787
+ _checkSetup22 = checkSetup(container), headerActionDiv = _checkSetup22.headerActionDiv;
788
+ expect(headerActionDiv.children.length).toEqual(1);
826
789
 
827
- // Shows edit button but no quick edit
828
- const editButton = headerActionDiv.children[0];
829
- expect(editButton.tagName).toEqual('BUTTON');
830
- expect(editButton.textContent).toEqual('Quick Edit');
831
- expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
790
+ // Shows edit button but no quick edit
791
+ editButton = headerActionDiv.children[0];
792
+ expect(editButton.tagName).toEqual('BUTTON');
793
+ expect(editButton.textContent).toEqual('Quick Edit');
794
+ expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
832
795
 
833
- // shows quickedit once clicked
834
- _react.fireEvent.click(editButton, {});
835
- expect(container.childNodes[0].childNodes.length).toEqual(3); // Quick edit shown
836
- const quickEdit = container.childNodes[0].childNodes[1];
837
- expect(quickEdit.textContent).toContain('Test text');
796
+ // shows quickedit once clicked
797
+ _react.fireEvent.click(editButton, {});
798
+ expect(container.childNodes[0].childNodes.length).toEqual(3); // Quick edit shown
799
+ quickEdit = container.childNodes[0].childNodes[1];
800
+ expect(quickEdit.textContent).toContain('Test text');
838
801
 
839
- // quick edit is initially showing top-level error
840
- const errorSummary = quickEdit.childNodes[0];
841
- expect(errorSummary.textContent).toContain(TOP_LEVEL_ERRORS[0].error);
802
+ // quick edit is initially showing top-level error
803
+ errorSummary = quickEdit.childNodes[0];
804
+ expect(errorSummary.textContent).toContain(TOP_LEVEL_ERRORS[0].error);
842
805
 
843
- // remove value from required text component
844
- const component = quickEdit.childNodes[2];
845
- const componentInput = component.childNodes[3];
846
- await (0, _testUtils.act)(async () => {
847
- _react.fireEvent.change(componentInput, {
848
- target: {
849
- value: ''
850
- }
851
- });
852
- });
853
-
854
- // click 'save' to trigger validation, which will fail as the component
855
- // cleared above is marked as 'required'.
856
- const quickEditButtons = quickEdit.childNodes[3];
857
- const saveButton = quickEditButtons.childNodes[0];
858
- expect(saveButton.textContent).toContain('Save');
859
- await (0, _testUtils.act)(async () => {
860
- _react.fireEvent.click(saveButton, {});
861
- });
862
-
863
- // quick edit should now be showing the errors from validation
864
- expect(errorSummary.textContent).toContain('Custom error message');
865
- });
806
+ // remove value from required text component
807
+ component = quickEdit.childNodes[2];
808
+ componentInput = component.childNodes[3];
809
+ _context3.next = 18;
810
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
811
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
812
+ while (1) switch (_context.prev = _context.next) {
813
+ case 0:
814
+ _react.fireEvent.change(componentInput, {
815
+ target: {
816
+ value: ''
817
+ }
818
+ });
819
+ case 1:
820
+ case "end":
821
+ return _context.stop();
822
+ }
823
+ }, _callee);
824
+ })));
825
+ case 18:
826
+ // click 'save' to trigger validation, which will fail as the component
827
+ // cleared above is marked as 'required'.
828
+ quickEditButtons = quickEdit.childNodes[3];
829
+ saveButton = quickEditButtons.childNodes[0];
830
+ expect(saveButton.textContent).toContain('Save');
831
+ _context3.next = 23;
832
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
833
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
834
+ while (1) switch (_context2.prev = _context2.next) {
835
+ case 0:
836
+ _react.fireEvent.click(saveButton, {});
837
+ case 1:
838
+ case "end":
839
+ return _context2.stop();
840
+ }
841
+ }, _callee2);
842
+ })));
843
+ case 23:
844
+ // quick edit should now be showing the errors from validation
845
+ expect(errorSummary.textContent).toContain('Custom error message');
846
+ case 24:
847
+ case "end":
848
+ return _context3.stop();
849
+ }
850
+ }, _callee3);
851
+ })));
866
852
  });
867
- describe('Quick Edit save changes', () => {
868
- const CONFIG = {
853
+ describe('Quick Edit save changes', function () {
854
+ var CONFIG = {
869
855
  quickEdit: {
870
856
  components: [{
871
857
  use: 'testText'
872
858
  }]
873
859
  }
874
860
  };
875
- const PAGES = [{
861
+ var PAGES = [{
876
862
  id: 'parentPage',
877
863
  name: 'parentPage',
878
864
  components: [{
@@ -899,28 +885,26 @@ describe('components.CollectionSummary.SummaryCard', () => {
899
885
  }]
900
886
  }
901
887
  }];
902
- it('should render correctly', () => {
903
- const {
904
- container
905
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
906
- id: ID,
907
- entryData: ENTRY,
908
- config: CONFIG,
909
- pages: PAGES,
910
- parentCollectionName: "parent",
911
- formData: {},
912
- masterPage: {
913
- childPages: []
914
- },
915
- isDuplicated: true
916
- }));
917
- const {
918
- headerActionDiv
919
- } = checkSetup(container);
888
+ it('should render correctly', function () {
889
+ var _renderWithValidation24 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
890
+ id: ID,
891
+ entryData: ENTRY,
892
+ config: CONFIG,
893
+ pages: PAGES,
894
+ parentCollectionName: "parent",
895
+ formData: {},
896
+ masterPage: {
897
+ childPages: []
898
+ },
899
+ inError: true
900
+ })),
901
+ container = _renderWithValidation24.container;
902
+ var _checkSetup23 = checkSetup(container),
903
+ headerActionDiv = _checkSetup23.headerActionDiv;
920
904
  expect(headerActionDiv.children.length).toEqual(1);
921
905
 
922
906
  // Shows edit button but no quick edit
923
- const editButton = headerActionDiv.children[0];
907
+ var editButton = headerActionDiv.children[0];
924
908
  expect(editButton.tagName).toEqual('BUTTON');
925
909
  expect(editButton.textContent).toEqual('Quick Edit');
926
910
  expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
@@ -928,13 +912,13 @@ describe('components.CollectionSummary.SummaryCard', () => {
928
912
  // shows quickedit once clicked
929
913
  _react.fireEvent.click(editButton, {});
930
914
  expect(container.childNodes[0].childNodes.length).toEqual(3); // Quick edit shown
931
- const quickEdit = container.childNodes[0].childNodes[1];
915
+ var quickEdit = container.childNodes[0].childNodes[1];
932
916
  expect(quickEdit.textContent).toContain('Test text');
933
917
 
934
918
  // quick edit has proper buttons
935
- const quickEditButtons = quickEdit.childNodes[2];
936
- const saveButton = quickEditButtons.childNodes[0];
937
- const cancelButton = quickEditButtons.childNodes[1];
919
+ var quickEditButtons = quickEdit.childNodes[2];
920
+ var saveButton = quickEditButtons.childNodes[0];
921
+ var cancelButton = quickEditButtons.childNodes[1];
938
922
  expect(saveButton.textContent).toContain('Save');
939
923
  expect(cancelButton.textContent).toContain('Cancel');
940
924
 
@@ -943,368 +927,405 @@ describe('components.CollectionSummary.SummaryCard', () => {
943
927
  expect(container.childNodes[0].childNodes.length).toEqual(2); // Quick edit hidden
944
928
  });
945
929
 
946
- it('should not validate or save if nothing has changed', () => {
947
- const ON_SUBMIT_CALLS = [];
948
- const hooks = {
949
- onSubmit: (type, patch) => ON_SUBMIT_CALLS.push(patch)
930
+ it('should not validate or save if nothing has changed', function () {
931
+ var ON_SUBMIT_CALLS = [];
932
+ var hooks = {
933
+ onSubmit: function onSubmit(type, patch) {
934
+ return ON_SUBMIT_CALLS.push(patch);
935
+ }
950
936
  };
951
- const {
952
- container
953
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
954
- id: ID,
955
- entryData: ENTRY,
956
- config: CONFIG,
957
- pages: PAGES,
958
- parentCollectionName: "parents",
959
- formData: {},
960
- masterPage: {
961
- childPages: []
962
- },
963
- isDuplicated: true
964
- }), {
965
- hooks
966
- });
967
- const {
968
- headerActionDiv
969
- } = checkSetup(container);
937
+ var _renderWithValidation25 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
938
+ id: ID,
939
+ entryData: ENTRY,
940
+ config: CONFIG,
941
+ pages: PAGES,
942
+ parentCollectionName: "parents",
943
+ formData: {},
944
+ masterPage: {
945
+ childPages: []
946
+ },
947
+ inError: true
948
+ }), {
949
+ hooks: hooks
950
+ }),
951
+ container = _renderWithValidation25.container;
952
+ var _checkSetup24 = checkSetup(container),
953
+ headerActionDiv = _checkSetup24.headerActionDiv;
970
954
 
971
955
  // Shows edit button but no quick edit
972
- const editButton = headerActionDiv.children[0];
956
+ var editButton = headerActionDiv.children[0];
973
957
 
974
958
  // shows quickedit once clicked
975
959
  _react.fireEvent.click(editButton, {});
976
- const quickEdit = container.childNodes[0].childNodes[1];
977
- const quickEditButtons = quickEdit.childNodes[2];
978
- const saveButton = quickEditButtons.childNodes[0];
960
+ var quickEdit = container.childNodes[0].childNodes[1];
961
+ var quickEditButtons = quickEdit.childNodes[2];
962
+ var saveButton = quickEditButtons.childNodes[0];
979
963
  _react.fireEvent.click(saveButton, {});
980
964
  expect(ON_SUBMIT_CALLS.length).toEqual(0);
981
965
  });
982
- it('should return after local validation if errors are present', async () => {
983
- const ON_SUBMIT_CALLS = [];
984
- const hooks = {
985
- onSubmit: (type, patch) => ON_SUBMIT_CALLS.push(patch)
986
- };
987
- const ON_QUICK_EDIT_CALLS = [];
988
- const ON_QUICK_EDIT = _ref => {
989
- let {
990
- target
991
- } = _ref;
992
- ON_QUICK_EDIT_CALLS.push(target);
993
- };
994
- const {
995
- container
996
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
997
- id: ID,
998
- entryData: {
999
- ...ENTRY,
1000
- index: 0
1001
- },
1002
- config: CONFIG,
1003
- pages: PAGES,
1004
- parentCollectionName: "parents",
1005
- onQuickEdit: ON_QUICK_EDIT,
1006
- formData: {
1007
- parents: [{
1008
- testText: 'hello'
1009
- }]
1010
- },
1011
- masterPage: {
1012
- childPages: []
1013
- },
1014
- isDuplicated: true
1015
- }), {
1016
- hooks
1017
- });
1018
- const {
1019
- headerActionDiv
1020
- } = checkSetup(container);
1021
- const editButton = headerActionDiv.children[0];
1022
- _react.fireEvent.click(editButton, {});
1023
- const quickEdit = container.childNodes[0].childNodes[1];
1024
- const component = quickEdit.childNodes[1];
1025
- const componentInput = component.childNodes[2];
1026
- const quickEditButtons = quickEdit.childNodes[2];
1027
- const saveButton = quickEditButtons.childNodes[0];
1028
- // Field has validation to force the length of this field to be greater than 2 so this should fail
1029
- await (0, _testUtils.act)(async () => {
1030
- _react.fireEvent.change(componentInput, {
1031
- target: {
1032
- value: 'a'
1033
- }
1034
- });
1035
- });
1036
- await (0, _testUtils.act)(async () => {
1037
- _react.fireEvent.click(saveButton, {});
1038
- });
1039
- expect(ON_SUBMIT_CALLS.length).toEqual(0);
1040
- expect(ON_QUICK_EDIT_CALLS.length).toEqual(0);
1041
- });
1042
- it('should run hook validation when a value changes and local validation is passed', async () => {
1043
- const ON_SUBMIT_CALLS = [];
1044
- const hooks = {
1045
- onSubmit: (type, patch, notRequired, onError) => {
1046
- ON_SUBMIT_CALLS.push(patch);
1047
- onError([{
1048
- error: 'message',
1049
- id: '0'
1050
- }]);
966
+ it('should return after local validation if errors are present', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
967
+ var ON_SUBMIT_CALLS, hooks, ON_QUICK_EDIT_CALLS, ON_QUICK_EDIT, _renderWithValidation26, container, _checkSetup25, headerActionDiv, editButton, quickEdit, component, componentInput, quickEditButtons, saveButton;
968
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
969
+ while (1) switch (_context6.prev = _context6.next) {
970
+ case 0:
971
+ ON_SUBMIT_CALLS = [];
972
+ hooks = {
973
+ onSubmit: function onSubmit(type, patch) {
974
+ return ON_SUBMIT_CALLS.push(patch);
975
+ }
976
+ };
977
+ ON_QUICK_EDIT_CALLS = [];
978
+ ON_QUICK_EDIT = function ON_QUICK_EDIT(_ref5) {
979
+ var target = _ref5.target;
980
+ ON_QUICK_EDIT_CALLS.push(target);
981
+ };
982
+ _renderWithValidation26 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
983
+ id: ID,
984
+ entryData: _objectSpread(_objectSpread({}, ENTRY), {}, {
985
+ index: 0
986
+ }),
987
+ config: CONFIG,
988
+ pages: PAGES,
989
+ parentCollectionName: "parents",
990
+ onQuickEdit: ON_QUICK_EDIT,
991
+ formData: {
992
+ parents: [{
993
+ testText: 'hello'
994
+ }]
995
+ },
996
+ masterPage: {
997
+ childPages: []
998
+ },
999
+ inError: true
1000
+ }), {
1001
+ hooks: hooks
1002
+ }), container = _renderWithValidation26.container;
1003
+ _checkSetup25 = checkSetup(container), headerActionDiv = _checkSetup25.headerActionDiv;
1004
+ editButton = headerActionDiv.children[0];
1005
+ _react.fireEvent.click(editButton, {});
1006
+ quickEdit = container.childNodes[0].childNodes[1];
1007
+ component = quickEdit.childNodes[1];
1008
+ componentInput = component.childNodes[2];
1009
+ quickEditButtons = quickEdit.childNodes[2];
1010
+ saveButton = quickEditButtons.childNodes[0]; // Field has validation to force the length of this field to be greater than 2 so this should fail
1011
+ _context6.next = 15;
1012
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
1013
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1014
+ while (1) switch (_context4.prev = _context4.next) {
1015
+ case 0:
1016
+ _react.fireEvent.change(componentInput, {
1017
+ target: {
1018
+ value: 'a'
1019
+ }
1020
+ });
1021
+ case 1:
1022
+ case "end":
1023
+ return _context4.stop();
1024
+ }
1025
+ }, _callee4);
1026
+ })));
1027
+ case 15:
1028
+ _context6.next = 17;
1029
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
1030
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1031
+ while (1) switch (_context5.prev = _context5.next) {
1032
+ case 0:
1033
+ _react.fireEvent.click(saveButton, {});
1034
+ case 1:
1035
+ case "end":
1036
+ return _context5.stop();
1037
+ }
1038
+ }, _callee5);
1039
+ })));
1040
+ case 17:
1041
+ expect(ON_SUBMIT_CALLS.length).toEqual(0);
1042
+ expect(ON_QUICK_EDIT_CALLS.length).toEqual(0);
1043
+ case 19:
1044
+ case "end":
1045
+ return _context6.stop();
1051
1046
  }
1052
- };
1053
- const ON_QUICK_EDIT_CALLS = [];
1054
- const ON_QUICK_EDIT = _ref2 => {
1055
- let {
1056
- target
1057
- } = _ref2;
1058
- ON_QUICK_EDIT_CALLS.push(target);
1059
- };
1060
- const {
1061
- container
1062
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1063
- id: ID,
1064
- entryData: ENTRY,
1065
- config: CONFIG,
1066
- pages: PAGES,
1067
- parentCollectionName: "parents",
1068
- onQuickEdit: ON_QUICK_EDIT,
1069
- formData: {
1070
- parents: [{
1071
- alreadyProvidedField: 'hello'
1072
- }]
1073
- },
1074
- masterPage: {
1075
- childPages: []
1076
- },
1077
- isDuplicated: true
1078
- }), {
1079
- hooks
1080
- });
1081
- const {
1082
- headerActionDiv
1083
- } = checkSetup(container);
1084
- const editButton = headerActionDiv.children[0];
1085
- _react.fireEvent.click(editButton, {});
1086
- const quickEdit = container.childNodes[0].childNodes[1];
1087
-
1088
- // Make a change
1089
- const component = quickEdit.childNodes[1];
1090
- const componentInput = component.childNodes[2];
1091
- _react.fireEvent.change(componentInput, {
1092
- target: {
1093
- value: 'new value'
1047
+ }, _callee6);
1048
+ })));
1049
+ it('should run hook validation when a value changes and local validation is passed', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
1050
+ var ON_SUBMIT_CALLS, hooks, ON_QUICK_EDIT_CALLS, ON_QUICK_EDIT, _renderWithValidation27, container, _checkSetup26, headerActionDiv, editButton, quickEdit, component, componentInput, quickEditButtons, saveButton;
1051
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1052
+ while (1) switch (_context8.prev = _context8.next) {
1053
+ case 0:
1054
+ ON_SUBMIT_CALLS = [];
1055
+ hooks = {
1056
+ onSubmit: function onSubmit(type, patch, notRequired, onError) {
1057
+ ON_SUBMIT_CALLS.push(patch);
1058
+ onError([{
1059
+ error: 'message',
1060
+ id: '0'
1061
+ }]);
1062
+ }
1063
+ };
1064
+ ON_QUICK_EDIT_CALLS = [];
1065
+ ON_QUICK_EDIT = function ON_QUICK_EDIT(_ref9) {
1066
+ var target = _ref9.target;
1067
+ ON_QUICK_EDIT_CALLS.push(target);
1068
+ };
1069
+ _renderWithValidation27 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1070
+ id: ID,
1071
+ entryData: ENTRY,
1072
+ config: CONFIG,
1073
+ pages: PAGES,
1074
+ parentCollectionName: "parents",
1075
+ onQuickEdit: ON_QUICK_EDIT,
1076
+ formData: {
1077
+ parents: [{
1078
+ alreadyProvidedField: 'hello'
1079
+ }]
1080
+ },
1081
+ masterPage: {
1082
+ childPages: []
1083
+ },
1084
+ inError: true
1085
+ }), {
1086
+ hooks: hooks
1087
+ }), container = _renderWithValidation27.container;
1088
+ _checkSetup26 = checkSetup(container), headerActionDiv = _checkSetup26.headerActionDiv;
1089
+ editButton = headerActionDiv.children[0];
1090
+ _react.fireEvent.click(editButton, {});
1091
+ quickEdit = container.childNodes[0].childNodes[1]; // Make a change
1092
+ component = quickEdit.childNodes[1];
1093
+ componentInput = component.childNodes[2];
1094
+ _react.fireEvent.change(componentInput, {
1095
+ target: {
1096
+ value: 'new value'
1097
+ }
1098
+ });
1099
+ quickEditButtons = quickEdit.childNodes[2];
1100
+ saveButton = quickEditButtons.childNodes[0];
1101
+ _context8.next = 16;
1102
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1103
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1104
+ while (1) switch (_context7.prev = _context7.next) {
1105
+ case 0:
1106
+ _react.fireEvent.click(saveButton, {});
1107
+ case 1:
1108
+ case "end":
1109
+ return _context7.stop();
1110
+ }
1111
+ }, _callee7);
1112
+ })));
1113
+ case 16:
1114
+ expect(ON_SUBMIT_CALLS[0]).toEqual({
1115
+ testText: 'new value'
1116
+ });
1117
+ expect(ON_QUICK_EDIT_CALLS.length).toEqual(0);
1118
+ case 18:
1119
+ case "end":
1120
+ return _context8.stop();
1094
1121
  }
1095
- });
1096
- const quickEditButtons = quickEdit.childNodes[2];
1097
- const saveButton = quickEditButtons.childNodes[0];
1098
- await (0, _testUtils.act)(async () => {
1099
- _react.fireEvent.click(saveButton, {});
1100
- });
1101
- expect(ON_SUBMIT_CALLS[0]).toEqual({
1102
- testText: 'new value'
1103
- });
1104
- expect(ON_QUICK_EDIT_CALLS.length).toEqual(0);
1105
- });
1106
- it('should apply changes if no errors are present', async () => {
1107
- let isDuplicatedValue = true;
1108
- const ON_SUBMIT_CALLS = [];
1109
- const hooks = {
1110
- onSubmit: (type, patch) => ON_SUBMIT_CALLS.push(patch)
1111
- };
1112
- const ON_QUICK_EDIT_CALLS = [];
1113
- const ON_QUICK_EDIT = _ref3 => {
1114
- let {
1115
- target
1116
- } = _ref3;
1117
- ON_QUICK_EDIT_CALLS.push(target);
1118
- isDuplicatedValue = false;
1119
- };
1120
- const {
1121
- container
1122
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1123
- id: ID,
1124
- entryData: {
1125
- index: 0,
1126
- id: '0'
1127
- },
1128
- config: CONFIG,
1129
- pages: PAGES,
1130
- parentCollectionName: "parents",
1131
- onQuickEdit: ON_QUICK_EDIT,
1132
- formData: {
1133
- parents: [{
1134
- alreadyProvidedField: 'hello'
1135
- }]
1136
- },
1137
- masterPage: {
1138
- childPages: []
1139
- },
1140
- isDuplicated: isDuplicatedValue
1141
- }), {
1142
- hooks
1143
- });
1144
- const {
1145
- headerActionDiv
1146
- } = checkSetup(container);
1147
- const editButton = headerActionDiv.children[0];
1148
- _react.fireEvent.click(editButton, {});
1149
- const quickEdit = container.childNodes[0].childNodes[1];
1122
+ }, _callee8);
1123
+ })));
1124
+ it('should apply changes if no errors are present', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
1125
+ var inErrorValue, ON_SUBMIT_CALLS, hooks, ON_QUICK_EDIT_CALLS, ON_QUICK_EDIT, _renderWithValidation28, container, _checkSetup27, headerActionDiv, editButton, quickEdit, component, componentInput, quickEditButtons, saveButton;
1126
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1127
+ while (1) switch (_context10.prev = _context10.next) {
1128
+ case 0:
1129
+ inErrorValue = true;
1130
+ ON_SUBMIT_CALLS = [];
1131
+ hooks = {
1132
+ onSubmit: function onSubmit(type, patch) {
1133
+ return ON_SUBMIT_CALLS.push(patch);
1134
+ }
1135
+ };
1136
+ ON_QUICK_EDIT_CALLS = [];
1137
+ ON_QUICK_EDIT = function ON_QUICK_EDIT(_ref12) {
1138
+ var target = _ref12.target;
1139
+ ON_QUICK_EDIT_CALLS.push(target);
1140
+ inErrorValue = false;
1141
+ };
1142
+ _renderWithValidation28 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1143
+ id: ID,
1144
+ entryData: {
1145
+ index: 0,
1146
+ id: '0'
1147
+ },
1148
+ config: CONFIG,
1149
+ pages: PAGES,
1150
+ parentCollectionName: "parents",
1151
+ onQuickEdit: ON_QUICK_EDIT,
1152
+ formData: {
1153
+ parents: [{
1154
+ alreadyProvidedField: 'hello'
1155
+ }]
1156
+ },
1157
+ masterPage: {
1158
+ childPages: []
1159
+ },
1160
+ inError: inErrorValue
1161
+ }), {
1162
+ hooks: hooks
1163
+ }), container = _renderWithValidation28.container;
1164
+ _checkSetup27 = checkSetup(container), headerActionDiv = _checkSetup27.headerActionDiv;
1165
+ editButton = headerActionDiv.children[0];
1166
+ _react.fireEvent.click(editButton, {});
1167
+ quickEdit = container.childNodes[0].childNodes[1]; // Make a change that will be accepted
1168
+ component = quickEdit.childNodes[1];
1169
+ componentInput = component.childNodes[2];
1170
+ _react.fireEvent.change(componentInput, {
1171
+ target: {
1172
+ value: 'new value'
1173
+ }
1174
+ });
1175
+ quickEditButtons = quickEdit.childNodes[2];
1176
+ saveButton = quickEditButtons.childNodes[0];
1177
+ _context10.next = 17;
1178
+ return (0, _testUtils.act)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
1179
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1180
+ while (1) switch (_context9.prev = _context9.next) {
1181
+ case 0:
1182
+ _react.fireEvent.click(saveButton, {});
1183
+ case 1:
1184
+ case "end":
1185
+ return _context9.stop();
1186
+ }
1187
+ }, _callee9);
1188
+ })));
1189
+ case 17:
1190
+ expect(ON_QUICK_EDIT_CALLS.length).toEqual(1);
1191
+ expect(ON_QUICK_EDIT_CALLS[0].value[0]).toEqual({
1192
+ alreadyProvidedField: 'hello',
1193
+ testText: 'new value'
1194
+ });
1150
1195
 
1151
- // Make a change that will be accepted
1152
- const component = quickEdit.childNodes[1];
1153
- const componentInput = component.childNodes[2];
1154
- _react.fireEvent.change(componentInput, {
1155
- target: {
1156
- value: 'new value'
1196
+ // Check that the inError prop is now false
1197
+ expect(inErrorValue).toBe(false);
1198
+ case 20:
1199
+ case "end":
1200
+ return _context10.stop();
1157
1201
  }
1158
- });
1159
- const quickEditButtons = quickEdit.childNodes[2];
1160
- const saveButton = quickEditButtons.childNodes[0];
1161
- await (0, _testUtils.act)(async () => {
1162
- _react.fireEvent.click(saveButton, {});
1163
- });
1164
- expect(ON_QUICK_EDIT_CALLS.length).toEqual(1);
1165
- expect(ON_QUICK_EDIT_CALLS[0].value[0]).toEqual({
1166
- alreadyProvidedField: 'hello',
1167
- testText: 'new value'
1168
- });
1169
-
1170
- // Check that the isDuplicated prop is now false
1171
- expect(isDuplicatedValue).toBe(false);
1172
- });
1202
+ }, _callee10);
1203
+ })));
1173
1204
  });
1174
- describe('Details prop behavior', () => {
1175
- it('should render the provided details', () => {
1176
- const DETAILS = 'Sample details';
1177
- const CONFIG = {
1205
+ describe('Details prop behavior', function () {
1206
+ it('should render the provided details', function () {
1207
+ var DETAILS = 'Sample details';
1208
+ var CONFIG = {
1178
1209
  title: 'Title',
1179
1210
  details: DETAILS
1180
1211
  };
1181
- const {
1182
- container
1183
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1184
- id: ID,
1185
- entryData: ENTRY,
1186
- config: CONFIG,
1187
- parentCollectionName: "parent",
1188
- pages: [],
1189
- formData: {},
1190
- masterPage: {
1191
- childPages: []
1192
- }
1193
- }));
1194
- const {
1195
- headerContentDiv
1196
- } = checkSetup(container);
1197
- const headerDetails = headerContentDiv.children[1];
1212
+ var _renderWithValidation29 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1213
+ id: ID,
1214
+ entryData: ENTRY,
1215
+ config: CONFIG,
1216
+ parentCollectionName: "parent",
1217
+ pages: [],
1218
+ formData: {},
1219
+ masterPage: {
1220
+ childPages: []
1221
+ }
1222
+ })),
1223
+ container = _renderWithValidation29.container;
1224
+ var _checkSetup28 = checkSetup(container),
1225
+ headerContentDiv = _checkSetup28.headerContentDiv;
1226
+ var headerDetails = headerContentDiv.children[1];
1198
1227
  expect(headerDetails.tagName).toEqual('DIV');
1199
1228
  expect(headerDetails.classList).toContain(classes('header-content-detail'));
1200
1229
  expect(headerDetails.textContent).toEqual(DETAILS);
1201
1230
  });
1202
- it('should not render details when they are empty', () => {
1203
- const CONFIG = {
1231
+ it('should not render details when they are empty', function () {
1232
+ var CONFIG = {
1204
1233
  title: 'Title',
1205
1234
  details: ''
1206
1235
  };
1207
- const {
1208
- container
1209
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1210
- id: ID,
1211
- entryData: ENTRY,
1212
- config: CONFIG,
1213
- parentCollectionName: "parent",
1214
- pages: [],
1215
- formData: {},
1216
- masterPage: {
1217
- childPages: []
1218
- }
1219
- }));
1220
- const {
1221
- headerContentDiv
1222
- } = checkSetup(container);
1236
+ var _renderWithValidation30 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1237
+ id: ID,
1238
+ entryData: ENTRY,
1239
+ config: CONFIG,
1240
+ parentCollectionName: "parent",
1241
+ pages: [],
1242
+ formData: {},
1243
+ masterPage: {
1244
+ childPages: []
1245
+ }
1246
+ })),
1247
+ container = _renderWithValidation30.container;
1248
+ var _checkSetup29 = checkSetup(container),
1249
+ headerContentDiv = _checkSetup29.headerContentDiv;
1223
1250
  // If no details are provided, we expect only the header title to be rendered.
1224
1251
  expect(headerContentDiv.children.length).toEqual(1);
1225
- const headerTitle = headerContentDiv.children[0];
1252
+ var headerTitle = headerContentDiv.children[0];
1226
1253
  expect(headerTitle.classList).toContain(classes('header-content-title'));
1227
1254
  });
1228
- it('should render the interpolated details', () => {
1229
- const DETAILS = 'Full {label}';
1230
- const INTERPOLATED_ENTRY = {
1231
- ...ENTRY,
1255
+ it('should render the interpolated details', function () {
1256
+ var DETAILS = 'Full {label}';
1257
+ var INTERPOLATED_ENTRY = _objectSpread(_objectSpread({}, ENTRY), {}, {
1232
1258
  label: 'Details'
1233
- };
1234
- const CONFIG = {
1259
+ });
1260
+ var CONFIG = {
1235
1261
  title: 'Title',
1236
1262
  details: DETAILS
1237
1263
  };
1238
- const {
1239
- container
1240
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1241
- id: ID,
1242
- entryData: INTERPOLATED_ENTRY,
1243
- config: CONFIG,
1244
- parentCollectionName: "parent",
1245
- pages: [],
1246
- formData: {},
1247
- masterPage: {
1248
- childPages: []
1249
- }
1250
- }));
1251
- const {
1252
- headerContentDiv
1253
- } = checkSetup(container);
1254
- const headerDetails = headerContentDiv.children[1];
1255
- const expectedInterpolatedString = _copReactComponents.Utils.interpolateString(DETAILS, INTERPOLATED_ENTRY);
1264
+ var _renderWithValidation31 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1265
+ id: ID,
1266
+ entryData: INTERPOLATED_ENTRY,
1267
+ config: CONFIG,
1268
+ parentCollectionName: "parent",
1269
+ pages: [],
1270
+ formData: {},
1271
+ masterPage: {
1272
+ childPages: []
1273
+ }
1274
+ })),
1275
+ container = _renderWithValidation31.container;
1276
+ var _checkSetup30 = checkSetup(container),
1277
+ headerContentDiv = _checkSetup30.headerContentDiv;
1278
+ var headerDetails = headerContentDiv.children[1];
1279
+ var expectedInterpolatedString = _copReactComponents.Utils.interpolateString(DETAILS, INTERPOLATED_ENTRY);
1256
1280
  expect(headerDetails.textContent).toEqual(expectedInterpolatedString);
1257
1281
  });
1258
- it('should not render the details div if config.details is not provided', () => {
1259
- const CONFIG = {
1282
+ it('should not render the details div if config.details is not provided', function () {
1283
+ var CONFIG = {
1260
1284
  title: 'Title'
1261
1285
  };
1262
- const {
1263
- container
1264
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1265
- id: ID,
1266
- entryData: ENTRY,
1267
- config: CONFIG,
1268
- parentCollectionName: "parent",
1269
- pages: [],
1270
- formData: {},
1271
- masterPage: {
1272
- childPages: []
1273
- }
1274
- }));
1275
- const {
1276
- headerContentDiv
1277
- } = checkSetup(container);
1278
- const headerDetails = headerContentDiv.querySelector("#".concat(ID, ".titleDetail"));
1286
+ var _renderWithValidation32 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1287
+ id: ID,
1288
+ entryData: ENTRY,
1289
+ config: CONFIG,
1290
+ parentCollectionName: "parent",
1291
+ pages: [],
1292
+ formData: {},
1293
+ masterPage: {
1294
+ childPages: []
1295
+ }
1296
+ })),
1297
+ container = _renderWithValidation32.container;
1298
+ var _checkSetup31 = checkSetup(container),
1299
+ headerContentDiv = _checkSetup31.headerContentDiv;
1300
+ var headerDetails = headerContentDiv.querySelector("#".concat(ID, ".titleDetail"));
1279
1301
  expect(headerDetails).toBeNull();
1280
1302
  });
1281
- it('should not render the entire details section when hideDetails prop is true', () => {
1282
- const DETAILS = 'Sample details that should not be displayed';
1283
- const CONFIG = {
1303
+ it('should not render the entire details section when hideDetails prop is true', function () {
1304
+ var DETAILS = 'Sample details that should not be displayed';
1305
+ var CONFIG = {
1284
1306
  title: 'Title',
1285
1307
  details: DETAILS
1286
1308
  };
1287
- const {
1288
- container
1289
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1290
- id: ID,
1291
- entryData: ENTRY,
1292
- config: CONFIG,
1293
- parentCollectionName: "parent",
1294
- pages: [],
1295
- formData: {},
1296
- hideDetails: true,
1297
- masterPage: {
1298
- childPages: []
1299
- }
1300
- }));
1301
- const detailsComponent = container.querySelector('.details');
1309
+ var _renderWithValidation33 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1310
+ id: ID,
1311
+ entryData: ENTRY,
1312
+ config: CONFIG,
1313
+ parentCollectionName: "parent",
1314
+ pages: [],
1315
+ formData: {},
1316
+ hideDetails: true,
1317
+ masterPage: {
1318
+ childPages: []
1319
+ }
1320
+ })),
1321
+ container = _renderWithValidation33.container;
1322
+ var detailsComponent = container.querySelector('.details');
1302
1323
  expect(detailsComponent).toBeNull();
1303
1324
  });
1304
1325
  });
1305
- describe('SummaryLayout config behavior', () => {
1306
- it('should render sections and fields based on summaryLayout config', () => {
1307
- const CHILD_PAGE_SAMPLE = [{
1326
+ describe('SummaryLayout config behavior', function () {
1327
+ it('should render sections and fields based on summaryLayout config', function () {
1328
+ var CHILD_PAGE_SAMPLE = [{
1308
1329
  summaryLayout: {
1309
1330
  sections: [{
1310
1331
  title: 'Section 1',
@@ -1324,39 +1345,40 @@ describe('components.CollectionSummary.SummaryCard', () => {
1324
1345
  fieldId: 'fieldC'
1325
1346
  }]
1326
1347
  }];
1327
- const CONFIG = {
1348
+ var CONFIG = {
1328
1349
  title: 'Title'
1329
1350
  };
1330
- const {
1331
- container
1332
- } = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1333
- id: ID,
1334
- entryData: ENTRY,
1335
- config: CONFIG,
1336
- parentCollectionName: "parent",
1337
- pages: CHILD_PAGE_SAMPLE,
1338
- formData: {},
1339
- masterPage: {
1340
- childPages: []
1341
- }
1342
- }));
1351
+ var _renderWithValidation34 = (0, _setupTests.renderWithValidation)( /*#__PURE__*/_react2.default.createElement(_SummaryCard.default, {
1352
+ id: ID,
1353
+ entryData: ENTRY,
1354
+ config: CONFIG,
1355
+ parentCollectionName: "parent",
1356
+ pages: CHILD_PAGE_SAMPLE,
1357
+ formData: {},
1358
+ masterPage: {
1359
+ childPages: []
1360
+ }
1361
+ })),
1362
+ container = _renderWithValidation34.container;
1343
1363
 
1344
1364
  // Function to find an element by its text content
1345
1365
  function getByTextContent(parent, text) {
1346
- return Array.from(parent.getElementsByClassName(classes('section-title'))).find(el => el.textContent === text);
1366
+ return Array.from(parent.getElementsByClassName(classes('section-title'))).find(function (el) {
1367
+ return el.textContent === text;
1368
+ });
1347
1369
  }
1348
1370
 
1349
1371
  // Check for section titles
1350
- const section1Title = getByTextContent(container, 'Section 1');
1351
- const section2Title = getByTextContent(container, 'Section 2');
1372
+ var section1Title = getByTextContent(container, 'Section 1');
1373
+ var section2Title = getByTextContent(container, 'Section 2');
1352
1374
  expect(section1Title).not.toBeNull();
1353
1375
  expect(section2Title).not.toBeNull();
1354
1376
  if (section1Title) {
1355
- const section1Content = section1Title.parentNode.querySelector(".".concat(classes('section-content')));
1377
+ var section1Content = section1Title.parentNode.querySelector(".".concat(classes('section-content')));
1356
1378
  expect(section1Content.querySelectorAll(".".concat(classes('field'))).length).toEqual(2);
1357
1379
  }
1358
1380
  if (section2Title) {
1359
- const section2Content = section2Title.parentNode.querySelector(".".concat(classes('section-content')));
1381
+ var section2Content = section2Title.parentNode.querySelector(".".concat(classes('section-content')));
1360
1382
  expect(section2Content.querySelectorAll(".".concat(classes('field'))).length).toEqual(1);
1361
1383
  }
1362
1384
  });