@coveo/quantic 3.44.1 → 3.44.2

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 (203) hide show
  1. package/force-app/main/default/classes/OrganizationEndpointsTest.cls +71 -15
  2. package/force-app/main/default/classes/RecommendationsControllerTest.cls +1 -1
  3. package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
  4. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  5. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  6. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  7. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
  8. package/package.json +33 -31
  9. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
  10. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
  11. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
  12. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
  13. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
  15. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  16. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  17. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  18. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  19. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  20. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  21. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
  22. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
  23. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
  24. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
  25. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
  26. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
  27. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  28. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
  29. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
  30. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
  31. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
  32. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
  33. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
  34. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
  35. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
  36. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
  37. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
  38. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
  39. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
  40. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
  41. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
  42. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
  43. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
  44. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
  45. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
  46. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
  47. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  48. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  49. package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
  50. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
  51. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  52. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  53. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
  54. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  55. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  56. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
  57. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
  58. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
  59. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
  60. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
  61. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
  62. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  63. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
  64. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
  65. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
  66. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
  67. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
  68. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
  69. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
  70. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
  71. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
  72. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
  73. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
  74. package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
  75. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  76. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  77. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
  78. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
  79. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
  80. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
  81. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
  82. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
  83. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
  84. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
  85. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
  86. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
  87. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
  88. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
  89. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
  90. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
  91. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  92. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
  93. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
  94. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  95. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  96. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  97. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  98. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
  99. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
  100. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
  101. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
  102. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
  103. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
  104. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
  105. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
  106. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
  107. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
  108. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
  109. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
  110. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
  111. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
  112. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  113. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  114. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  115. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
  116. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
  117. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
  118. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
  119. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  120. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  121. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  122. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
  123. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
  124. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
  125. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
  126. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
  127. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  128. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  129. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  130. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
  131. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
  132. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
  133. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
  134. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
  135. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  136. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
  137. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
  138. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  139. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  140. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
  141. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
  142. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
  143. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
  144. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
  145. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
  146. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
  147. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
  148. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
  149. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  150. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  151. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
  152. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  153. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  154. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  155. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  156. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  157. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  158. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
  159. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  160. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  161. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  162. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
  163. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
  164. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
  165. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
  166. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
  167. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
  168. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
  169. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
  170. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  171. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
  172. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
  173. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
  174. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
  175. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
  176. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  177. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
  178. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  179. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
  180. package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
  181. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
  182. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
  183. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
  184. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
  185. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
  186. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  187. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  188. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  189. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  190. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  191. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  192. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  193. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  194. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  195. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  196. package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
  197. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
  198. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  199. package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
  200. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
  201. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
  202. package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
  203. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,819 +0,0 @@
