@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,324 +0,0 @@
1
- // @ts-ignore
2
- import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
3
- // @ts-ignore
4
- import {createElement} from 'lwc';
5
- import QuanticResultPrintableUri from '../quanticResultPrintableUri';
6
-
7
- const MIN_MAX_NUMBER_OF_PARTS = 3;
8
-
9
- jest.mock('c/quanticHeadlessLoader');
10
-
11
- // Helper function to mock Headless and Bueno for this suite of tests.
12
- function mockHeadlessAndBueno() {
13
- jest.spyOn(mockHeadlessLoader, 'getHeadlessEnginePromise').mockReturnValue(
14
- new Promise((resolve) => {
15
- resolve();
16
- })
17
- );
18
-
19
- jest.spyOn(mockHeadlessLoader, 'getBueno').mockReturnValue(
20
- new Promise(() => {
21
- // @ts-ignore
22
- global.Bueno = {
23
- isString: jest
24
- .fn()
25
- .mockImplementation(
26
- (value) =>
27
- Object.prototype.toString.call(value) === '[object String]'
28
- ),
29
- };
30
- })
31
- );
32
- }
33
-
34
- const selectors = {
35
- link: 'c-quantic-result-link',
36
- pathItem: '[data-test="path__item"]',
37
- pathExpandButton: '[data-test="path__expand-button"]',
38
- errorMessage: '[data-test="error"]',
39
- };
40
- const exampleEngineId = 'example engine id';
41
-
42
- function createTestComponent(options) {
43
- const element = createElement('c-quantic-result-printable-uri', {
44
- is: QuanticResultPrintableUri,
45
- });
46
-
47
- for (const [key, value] of Object.entries(options)) {
48
- element[key] = value;
49
- }
50
-
51
- document.body.appendChild(element);
52
- return element;
53
- }
54
-
55
- // Helper function to wait until the microtask queue is empty.
56
- function flushPromises() {
57
- return new Promise((resolve) => setTimeout(resolve, 0));
58
- }
59
-
60
- function generateExampleUri(id) {
61
- return `https://uri${id}.com/`;
62
- }
63
-
64
- function generateResultParents(numberOfParents) {
65
- let parents = '';
66
- for (let i = 1; i <= numberOfParents; i++) {
67
- parents += `<parent name="parent${i}" uri="${generateExampleUri(i)}" />`;
68
- }
69
- return `<parents>${parents}</parents>`;
70
- }
71
-
72
- function shouldProperlyDisplayAllPathItems(pathItems) {
73
- pathItems.forEach((item, index) => {
74
- expect(item.textContent).toBe(`parent${index + 1}`);
75
- expect(item.href).toBe(`${generateExampleUri(index + 1)}`);
76
- });
77
- }
78
-
79
- describe('c-quantic-result-printable-uri', () => {
80
- function cleanup() {
81
- // The jsdom instance is shared across test cases in a single file so reset the DOM
82
- while (document.body.firstChild) {
83
- document.body.removeChild(document.body.firstChild);
84
- }
85
- jest.clearAllMocks();
86
- }
87
-
88
- beforeEach(() => {
89
- console.error = jest.fn();
90
- mockHeadlessAndBueno();
91
- });
92
-
93
- afterEach(() => {
94
- cleanup();
95
- });
96
-
97
- describe('when displaying the result path', () => {
98
- describe('when the number of parents is lower than the maxNumberOfParts property', () => {
99
- const numberOfParents = 2;
100
- const exampleResultWithParents = {
101
- raw: {
102
- parents: generateResultParents(numberOfParents),
103
- },
104
- };
105
- it('should properly display all the result path', async () => {
106
- const element = createTestComponent({
107
- result: exampleResultWithParents,
108
- engineId: exampleEngineId,
109
- maxNumberOfParts: 3,
110
- });
111
- await flushPromises();
112
-
113
- const pathItems = element.shadowRoot.querySelectorAll(
114
- selectors.pathItem
115
- );
116
- expect(pathItems).not.toBeNull();
117
- expect(pathItems.length).toBe(numberOfParents);
118
- shouldProperlyDisplayAllPathItems(pathItems);
119
- });
120
- });
121
-
122
- describe('when the number of parents is greater than the maxNumberOfParts property', () => {
123
- const numberOfParents = 8;
124
- const exampleResultWithParents = {
125
- raw: {
126
- parents: generateResultParents(numberOfParents),
127
- },
128
- };
129
-
130
- describe('when the default value of the maxNumberOfParts property is used', () => {
131
- it('should properly display the result collapsed path', async () => {
132
- const defaultMaxNumberOfParts = 5;
133
- const element = createTestComponent({
134
- result: exampleResultWithParents,
135
- engineId: exampleEngineId,
136
- });
137
- await flushPromises();
138
-
139
- const pathItems = Array.from(
140
- element.shadowRoot.querySelectorAll(selectors.pathItem)
141
- );
142
- const expandButton = element.shadowRoot.querySelector(
143
- selectors.pathExpandButton
144
- );
145
- expect(pathItems).not.toBeNull();
146
- expect(pathItems.length).toBe(defaultMaxNumberOfParts);
147
- pathItems
148
- .slice(0, defaultMaxNumberOfParts - 1)
149
- .forEach((item, index) => {
150
- expect(item.textContent).toBe(`parent${index + 1}`);
151
- expect(item.href).toBe(`${generateExampleUri(index + 1)}`);
152
- });
153
-
154
- expect(expandButton).not.toBeNull();
155
-
156
- expect(pathItems[defaultMaxNumberOfParts - 1].textContent).toBe(
157
- `parent${numberOfParents}`
158
- );
159
- expect(pathItems[defaultMaxNumberOfParts - 1].href).toBe(
160
- `${generateExampleUri(numberOfParents)}`
161
- );
162
- });
163
-
164
- describe('when expanding the result collapsed path', () => {
165
- it('should properly display the result expanded path', async () => {
166
- const element = createTestComponent({
167
- result: exampleResultWithParents,
168
- engineId: exampleEngineId,
169
- });
170
- await flushPromises();
171
-
172
- let expandButton = element.shadowRoot.querySelector(
173
- selectors.pathExpandButton
174
- );
175
-
176
- expect(expandButton).not.toBeNull();
177
-
178
- await expandButton.click();
179
-
180
- const pathItems = element.shadowRoot.querySelectorAll(
181
- selectors.pathItem
182
- );
183
- expandButton = element.shadowRoot.querySelector(
184
- selectors.pathExpandButton
185
- );
186
-
187
- expect(expandButton).toBeNull();
188
- expect(pathItems).not.toBeNull();
189
- expect(pathItems.length).toBe(numberOfParents);
190
- shouldProperlyDisplayAllPathItems(pathItems);
191
- });
192
- });
193
- });
194
-
195
- describe('when a custom value of the maxNumberOfParts property is used', () => {
196
- const customMaxNumberOfParts = 3;
197
-
198
- it('should properly display the result collapsed path', async () => {
199
- const element = createTestComponent({
200
- result: exampleResultWithParents,
201
- engineId: exampleEngineId,
202
- maxNumberOfParts: customMaxNumberOfParts,
203
- });
204
- await flushPromises();
205
-
206
- const pathItems = Array.from(
207
- element.shadowRoot.querySelectorAll(selectors.pathItem)
208
- );
209
- const expandButton = element.shadowRoot.querySelector(
210
- selectors.pathExpandButton
211
- );
212
- expect(pathItems).not.toBeNull();
213
- expect(pathItems.length).toBe(customMaxNumberOfParts);
214
- pathItems
215
- .slice(0, customMaxNumberOfParts - 1)
216
- .forEach((item, index) => {
217
- expect(item.textContent).toBe(`parent${index + 1}`);
218
- expect(item.href).toBe(`${generateExampleUri(index + 1)}`);
219
- });
220
-
221
- expect(expandButton).not.toBeNull();
222
-
223
- expect(pathItems[customMaxNumberOfParts - 1].textContent).toBe(
224
- `parent${numberOfParents}`
225
- );
226
- expect(pathItems[customMaxNumberOfParts - 1].href).toBe(
227
- `${generateExampleUri(numberOfParents)}`
228
- );
229
- });
230
-
231
- describe('when expanding the result collapsed path', () => {
232
- it('should properly display the result expanded path', async () => {
233
- const element = createTestComponent({
234
- result: exampleResultWithParents,
235
- engineId: exampleEngineId,
236
- maxNumberOfParts: customMaxNumberOfParts,
237
- });
238
- await flushPromises();
239
-
240
- let expandButton = element.shadowRoot.querySelector(
241
- selectors.pathExpandButton
242
- );
243
-
244
- expect(expandButton).not.toBeNull();
245
-
246
- await expandButton.click();
247
-
248
- const pathItems = element.shadowRoot.querySelectorAll(
249
- selectors.pathItem
250
- );
251
- expandButton = element.shadowRoot.querySelector(
252
- selectors.pathExpandButton
253
- );
254
-
255
- expect(expandButton).toBeNull();
256
- expect(pathItems).not.toBeNull();
257
- expect(pathItems.length).toBe(numberOfParents);
258
- shouldProperlyDisplayAllPathItems(pathItems);
259
- });
260
- });
261
- });
262
- });
263
- });
264
-
265
- describe('when displaying the result url', () => {
266
- const exampleResult = {
267
- title: 'example title',
268
- clickUri: 'https://coveo.com/',
269
- raw: {
270
- parents: '',
271
- },
272
- };
273
-
274
- it('should display the printable uri using the quantic result link component', async () => {
275
- const customTarget = '_blank';
276
- const element = createTestComponent({
277
- result: exampleResult,
278
- target: customTarget,
279
- engineId: exampleEngineId,
280
- });
281
- await flushPromises();
282
-
283
- const link = element.shadowRoot.querySelector(selectors.link);
284
-
285
- expect(link).not.toBeNull();
286
- expect(link.engineId).toBe(exampleEngineId);
287
- expect(link.result).toEqual(exampleResult);
288
- expect(link.displayedField).toBe('printableUri');
289
- expect(link.target).toBe(customTarget);
290
- });
291
- });
292
-
293
- describe('when given invalid value of the property maxNumberOfParts', () => {
294
- const exampleResult = {
295
- title: 'example title',
296
- clickUri: 'https://coveo.com/',
297
- raw: {
298
- parents: '',
299
- },
300
- };
301
- const invalidMaxNumberOfParts = 1;
302
-
303
- it('should display an error message', async () => {
304
- const element = createTestComponent({
305
- engineId: exampleEngineId,
306
- result: exampleResult,
307
- maxNumberOfParts: invalidMaxNumberOfParts,
308
- });
309
- await flushPromises();
310
-
311
- const errorMessage = element.shadowRoot.querySelector(
312
- selectors.errorMessage
313
- );
314
-
315
- expect(errorMessage).not.toBeNull();
316
- expect(errorMessage.textContent).toBe(
317
- 'c-quantic-result-printable-uri Error'
318
- );
319
- expect(console.error).toHaveBeenCalledWith(
320
- `The provided value of ${invalidMaxNumberOfParts} for the maxNumberOfParts option is inadequate. The provided value must be at least ${MIN_MAX_NUMBER_OF_PARTS}.`
321
- );
322
- });
323
- });
324
- });
@@ -1,308 +0,0 @@
1
- /* eslint-disable jest/no-conditional-expect */
2
- import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
3
- // @ts-ignore
4
- import {createElement} from 'lwc';
5
- import QuanticResultQuickview from '../quanticResultQuickview';
6
-
7
- const selectors = {
8
- quickviewButton: '[data-testid="quick-view-button"]',
9
- closeQuickviewButton: '[data-testid="quickview-modal__close-button"]',
10
- quickviewContent: 'c-quantic-quickview-content',
11
- icon: 'lightning-icon',
12
- tooltip: 'c-quantic-tooltip',
13
- };
14
-
15
- jest.mock('c/quanticHeadlessLoader');
16
- jest.mock(
17
- '@salesforce/label/c.quantic_OpenPreview',
18
- () => ({default: 'Open preview'}),
19
- {
20
- virtual: true,
21
- }
22
- );
23
- jest.mock(
24
- '@salesforce/label/c.quantic_OpenFileForPreview',
25
- () => ({default: 'Open file for preview'}),
26
- {
27
- virtual: true,
28
- }
29
- );
30
- jest.mock(
31
- '@salesforce/label/c.quantic_NoPreviewAvailable',
32
- () => ({default: 'No preview available'}),
33
- {
34
- virtual: true,
35
- }
36
- );
37
- jest.mock('@salesforce/label/c.quantic_Close', () => ({default: 'Close'}), {
38
- virtual: true,
39
- });
40
-
41
- const exampleResult = {
42
- raw: {
43
- date: '123',
44
- },
45
- title: 'abc',
46
- uniqueId: '123',
47
- parentResult: {},
48
- childResults: [],
49
- };
50
-
51
- const functionMocks = {
52
- pushRecentResult: jest.fn(),
53
- dispatchEvent: jest.fn(),
54
- };
55
-
56
- function createTestComponent(options = {result: exampleResult}) {
57
- const element = createElement('c-quantic-result-quick-view', {
58
- is: QuanticResultQuickview,
59
- });
60
-
61
- if (options) {
62
- for (const [key, value] of Object.entries(options)) {
63
- element[key] = value;
64
- }
65
- }
66
-
67
- document.body.appendChild(element);
68
-
69
- return element;
70
- }
71
-
72
- // Helper function to wait until the microtask queue is empty.
73
- function flushPromises() {
74
- // eslint-disable-next-line @lwc/lwc/no-async-operation
75
- return new Promise((resolve) => setTimeout(resolve, 0));
76
- }
77
-
78
- let useCase = 'search';
79
-
80
- function mockHeadless(hasPreview = true) {
81
- jest.spyOn(mockHeadlessLoader, 'getHeadlessBundle').mockReturnValue({
82
- buildQuickview: () => ({
83
- state: {resultHasPreview: hasPreview},
84
- fetchResultContent: jest.fn(),
85
- subscribe: jest.fn((callback) => {
86
- callback();
87
- }),
88
- cancelPendingSelect: jest.fn(),
89
- }),
90
- buildInteractiveResult: jest.fn(),
91
- loadRecentResultsActions: () => ({
92
- pushRecentResult: functionMocks.pushRecentResult,
93
- }),
94
- });
95
-
96
- jest
97
- .spyOn(mockHeadlessLoader, 'isHeadlessBundle')
98
- .mockReturnValue(useCase === 'search');
99
-
100
- jest.spyOn(mockHeadlessLoader, 'getHeadlessEnginePromise').mockReturnValue(
101
- new Promise((resolve) => {
102
- resolve({
103
- dispatch: jest.fn(),
104
- });
105
- })
106
- );
107
- }
108
-
109
- function mockBueno() {
110
- jest.spyOn(mockHeadlessLoader, 'getBueno').mockReturnValue(
111
- new Promise(() => {
112
- // @ts-ignore
113
- global.Bueno = {
114
- isString: jest
115
- .fn()
116
- .mockImplementation(
117
- (value) =>
118
- Object.prototype.toString.call(value) === '[object String]'
119
- ),
120
- };
121
- })
122
- );
123
- }
124
-
125
- function cleanup() {
126
- // The jsdom instance is shared across test cases in a single file so reset the DOM.
127
- while (document.body.firstChild) {
128
- document.body.removeChild(document.body.firstChild);
129
- }
130
- jest.clearAllMocks();
131
- }
132
-
133
- describe('c-quantic-result-quick-view', () => {
134
- beforeEach(() => {
135
- mockHeadless();
136
- mockBueno();
137
- });
138
-
139
- afterEach(() => {
140
- cleanup();
141
- });
142
-
143
- it('should dispatch the pushRecentResult action', async () => {
144
- const element = createTestComponent();
145
- await flushPromises();
146
-
147
- const quickViewButton = element.shadowRoot.querySelector(
148
- selectors.quickviewButton
149
- );
150
- expect(quickViewButton.disabled).toBeFalsy();
151
- await quickViewButton.click();
152
- await flushPromises();
153
-
154
- // eslint-disable-next-line no-unused-vars
155
- const {parentResult, childResults, ...expectedPayload} = exampleResult;
156
-
157
- expect(functionMocks.pushRecentResult).toHaveBeenCalledTimes(1);
158
- expect(functionMocks.pushRecentResult).toHaveBeenCalledWith(
159
- expectedPayload
160
- );
161
- });
162
-
163
- describe('when the result has no preview', () => {
164
- beforeEach(() => {
165
- jest.clearAllMocks();
166
- mockHeadless(false);
167
- mockBueno();
168
- });
169
-
170
- afterEach(() => {
171
- cleanup();
172
- });
173
-
174
- it('should disable the quickview button', async () => {
175
- const element = createTestComponent();
176
- await flushPromises();
177
-
178
- const quickViewButton = element.shadowRoot.querySelector(
179
- selectors.quickviewButton
180
- );
181
-
182
- expect(quickViewButton.disabled).toBeTruthy();
183
- });
184
- });
185
-
186
- describe('when the component has custom properties', () => {
187
- it('should render the custom icon correctly', async () => {
188
- const customIcon = 'utility:file';
189
- const customOptions = {
190
- result: exampleResult,
191
- previewButtonIcon: customIcon,
192
- };
193
- const element = createTestComponent(customOptions);
194
- await flushPromises();
195
-
196
- const quickViewIcon = element.shadowRoot.querySelector(selectors.icon);
197
-
198
- expect(quickViewIcon.iconName).toBe(customIcon);
199
- });
200
-
201
- it('should render the custom label correctly', async () => {
202
- const customOptions = {
203
- result: exampleResult,
204
- previewButtonLabel: 'Custom Label',
205
- };
206
- const element = createTestComponent(customOptions);
207
- await flushPromises();
208
-
209
- const quickViewButton = element.shadowRoot.querySelector(
210
- selectors.quickviewButton
211
- );
212
-
213
- expect(quickViewButton.textContent).toContain('Custom Label');
214
- expect(quickViewButton.querySelector(selectors.icon).classList).toContain(
215
- 'slds-button__icon_right'
216
- );
217
- });
218
-
219
- it.each([['brand'], ['outline_brand'], ['result-action']])(
220
- 'should render the custom variant %s',
221
- async (testVariant) => {
222
- const customOptions = {
223
- result: exampleResult,
224
- previewButtonVariant: testVariant,
225
- dispatchEvent: functionMocks.dispatchEvent,
226
- };
227
-
228
- const element = createTestComponent(customOptions);
229
- await flushPromises();
230
-
231
- const quickViewButton = element.shadowRoot.querySelector(
232
- selectors.quickviewButton
233
- );
234
-
235
- if (testVariant === 'result-action') {
236
- expect(quickViewButton.classList).toContain(
237
- 'slds-button_icon-border-filled'
238
- );
239
- expect(functionMocks.dispatchEvent).toHaveBeenCalledTimes(2);
240
- expect(functionMocks.dispatchEvent.mock.calls[0][0].type).toBe(
241
- 'quantic__resultactionregister'
242
- );
243
- } else {
244
- expect(quickViewButton.classList).toContain(
245
- `slds-button_${testVariant}`
246
- );
247
- expect(functionMocks.dispatchEvent).toHaveBeenCalledTimes(1);
248
- expect(functionMocks.dispatchEvent.mock.calls[0][0].type).toBe(
249
- 'quantic__haspreview'
250
- );
251
- }
252
- }
253
- );
254
-
255
- it('should render the tooltip correctly', async () => {
256
- const customOptions = {
257
- result: exampleResult,
258
- tooltip: 'Custom Tooltip',
259
- };
260
- const element = createTestComponent(customOptions);
261
- await flushPromises();
262
-
263
- const tooltip = element.shadowRoot.querySelector(selectors.tooltip);
264
-
265
- expect(tooltip.textContent).toBe('Custom Tooltip');
266
- });
267
- });
268
-
269
- describe('when the quickview is opened and closed', () => {
270
- it('should open the quickview modal', async () => {
271
- const element = createTestComponent();
272
- await flushPromises();
273
-
274
- const quickViewButton = element.shadowRoot.querySelector(
275
- selectors.quickviewButton
276
- );
277
- await quickViewButton.click();
278
- await flushPromises();
279
-
280
- const modal = element.shadowRoot.querySelector(
281
- selectors.quickviewContent
282
- );
283
- expect(modal).not.toBeNull();
284
- });
285
-
286
- it('should close the quickview modal', async () => {
287
- const element = createTestComponent();
288
- await flushPromises();
289
-
290
- const quickViewButton = element.shadowRoot.querySelector(
291
- selectors.quickviewButton
292
- );
293
- await quickViewButton.click();
294
- await flushPromises();
295
-
296
- const closeButton = element.shadowRoot.querySelector(
297
- selectors.closeQuickviewButton
298
- );
299
- await closeButton.click();
300
- await flushPromises();
301
-
302
- const modal = element.shadowRoot.querySelector(
303
- selectors.quickviewContent
304
- );
305
- expect(modal).toBeNull();
306
- });
307
- });
308
- });
@@ -1,85 +0,0 @@
1
- import {ResultQuickviewObject} from './pageObject';
2
- import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
3
- import {
4
- searchRequestRegex,
5
- insightSearchRequestRegex,
6
- searchQuickviewRequestRegex,
7
- insightQuickviewRequestRegex,
8
- } from '../../../../../../playwright/utils/requests';
9
- import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
10
- import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
11
- import {SearchObjectWithQuickview} from '../../../../../../playwright/page-object/searchObjectWithQuickview';
12
-
13
- const resultQuickviewUrl = 's/quantic-result-quickview';
14
-
15
- interface ResultQuickviewOptions {
16
- result: string;
17
- maximumPreviewSize: number;
18
- previewButtonIcon: string;
19
- previewButtonLabel: string;
20
- previewButtonVariant: string;
21
- tooltip: string;
22
- }
23
- type QuanticResultQuickviewE2ESearchFixtures = {
24
- resultQuickview: ResultQuickviewObject;
25
- search: SearchObjectWithQuickview;
26
- options: Partial<ResultQuickviewOptions>;
27
- };
28
-
29
- type QuanticResultQuickviewE2EInsightFixtures =
30
- QuanticResultQuickviewE2ESearchFixtures & {
31
- insightSetup: InsightSetupObject;
32
- };
33
-
34
- export const testSearch =
35
- quanticBase.extend<QuanticResultQuickviewE2ESearchFixtures>({
36
- options: {},
37
- search: async ({page}, use) => {
38
- await use(
39
- new SearchObjectWithQuickview(
40
- page,
41
- searchRequestRegex,
42
- searchQuickviewRequestRegex
43
- )
44
- );
45
- },
46
- resultQuickview: async ({page, options, configuration, search}, use) => {
47
- await search.mockSearchWithBaseResponse();
48
- await page.goto(resultQuickviewUrl);
49
- await configuration.configure(options);
50
- await use(new ResultQuickviewObject(page));
51
- },
52
- });
53
-
54
- export const testInsight =
55
- quanticBase.extend<QuanticResultQuickviewE2EInsightFixtures>({
56
- options: {},
57
- search: async ({page}, use) => {
58
- await use(
59
- new SearchObjectWithQuickview(
60
- page,
61
- insightSearchRequestRegex,
62
- insightQuickviewRequestRegex
63
- )
64
- );
65
- },
66
- insightSetup: async ({page}, use) => {
67
- await use(new InsightSetupObject(page));
68
- },
69
- resultQuickview: async (
70
- {page, options, search, configuration, insightSetup},
71
- use
72
- ) => {
73
- await search.mockSearchWithBaseResponse();
74
- await page.goto(resultQuickviewUrl);
75
- await configuration.configure({...options, useCase: useCaseEnum.insight});
76
- await insightSetup.waitForInsightInterfaceInitialization();
77
- await Promise.all([
78
- search.waitForSearchResponse(),
79
- search.performSearch(),
80
- ]);
81
- await use(new ResultQuickviewObject(page));
82
- },
83
- });
84
-
85
- export {expect} from '@playwright/test';