1
- /* eslint-disable no-import-assign */
2
- // @ts-ignore
3
- import QuanticCaseClassification from 'c/quanticCaseClassification';
4
- // @ts-ignore
5
- import {createElement} from 'lwc';
6
- import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
7
- import {getPicklistValuesByRecordType} from 'lightning/uiObjectInfoApi';
8
-
9
- jest.mock('c/quanticHeadlessLoader');
10
-
11
- const exampleDefaultLabel = 'default label';
12
- const incorrectSfFieldNameError = `The Salesforce field API name is not found.`;
13
- const invalidMaxSuggestionsError =
14
- 'The maximum number of suggestions must be an integer greater than 0.';
15
- const missingCoveoFieldNameError =
16
- 'The "coveoFieldName" property is required, please set its value.';
17
- const exampleMoreTopicsLabel = 'example more topics label';
18
- const exampleSelectOptionLabel = 'example select option label';
19
- const exampleField = 'example field';
20
- const exampleLabel = 'example label';
21
-
22
- const exampleCaseClassificationSuggestions = [
23
- {
24
- id: '1',
25
- value: 'classification 2',
26
- confidence: 1,
27
- },
28
- {
29
- id: '2',
30
- value: 'classification 3',
31
- confidence: 1,
32
- },
33
- ];
34
-
35
- const exampleCaseClassificationAllOptions = [
36
- {value: 'classification 1'},
37
- {value: 'classification 2'},
38
- {value: 'classification 3'},
39
- {value: 'classification 4'},
40
- ];
41
-
42
- jest.mock(
43
- '@salesforce/label/c.quantic_CaseClassificationTitle',
44
- () => ({default: exampleDefaultLabel}),
45
- {
46
- virtual: true,
47
- }
48
- );
49
- jest.mock(
50
- '@salesforce/label/c.quantic_InvalidMaxNumberOfSuggestions',
51
- () => ({default: invalidMaxSuggestionsError}),
52
- {
53
- virtual: true,
54
- }
55
- );
56
- jest.mock(
57
- '@salesforce/label/c.quantic_InvalidMaxNumberOfSuggestions',
58
- () => ({default: invalidMaxSuggestionsError}),
59
- {
60
- virtual: true,
61
- }
62
- );
63
- jest.mock(
64
- '@salesforce/label/c.quantic_PropertyIsRequired',
65
- () => ({default: missingCoveoFieldNameError}),
66
- {
67
- virtual: true,
68
- }
69
- );
70
- jest.mock(
71
- '@salesforce/label/c.quantic_MoreTopics',
72
- () => ({default: exampleMoreTopicsLabel}),
73
- {
74
- virtual: true,
75
- }
76
- );
77
- jest.mock(
78
- '@salesforce/label/c.quantic_SelectOption',
79
- () => ({default: exampleSelectOptionLabel}),
80
- {
81
- virtual: true,
82
- }
83
- );
84
- jest.mock(
85
- '@salesforce/label/c.quantic_SalesforceFieldNotFound',
86
- () => ({default: incorrectSfFieldNameError}),
87
- {
88
- virtual: true,
89
- }
90
- );
91
-
92
- let isInitialized = false;
93
-
94
- const initialCaseClassificationState = {
95
- suggestions: exampleCaseClassificationSuggestions,
96
- };
97
- let caseClassificationState = initialCaseClassificationState;
98
-
99
- const functionsMocks = {
100
- buildCaseField: jest.fn(() => ({
101
- state: caseClassificationState,
102
- subscribe: functionsMocks.subscribe,
103
- update: functionsMocks.update,
104
- })),
105
- subscribe: jest.fn((cb) => {
106
- cb();
107
- return functionsMocks.unsubscribe;
108
- }),
109
- unsubscribe: jest.fn(() => {}),
110
- loadCaseAssistAnalyticsActions: jest.fn(() => ({
111
- fetchCaseClassifications: functionsMocks.fetchCaseClassifications,
112
- })),
113
- loadCaseFieldActions: jest.fn(() => {}),
114
- update: jest.fn(() => {}),
115
- fetchCaseClassifications: jest.fn(() => {}),
116
- dispatch: jest.fn(() => {}),
117
- };
118
-
119
- const exampleEngine = {
120
- id: 'exampleEngineId',
121
- dispatch: functionsMocks.dispatch,
122
- };
123
-
124
- const defaultOptions = {
125
- engineId: exampleEngine.id,
126
- sfFieldApiName: exampleField,
127
- coveoFieldName: exampleField,
128
- maxSuggestions: 3,
129
- label: exampleLabel,
130
- };
131
-
132
- const selectors = {
133
- initializationError: 'c-quantic-component-error',
134
- loadingSpinner: 'lightning-spinner',
135
- label: '[data-testid="case-classification-label"]',
136
- caseClassificationSuggestion:
137
- '[data-testid="case-classification-suggestion"]',
138
- caseClassificationOption: '[data-testid="case-classification-option"]',
139
- caseClassificationSuggestionInput:
140
- '[data-testid="case-classification-suggestion"] input',
141
- caseClassificationOptionInput:
142
- '[data-testid="case-classification-option"] input',
143
- showSelectInputButton: '[data-testid="show-select-input-button"]',
144
- allOptionsSelectInput:
145
- '[data-testid="case-classification-all-options-combobox"]',
146
- classificationErrorMessage:
147
- '[data-testid="case-classification-error-message"]',
148
- };
149
-
150
- function mockGetPicklistValuesByRecordTypeWire() {
151
- // @ts-ignore
152
- // eslint-disable-next-line @lwc/lwc/no-unexpected-wire-adapter-usages
153
- getPicklistValuesByRecordType.emit({
154
- picklistFieldValues: {
155
- [exampleField]: {
156
- values: exampleCaseClassificationAllOptions,
157
- },
158
- },
159
- });
160
- }
161
-
162
- function createTestComponent(options = defaultOptions) {
163
- prepareHeadlessState();
164
-
165
- const element = createElement('c-quantic-case-classification', {
166
- is: QuanticCaseClassification,
167
- });
168
- for (const [key, value] of Object.entries(options)) {
169
- element[key] = value;
170
- }
171
- document.body.appendChild(element);
172
- return element;
173
- }
174
-
175
- function prepareHeadlessState() {
176
- // @ts-ignore
177
- global.CoveoHeadlessCaseAssist = {
178
- buildCaseField: functionsMocks.buildCaseField,
179
- loadCaseAssistAnalyticsActions:
180
- functionsMocks.loadCaseAssistAnalyticsActions,
181
- loadCaseFieldActions: functionsMocks.loadCaseFieldActions,
182
- };
183
- }
184
-
185
- // Helper function to wait until the microtask queue is empty.
186
- function flushPromises() {
187
- // eslint-disable-next-line @lwc/lwc/no-async-operation
188
- return new Promise((resolve) => setTimeout(resolve, 0));
189
- }
190
-
191
- function mockSuccessfulHeadlessInitialization() {
192
- // @ts-ignore
193
- mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
194
- if (element instanceof QuanticCaseClassification && !isInitialized) {
195
- isInitialized = true;
196
- initialize(exampleEngine);
197
- }
198
- };
199
- }
200
-
201
- function mockErroneousHeadlessInitialization() {
202
- // @ts-ignore
203
- mockHeadlessLoader.initializeWithHeadless = (element) => {
204
- if (element instanceof QuanticCaseClassification) {
205
- element.setInitializationError();
206
- }
207
- };
208
- }
209
-
210
- function cleanup() {
211
- // The jsdom instance is shared across test cases in a single file so reset the DOM
212
- while (document.body.firstChild) {
213
- document.body.removeChild(document.body.firstChild);
214
- }
215
- jest.clearAllMocks();
216
- isInitialized = false;
217
- }
218
-
219
- describe('c-quantic-case-classification', () => {
220
- beforeEach(() => {
221
- mockSuccessfulHeadlessInitialization();
222
- caseClassificationState = initialCaseClassificationState;
223
- });
224
-
225
- afterEach(() => {
226
- cleanup();
227
- });
228
-
229
- describe('when an initialization error occurs', () => {
230
- beforeEach(() => {
231
- mockErroneousHeadlessInitialization();
232
- });
233
-
234
- it('should display the initialization error component', async () => {
235
- const element = createTestComponent();
236
- await flushPromises();
237
-
238
- const initializationError = element.shadowRoot.querySelector(
239
- selectors.initializationError
240
- );
241
-
242
- expect(initializationError).not.toBeNull();
243
- });
244
- });
245
-
246
- describe('controller initialization', () => {
247
- it('should build the case field controller with the proper parameters', async () => {
248
- createTestComponent();
249
- await flushPromises();
250
-
251
- expect(functionsMocks.buildCaseField).toHaveBeenCalledTimes(1);
252
- expect(functionsMocks.buildCaseField).toHaveBeenCalledWith(
253
- exampleEngine,
254
- {
255
- options: {
256
- field: exampleField,
257
- },
258
- }
259
- );
260
- });
261
-
262
- it('should subscribe to the headless case field state changes', async () => {
263
- createTestComponent();
264
- await flushPromises();
265
-
266
- expect(functionsMocks.subscribe).toHaveBeenCalledTimes(1);
267
- });
268
-
269
- describe('the fetchOnInit property', () => {
270
- it('should fetch case classifications when the fetchOnInit property is set to true', async () => {
271
- createTestComponent({...defaultOptions, fetchOnInit: true});
272
- await flushPromises();
273
-
274
- expect(functionsMocks.fetchCaseClassifications).toHaveBeenCalledTimes(
275
- 1
276
- );
277
- });
278
-
279
- it('should not fetch case classifications when the fetchOnInit property is set to false', async () => {
280
- createTestComponent({...defaultOptions, fetchOnInit: false});
281
- await flushPromises();
282
-
283
- expect(functionsMocks.fetchCaseClassifications).toHaveBeenCalledTimes(
284
- 0
285
- );
286
- });
287
- });
288
- });
289
-
290
- describe('when the component is loading', () => {
291
- beforeEach(() => {
292
- caseClassificationState = {
293
- ...initialCaseClassificationState,
294
- loading: true,
295
- };
296
- });
297
-
298
- it('should display the loading spinner', async () => {
299
- const element = createTestComponent();
300
- await flushPromises();
301
-
302
- const loadingSpinner = element.shadowRoot.querySelector(
303
- selectors.loadingSpinner
304
- );
305
- const label = element.shadowRoot.querySelector(selectors.label);
306
-
307
- expect(loadingSpinner).not.toBeNull();
308
- expect(label).not.toBeNull();
309
- expect(label.textContent).toBe(exampleLabel);
310
- });
311
- });
312
-
313
- describe('property validation', () => {
314
- describe('when the value of the property maxSuggestions is inferior to 0', () => {
315
- it('should display the initialization error component', async () => {
316
- const element = createTestComponent({
317
- ...defaultOptions,
318
- maxSuggestions: -1,
319
- });
320
- await flushPromises();
321
-
322
- const initializationError = element.shadowRoot.querySelector(
323
- selectors.initializationError
324
- );
325
-
326
- expect(initializationError).not.toBeNull();
327
- expect(initializationError.message).toBe(invalidMaxSuggestionsError);
328
- });
329
- });
330
-
331
- describe('when the value of the property coveoFieldName is not defined', () => {
332
- it('should display the initialization error component', async () => {
333
- const element = createTestComponent({
334
- ...defaultOptions,
335
- coveoFieldName: undefined,
336
- });
337
- await flushPromises();
338
-
339
- const initializationError = element.shadowRoot.querySelector(
340
- selectors.initializationError
341
- );
342
-
343
- expect(initializationError).not.toBeNull();
344
- expect(initializationError.message).toBe(missingCoveoFieldNameError);
345
- });
346
- });
347
-
348
- describe('when the value of the property sfFieldApiName does not exist on the case object', () => {
349
- it('should display the initialization error component', async () => {
350
- const exampleInvalidSfField = 'example invalid field';
351
- const element = createTestComponent({
352
- ...defaultOptions,
353
- sfFieldApiName: exampleInvalidSfField,
354
- });
355
- mockGetPicklistValuesByRecordTypeWire();
356
- await flushPromises();
357
-
358
- const initializationError = element.shadowRoot.querySelector(
359
- selectors.initializationError
360
- );
361
-
362
- expect(initializationError).not.toBeNull();
363
- expect(initializationError.message).toBe(incorrectSfFieldNameError);
364
- });
365
- });
366
- });
367
-
368
- describe('the behaviour of the case classifications inputs', () => {
369
- describe('when the max suggestions value is inferior to the count of all the classification options', () => {
370
- const exampleMaxSuggestions = 2;
371
-
372
- describe('the case classification suggestions', () => {
373
- it('should display the case classification suggestions as inline options', async () => {
374
- const element = createTestComponent({
375
- ...defaultOptions,
376
- maxSuggestions: exampleMaxSuggestions,
377
- });
378
- mockGetPicklistValuesByRecordTypeWire();
379
-
380
- await flushPromises();
381
-
382
- const suggestions = element.shadowRoot.querySelectorAll(
383
- selectors.caseClassificationSuggestion
384
- );
385
-
386
- expect(suggestions.length).toBe(exampleMaxSuggestions);
387
- for (let index = 0; index < exampleMaxSuggestions; index++) {
388
- expect(suggestions[index].textContent).toBe(
389
- exampleCaseClassificationSuggestions[index].value
390
- );
391
- }
392
- });
393
-
394
- it('should automatically select the first case classification suggestion', async () => {
395
- const element = createTestComponent({
396
- ...defaultOptions,
397
- maxSuggestions: exampleMaxSuggestions,
398
- });
399
- mockGetPicklistValuesByRecordTypeWire();
400
-
401
- await flushPromises();
402
-
403
- const suggestionInputs = element.shadowRoot.querySelectorAll(
404
- selectors.caseClassificationSuggestionInput
405
- );
406
-
407
- expect(functionsMocks.update).toHaveBeenCalledTimes(1);
408
- expect(functionsMocks.update).toHaveBeenCalledWith(
409
- exampleCaseClassificationSuggestions[0].value,
410
- {caseClassifications: false, documentSuggestions: false},
411
- true
412
- );
413
- expect(suggestionInputs[0].checked).toBe(true);
414
- });
415
-
416
- describe('when a case classification suggestion is clicked', () => {
417
- it('should call the update method of the case field controller with the right parameter', async () => {
418
- const automaticallySelectedSuggestionIndex = 0;
419
- const exampleSelectedSuggestionIndex = 1;
420
- const element = createTestComponent({
421
- ...defaultOptions,
422
- maxSuggestions: exampleMaxSuggestions,
423
- });
424
- mockGetPicklistValuesByRecordTypeWire();
425
-
426
- await flushPromises();
427
-
428
- expect(functionsMocks.update).toHaveBeenCalledTimes(1);
429
- expect(functionsMocks.update).toHaveBeenCalledWith(
430
- exampleCaseClassificationSuggestions[
431
- automaticallySelectedSuggestionIndex
432
- ].value,
433
- {caseClassifications: false, documentSuggestions: false},
434
- true
435
- );
436
-
437
- const suggestionInputs = element.shadowRoot.querySelectorAll(
438
- selectors.caseClassificationSuggestionInput
439
- );
440
-
441
- suggestionInputs[exampleSelectedSuggestionIndex].click();
442
- await flushPromises();
443
-
444
- expect(functionsMocks.update).toHaveBeenCalledTimes(2);
445
- expect(functionsMocks.update).toHaveBeenCalledWith(
446
- exampleCaseClassificationSuggestions[
447
- exampleSelectedSuggestionIndex
448
- ].value,
449
- {caseClassifications: false, documentSuggestions: false},
450
- undefined
451
- );
452
- });
453
- });
454
- });
455
-
456
- describe('the case classification all options', () => {
457
- it('should display the show select input button', async () => {
458
- const element = createTestComponent({
459
- ...defaultOptions,
460
- maxSuggestions: exampleMaxSuggestions,
461
- });
462
- mockGetPicklistValuesByRecordTypeWire();
463
-
464
- await flushPromises();
465
-
466
- const showSelectInputButton = element.shadowRoot.querySelector(
467
- selectors.showSelectInputButton
468
- );
469
-
470
- expect(showSelectInputButton).not.toBeNull();
471
- expect(showSelectInputButton.title).toBe(exampleMoreTopicsLabel);
472
- expect(showSelectInputButton.label).toBe(exampleMoreTopicsLabel);
473
- });
474
-
475
- describe('when clicking the show select input button', () => {
476
- it('should display the all options select input', async () => {
477
- const element = createTestComponent({
478
- ...defaultOptions,
479
- maxSuggestions: exampleMaxSuggestions,
480
- });
481
- mockGetPicklistValuesByRecordTypeWire();
482
-
483
- await flushPromises();
484
-
485
- const showSelectInputButton = element.shadowRoot.querySelector(
486
- selectors.showSelectInputButton
487
- );
488
- showSelectInputButton.click();
489
- await flushPromises();
490
-
491
- const allOptionsSelectInput = element.shadowRoot.querySelector(
492
- selectors.allOptionsSelectInput
493
- );
494
-
495
- expect(allOptionsSelectInput).not.toBeNull();
496
- expect(allOptionsSelectInput.options).toStrictEqual(
497
- exampleCaseClassificationAllOptions
498
- );
499
- expect(allOptionsSelectInput.value).toBe(
500
- exampleCaseClassificationSuggestions[0].value
501
- );
502
- expect(allOptionsSelectInput.placeholder).toBe(
503
- exampleMoreTopicsLabel
504
- );
505
- });
506
-
507
- it('should select an option correctly from the all options select input', async () => {
508
- const exampleSelectedOptionIndex = 3;
509
-
510
- const element = createTestComponent({
511
- ...defaultOptions,
512
- maxSuggestions: exampleMaxSuggestions,
513
- });
514
- mockGetPicklistValuesByRecordTypeWire();
515
-
516
- await flushPromises();
517
-
518
- const showSelectInputButton = element.shadowRoot.querySelector(
519
- selectors.showSelectInputButton
520
- );
521
- showSelectInputButton.click();
522
- await flushPromises();
523
-
524
- const allOptionsSelectInput = element.shadowRoot.querySelector(
525
- selectors.allOptionsSelectInput
526
- );
527
-
528
- expect(allOptionsSelectInput).not.toBeNull();
529
- allOptionsSelectInput.value =
530
- exampleCaseClassificationAllOptions[
531
- exampleSelectedOptionIndex
532
- ].value;
533
- allOptionsSelectInput.dispatchEvent(new CustomEvent('change'));
534
-
535
- expect(functionsMocks.update).toHaveBeenCalledTimes(2);
536
- expect(functionsMocks.update).toHaveBeenCalledWith(
537
- exampleCaseClassificationAllOptions[exampleSelectedOptionIndex]
538
- .value,
539
- {caseClassifications: false, documentSuggestions: false},
540
- undefined
541
- );
542
- });
543
- });
544
- });
545
- });
546
-
547
- describe('when the max suggestions value is superior to the count of all the classification options', () => {
548
- const exampleMaxSuggestions = 6;
549
-
550
- describe('the case classification suggestions', () => {
551
- it('should display the case classification suggestions as inline options', async () => {
552
- const element = createTestComponent({
553
- ...defaultOptions,
554
- maxSuggestions: exampleMaxSuggestions,
555
- });
556
- mockGetPicklistValuesByRecordTypeWire();
557
-
558
- await flushPromises();
559
-
560
- const suggestions = element.shadowRoot.querySelectorAll(
561
- selectors.caseClassificationSuggestion
562
- );
563
-
564
- expect(suggestions.length).toBe(
565
- exampleCaseClassificationSuggestions.length
566
- );
567
-
568
- exampleCaseClassificationSuggestions.forEach(
569
- ({value: expectedValue}, index) =>
570
- expect(suggestions[index].textContent).toBe(expectedValue)
571
- );
572
- });
573
-
574
- it('should automatically select the first case classification suggestion', async () => {
575
- const element = createTestComponent({
576
- ...defaultOptions,
577
- maxSuggestions: exampleMaxSuggestions,
578
- });
579
- mockGetPicklistValuesByRecordTypeWire();
580
-
581
- await flushPromises();
582
-
583
- const suggestionInputs = element.shadowRoot.querySelectorAll(
584
- selectors.caseClassificationSuggestionInput
585
- );
586
-
587
- expect(functionsMocks.update).toHaveBeenCalledTimes(1);
588
- expect(functionsMocks.update).toHaveBeenCalledWith(
589
- exampleCaseClassificationSuggestions[0].value,
590
- {caseClassifications: false, documentSuggestions: false},
591
- true
592
- );
593
- expect(suggestionInputs[0].checked).toBe(true);
594
- });
595
- });
596
-
597
- describe('the case classification remaining options', () => {
598
- const remainingOptions = exampleCaseClassificationAllOptions.filter(
599
- (option) =>
600
- !exampleCaseClassificationSuggestions.some(
601
- (suggestion) => suggestion.value === option.value
602
- )
603
- );
604
-
605
- beforeEach(() => {
606
- caseClassificationState = {
607
- ...initialCaseClassificationState,
608
- suggestions: exampleCaseClassificationSuggestions,
609
- };
610
- });
611
-
612
- it('should not display the all options select input', async () => {
613
- const element = createTestComponent({
614
- ...defaultOptions,
615
- maxSuggestions: exampleMaxSuggestions,
616
- });
617
- mockGetPicklistValuesByRecordTypeWire();
618
-
619
- await flushPromises();
620
-
621
- const showSelectInputButton = element.shadowRoot.querySelector(
622
- selectors.showSelectInputButton
623
- );
624
- const allOptionsSelectInput = element.shadowRoot.querySelector(
625
- selectors.allOptionsSelectInput
626
- );
627
-
628
- expect(showSelectInputButton).toBeNull();
629
- expect(allOptionsSelectInput).toBeNull();
630
- });
631
-
632
- it('should display the case classification remaining options as inline options', async () => {
633
- const element = createTestComponent({
634
- ...defaultOptions,
635
- maxSuggestions: exampleMaxSuggestions,
636
- });
637
- mockGetPicklistValuesByRecordTypeWire();
638
-
639
- await flushPromises();
640
-
641
- const options = element.shadowRoot.querySelectorAll(
642
- selectors.caseClassificationOption
643
- );
644
- const expectedOptionsCount =
645
- exampleCaseClassificationAllOptions.length -
646
- exampleCaseClassificationSuggestions.length;
647
-
648
- expect(options.length).toBe(expectedOptionsCount);
649
- remainingOptions.forEach(({value: expectedValue}, index) =>
650
- expect(options[index].textContent).toBe(expectedValue)
651
- );
652
- });
653
-
654
- describe('when a case classification remaining options is clicked', () => {
655
- it('should call the update method of the case field controller with the right parameter', async () => {
656
- const automaticallySelectedSuggestionIndex = 0;
657
- const exampleSelectedSuggestionIndex = 1;
658
- const element = createTestComponent({
659
- ...defaultOptions,
660
- maxSuggestions: exampleMaxSuggestions,
661
- });
662
- mockGetPicklistValuesByRecordTypeWire();
663
-
664
- await flushPromises();
665
-
666
- expect(functionsMocks.update).toHaveBeenCalledTimes(1);
667
- expect(functionsMocks.update).toHaveBeenCalledWith(
668
- exampleCaseClassificationSuggestions[
669
- automaticallySelectedSuggestionIndex
670
- ].value,
671
- {caseClassifications: false, documentSuggestions: false},
672
- true
673
- );
674
-
675
- const optionInputs = element.shadowRoot.querySelectorAll(
676
- selectors.caseClassificationOptionInput
677
- );
678
-
679
- optionInputs[exampleSelectedSuggestionIndex].click();
680
- await flushPromises();
681
-
682
- expect(functionsMocks.update).toHaveBeenCalledTimes(2);
683
- expect(functionsMocks.update).toHaveBeenCalledWith(
684
- remainingOptions[exampleSelectedSuggestionIndex].value,
685
- {caseClassifications: false, documentSuggestions: false},
686
- undefined
687
- );
688
- });
689
- });
690
- });
691
- });
692
-
693
- describe('when no case classification suggestions are found', () => {
694
- beforeEach(() => {
695
- caseClassificationState = {
696
- ...initialCaseClassificationState,
697
- suggestions: [],
698
- };
699
- });
700
-
701
- it('should not display any case classification suggestions, but still display the options select input', async () => {
702
- const element = createTestComponent();
703
- mockGetPicklistValuesByRecordTypeWire();
704
-
705
- await flushPromises();
706
-
707
- const suggestions = element.shadowRoot.querySelectorAll(
708
- selectors.caseClassificationSuggestion
709
- );
710
- expect(suggestions.length).toBe(0);
711
-
712
- const showSelectInputButton = element.shadowRoot.querySelector(
713
- selectors.showSelectInputButton
714
- );
715
- expect(showSelectInputButton).toBeNull();
716
-
717
- const allOptionsSelectInput = element.shadowRoot.querySelector(
718
- selectors.allOptionsSelectInput
719
- );
720
-
721
- expect(allOptionsSelectInput).not.toBeNull();
722
- expect(allOptionsSelectInput.options).toStrictEqual(
723
- exampleCaseClassificationAllOptions
724
- );
725
- expect(allOptionsSelectInput.value).not.toBeDefined();
726
- expect(allOptionsSelectInput.placeholder).toBe(exampleMoreTopicsLabel);
727
- });
728
- });
729
- });
730
-
731
- describe('the reportValidity public method', () => {
732
- describe('when the property required is set to true', () => {
733
- it('should display a validity error when reportValidity is called and no value is selected', async () => {
734
- caseClassificationState = {
735
- ...initialCaseClassificationState,
736
- suggestions: [],
737
- };
738
- const element = createTestComponent({
739
- ...defaultOptions,
740
- required: true,
741
- });
742
- mockGetPicklistValuesByRecordTypeWire();
743
- await flushPromises();
744
-
745
- element.reportValidity();
746
- await flushPromises();
747
-
748
- const classificationErrorMessage = element.shadowRoot.querySelector(
749
- selectors.classificationErrorMessage
750
- );
751
-
752
- expect(classificationErrorMessage).not.toBeNull();
753
- expect(classificationErrorMessage.textContent).toBe(
754
- exampleSelectOptionLabel
755
- );
756
- });
757
-
758
- it('should not display a validity error when reportValidity is called and a value is selected', async () => {
759
- const element = createTestComponent({
760
- ...defaultOptions,
761
- required: true,
762
- });
763
- mockGetPicklistValuesByRecordTypeWire();
764
- await flushPromises();
765
-
766
- element.reportValidity();
767
- await flushPromises();
768
-
769
- const classificationErrorMessage = element.shadowRoot.querySelector(
770
- selectors.classificationErrorMessage
771
- );
772
-
773
- expect(classificationErrorMessage).toBeNull();
774
- });
775
- });
776
-
777
- describe('when the property required is set to false', () => {
778
- it('should not display a validity error when reportValidity is called and no value is selected', async () => {
779
- caseClassificationState = {
780
- ...initialCaseClassificationState,
781
- suggestions: [],
782
- };
783
- const element = createTestComponent({
784
- ...defaultOptions,
785
- required: false,
786
- });
787
- mockGetPicklistValuesByRecordTypeWire();
788
- await flushPromises();
789
-
790
- element.reportValidity();
791
- await flushPromises();
792
-
793
- const classificationErrorMessage = element.shadowRoot.querySelector(
794
- selectors.classificationErrorMessage
795
- );
796
-
797
- expect(classificationErrorMessage).toBeNull();
798
- });
799
-
800
- it('should not display a validity error when reportValidity is called and a value is selected', async () => {
801
- const element = createTestComponent({
802
- ...defaultOptions,
803
- required: false,
804
- });
805
- mockGetPicklistValuesByRecordTypeWire();
806
- await flushPromises();
807
-
808
- element.reportValidity();
809
- await flushPromises();
810
-
811
- const classificationErrorMessage = element.shadowRoot.querySelector(
812
- selectors.classificationErrorMessage
813
- );
814
-
815
- expect(classificationErrorMessage).toBeNull();
816
- });
817
- });
818
- });
819
- });