@coveo/quantic 3.44.0 → 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 (205) 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/quanticNumberButton/quanticNumberButton.js +5 -1
  4. package/force-app/main/default/lwc/quanticPager/quanticPager.html +8 -5
  5. package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
  6. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  7. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  8. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  9. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
  10. package/package.json +37 -34
  11. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
  12. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
  13. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
  15. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  16. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
  17. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  18. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  19. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  20. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  21. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  22. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  23. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
  24. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
  25. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
  26. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
  27. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
  28. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
  29. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  30. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
  31. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
  32. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
  33. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
  34. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
  35. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
  36. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
  37. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
  38. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
  39. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
  40. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
  41. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
  42. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
  43. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
  44. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
  45. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
  46. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
  47. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
  48. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
  49. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  50. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  51. package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
  52. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
  53. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  54. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  55. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
  56. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  57. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  58. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
  59. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
  60. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
  61. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
  62. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
  63. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
  64. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  65. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
  66. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
  67. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
  68. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
  69. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
  70. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
  71. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
  72. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
  73. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
  74. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
  75. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
  76. package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
  77. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  78. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  79. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
  80. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
  81. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
  82. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
  83. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
  84. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
  85. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
  86. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
  87. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
  88. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
  89. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
  90. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
  91. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
  92. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
  93. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  94. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
  95. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
  96. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  97. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  98. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  99. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  100. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
  101. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
  102. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
  103. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
  104. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
  105. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
  106. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
  107. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
  108. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
  109. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
  110. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
  111. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
  112. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
  113. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
  114. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  115. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  116. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  117. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
  118. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
  119. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
  120. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
  121. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  122. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  123. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  124. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
  125. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
  126. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
  127. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
  128. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
  129. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  130. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  131. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  132. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
  133. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
  134. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
  135. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
  136. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
  137. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  138. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
  139. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
  140. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  141. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  142. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
  143. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
  144. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
  145. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
  146. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
  147. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
  148. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
  149. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
  150. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
  151. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  152. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  153. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
  154. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  155. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  156. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  157. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  158. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  159. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  160. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
  161. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  162. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  163. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  164. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
  165. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
  166. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
  167. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
  168. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
  169. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
  170. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
  171. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
  172. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  173. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
  174. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
  175. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
  176. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
  177. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
  178. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  179. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
  180. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  181. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
  182. package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
  183. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
  184. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
  185. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
  186. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
  187. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
  188. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  189. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  190. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  191. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  192. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  193. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  194. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  195. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  196. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  197. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  198. package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
  199. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
  200. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  201. package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
  202. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
  203. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
  204. package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
  205. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,84 +0,0 @@
1
- import {
2
- extractTextToHighlight,
3
- generateTextFragmentUrl,
4
- } from '../citationAnchoringUtils';
5
-
6
- describe('c/citationAnchoringUtils', () => {
7
- describe('extractTextToHighlight', () => {
8
- it('returns the first sentence of a passage', () => {
9
- const text =
10
- 'This is the first sentence. This is the second sentence. This is the third sentence.';
11
- const result = extractTextToHighlight(text);
12
- expect(result).toBe('This is the first sentence.');
13
- });
14
-
15
- it('returns first full sentence even when passages begin in the middle of a sentence', () => {
16
- const text =
17
- 'middle of a sentence. This is the first full sentence. This is the second sentence.';
18
- const result = extractTextToHighlight(text);
19
- expect(result).toBe('This is the first full sentence.');
20
- });
21
-
22
- it('returns the first five words as a fallback if no sentences are found', () => {
23
- const text = 'This is a test using the fallback';
24
- const result = extractTextToHighlight(text);
25
- expect(result).toBe('This is a test using');
26
- });
27
-
28
- it('handles text with fewer than 5 words', () => {
29
- const text = 'short text';
30
- const result = extractTextToHighlight(text);
31
- expect(result).toBe('short text');
32
- });
33
-
34
- it('handles empty strings', () => {
35
- const text = '';
36
- const result = extractTextToHighlight(text);
37
- expect(result).toBe('');
38
- });
39
-
40
- it('trims whitespace from extracted sentence', () => {
41
- const text =
42
- ' This is a sentence with leading spaces. This is another sentence.';
43
- const result = extractTextToHighlight(text);
44
- expect(result).toBe('This is a sentence with leading spaces.');
45
- });
46
-
47
- it("handles text with decimal numbers that shouldn't break sentence detection", () => {
48
- const text =
49
- 'This sentence has the decimal 3.1415 in it. This is another sentence.';
50
- const result = extractTextToHighlight(text);
51
- expect(result).toBe('This sentence has the decimal 3.1415 in it.');
52
- });
53
-
54
- it('handles ellipses in sentences', () => {
55
- const text = 'This is the first sentence... This is the second sentence.';
56
- const result = extractTextToHighlight(text);
57
- expect(result).toBe('This is the first sentence...');
58
- });
59
-
60
- it('handles multiple punctuation marks', () => {
61
- const text = 'This is the first sentence!? Yes, it is.';
62
- const result = extractTextToHighlight(text);
63
- expect(result).toBe('This is the first sentence!?');
64
- });
65
-
66
- it('handles commas within sentences', () => {
67
- const text =
68
- 'This is the first sentence, which has a comma. This is the second.';
69
- const result = extractTextToHighlight(text);
70
- expect(result).toBe('This is the first sentence, which has a comma.');
71
- });
72
- });
73
-
74
- describe('generateTextFragmentUrl', () => {
75
- it('generates a text fragment URL with the correct encoding', () => {
76
- const uri = 'https://example.com';
77
- const text = 'This is a sample text.';
78
- const result = generateTextFragmentUrl(uri, text);
79
- expect(result).toBe(
80
- 'https://example.com#:~:text=This%20is%20a%20sample%20text.'
81
- );
82
- });
83
- });
84
- });
@@ -1,92 +0,0 @@
1
- import {generateFacetDependencyConditions} from 'c/quanticUtils';
2
-
3
- describe('facet dependencies utils', () => {
4
- describe('generateFacetDependencyConditions', () => {
5
- test('throws error when depending on multiple facets', () => {
6
- expect(() =>
7
- generateFacetDependencyConditions({facet1: 'value1', facet2: 'value2'})
8
- ).toThrow("Depending on multiple facets isn't supported");
9
- });
10
-
11
- test('returns an array with a single GenericCondition', () => {
12
- const dependsOn = {facet1: 'value1'};
13
- const result = generateFacetDependencyConditions(dependsOn);
14
-
15
- expect(result).toHaveLength(1);
16
- expect(result[0]).toEqual(
17
- expect.objectContaining({
18
- parentFacetId: 'facet1',
19
- condition: expect.any(Function),
20
- })
21
- );
22
- });
23
-
24
- test('condition function returns true when expected value matches SimpleFacetValue', () => {
25
- const dependsOn = {facet1: 'value1'};
26
- const result = generateFacetDependencyConditions(dependsOn);
27
- const conditionFn = result[0].condition;
28
-
29
- const values = [{value: 'value1', state: 'selected'}];
30
- expect(conditionFn(values)).toBe(true);
31
- });
32
-
33
- test('condition function returns false when expected value does not match SimpleFacetValue', () => {
34
- const dependsOn = {facet1: 'value1'};
35
- const result = generateFacetDependencyConditions(dependsOn);
36
- const conditionFn = result[0].condition;
37
-
38
- const values = [{value: 'otherValue', state: 'selected'}];
39
- expect(conditionFn(values)).toBe(false);
40
- });
41
-
42
- test('condition function returns true when expected value matches selected CategoryFacetValue', () => {
43
- const dependsOn = {facet1: 'categoryValue'};
44
- const result = generateFacetDependencyConditions(dependsOn);
45
- const conditionFn = result[0].condition;
46
-
47
- const values = [
48
- {
49
- value: 'parent',
50
- state: 'not-selected',
51
- children: [{value: 'categoryValue', state: 'selected', children: []}],
52
- },
53
- ];
54
-
55
- expect(conditionFn(values)).toBe(true);
56
- });
57
-
58
- test('condition function returns false when CategoryFacetValue does not contain expected value', () => {
59
- const dependsOn = {facet1: 'nonMatchingValue'};
60
- const result = generateFacetDependencyConditions(dependsOn);
61
- const conditionFn = result[0].condition;
62
-
63
- const values = [
64
- {
65
- value: 'parent',
66
- state: 'not-selected',
67
- children: [{value: 'categoryValue', state: 'selected', children: []}],
68
- },
69
- ];
70
-
71
- expect(conditionFn(values)).toBe(false);
72
- });
73
-
74
- test('condition function returns false when CategoryFacetValue is not selected', () => {
75
- const dependsOn = {facet1: 'categoryValue'};
76
- const result = generateFacetDependencyConditions(dependsOn);
77
- const conditionFn = result[0].condition;
78
-
79
- const values = [
80
- {
81
- value: 'parent',
82
- state: 'not-selected',
83
- children: [
84
- {value: 'categoryValue', state: 'not-selected', children: []},
85
- ],
86
- },
87
- ];
88
-
89
- expect(conditionFn(values)).toBe(false);
90
- });
91
- });
92
- });
@@ -1,86 +0,0 @@
1
- import {Store} from 'c/quanticUtils';
2
-
3
- describe('storeUtils', () => {
4
- describe('Store.facetTypes', () => {
5
- it('should expose the expected facet type keys', () => {
6
- expect(Store.facetTypes).toEqual({
7
- FACETS: 'facets',
8
- NUMERICFACETS: 'numericFacets',
9
- DATEFACETS: 'dateFacets',
10
- CATEGORYFACETS: 'categoryFacets',
11
- });
12
- });
13
- });
14
-
15
- describe('Store.initialize', () => {
16
- it('should return a store with empty state', () => {
17
- const store = Store.initialize();
18
- expect(store).toEqual({
19
- state: {
20
- facets: {},
21
- numericFacets: {},
22
- dateFacets: {},
23
- categoryFacets: {},
24
- sort: {},
25
- },
26
- });
27
- });
28
- });
29
-
30
- describe('Store.registerFacetToStore', () => {
31
- it('should register facet data under the given facet type and id', () => {
32
- const store = Store.initialize();
33
- const data = {facetId: 'author', label: 'Author'};
34
- Store.registerFacetToStore(store, 'facets', data);
35
- expect(store.state.facets.author).toEqual(data);
36
- });
37
-
38
- it('should not overwrite an existing facet entry', () => {
39
- const store = Store.initialize();
40
- const data = {facetId: 'author', label: 'Author'};
41
- Store.registerFacetToStore(store, 'facets', data);
42
- Store.registerFacetToStore(store, 'facets', {
43
- facetId: 'author',
44
- label: 'Updated',
45
- });
46
- expect(store.state.facets.author.label).toBe('Author');
47
- });
48
- });
49
-
50
- describe('Store.registerSortOptionDataToStore', () => {
51
- it('should set sort data on the store', () => {
52
- const store = Store.initialize();
53
- const sortData = [{label: 'Relevance', value: 'relevance'}];
54
- Store.registerSortOptionDataToStore(store, sortData);
55
- expect(store.state.sort).toBe(sortData);
56
- });
57
- });
58
-
59
- describe('Store.getFromStore', () => {
60
- it('should return facet data for the given type', () => {
61
- const store = Store.initialize();
62
- const data = {facetId: 'source', label: 'Source'};
63
- Store.registerFacetToStore(store, 'facets', data);
64
- expect(Store.getFromStore(store, 'facets')).toEqual({source: data});
65
- });
66
-
67
- it('should return an empty object when no facets are registered', () => {
68
- const store = Store.initialize();
69
- expect(Store.getFromStore(store, 'facets')).toEqual({});
70
- });
71
- });
72
-
73
- describe('Store.getSortOptionsFromStore', () => {
74
- it('should return the sort options', () => {
75
- const store = Store.initialize();
76
- const sortData = [{label: 'Date', value: 'date'}];
77
- Store.registerSortOptionDataToStore(store, sortData);
78
- expect(Store.getSortOptionsFromStore(store)).toBe(sortData);
79
- });
80
-
81
- it('should return an empty object when no sort options are registered', () => {
82
- const store = Store.initialize();
83
- expect(Store.getSortOptionsFromStore(store)).toEqual({});
84
- });
85
- });
86
- });
@@ -1,109 +0,0 @@
1
- // This is the same js file as what we load inside the LWC via a static resource.
2
- import {transformMarkdownToHtml} from 'c/quanticUtils';
3
- import {marked} from 'marked';
4
-
5
- const removeLineBreaks = (text) => text.replace(/\n/g, '');
6
-
7
- describe('c/markdownUtils', () => {
8
- describe('transformMarkdownToHtml', () => {
9
- it('should transform markdown text to HTML', () => {
10
- const text = 'Hello, world!';
11
- const result = transformMarkdownToHtml(text, marked);
12
- expect(removeLineBreaks(result)).toEqual('<p>Hello, world!</p>');
13
- });
14
-
15
- it('should transform markdown code to HTML <pre><code>', () => {
16
- const text = '```javascript\nconst foo = "bar";\n```';
17
- const result = transformMarkdownToHtml(text, marked);
18
- expect(removeLineBreaks(result)).toEqual(
19
- '<pre><code>const foo = &quot;bar&quot;;</code></pre>'
20
- );
21
- });
22
-
23
- it('should transform markdown heading to HTML <div> with data-level="answer-heading-${level}"', () => {
24
- const text = '# Hello, world!';
25
- const result = transformMarkdownToHtml(text, marked);
26
- expect(removeLineBreaks(result)).toEqual(
27
- '<div data-level="answer-heading-1" aria-label="Hello, world!">Hello, world!</div>'
28
- );
29
- });
30
-
31
- it('should transform markdown heading with formatting to HTML <div>', () => {
32
- const text = '# **bold** and *emphasized* title';
33
- const result = transformMarkdownToHtml(text, marked);
34
- expect(removeLineBreaks(result)).toEqual(
35
- '<div data-level="answer-heading-1" aria-label="bold and emphasized title"><strong>bold</strong> and <em>emphasized</em> title</div>'
36
- );
37
- });
38
-
39
- it('should transform markdown list item to HTML <li>', () => {
40
- const text = '- Hello, world!';
41
- const result = transformMarkdownToHtml(text, marked);
42
- expect(removeLineBreaks(result)).toEqual(
43
- '<ul><li>Hello, world!</li></ul>'
44
- );
45
- });
46
-
47
- it('should transform markdown table to HTML <div class="scrollable-table">', () => {
48
- const text = '| Header |\n| ------ |\n| Cell |';
49
- const result = transformMarkdownToHtml(text, marked);
50
- expect(removeLineBreaks(result)).toEqual(
51
- '<div class="scrollable-table"><table><thead><tr><th>Header</th></tr></thead><tbody><tr><td>Cell</td></tr></tbody></table></div>'
52
- );
53
- });
54
-
55
- it('should complete unclosed inline elements such as bold, italic, and code', () => {
56
- const textBold = '**bold';
57
- const resultBold = transformMarkdownToHtml(textBold, marked);
58
- expect(removeLineBreaks(resultBold)).toEqual(
59
- '<p><strong>bold</strong></p>'
60
- );
61
-
62
- const textItalic = '*italic';
63
- const resultItalic = transformMarkdownToHtml(textItalic, marked);
64
- expect(removeLineBreaks(resultItalic)).toEqual('<p><em>italic</em></p>');
65
-
66
- const textCode = '`code';
67
- const resultCode = transformMarkdownToHtml(textCode, marked);
68
- expect(removeLineBreaks(resultCode)).toEqual('<p><code>code</code></p>');
69
- });
70
-
71
- it('should transform markdown link to HTML <a> with data-answer-inline-link attribute', () => {
72
- const text = '[Google](https://google.com)';
73
- const result = transformMarkdownToHtml(text, marked);
74
- expect(removeLineBreaks(result)).toEqual(
75
- '<p><a href="https://google.com" data-answer-inline-link="true">Google</a></p>'
76
- );
77
- });
78
-
79
- it('should transform markdown link with title to HTML <a> with title attribute', () => {
80
- const text = '[Google](https://google.com "Search Engine")';
81
- const result = transformMarkdownToHtml(text, marked);
82
- expect(removeLineBreaks(result)).toEqual(
83
- '<p><a href="https://google.com" title="Search Engine" data-answer-inline-link="true">Google</a></p>'
84
- );
85
- });
86
-
87
- it('should escape special characters in link href', () => {
88
- const text = '[Link](https://example.com?param="value"&other=test)';
89
- const result = transformMarkdownToHtml(text, marked);
90
- expect(removeLineBreaks(result)).toEqual(
91
- '<p><a href="https://example.com?param=&quot;value&quot;&amp;other=test" data-answer-inline-link="true">Link</a></p>'
92
- );
93
- });
94
-
95
- it('should escape special characters in link title', () => {
96
- const text = '[Link](https://example.com "Title with <script> & quotes")';
97
- const result = transformMarkdownToHtml(text, marked);
98
- expect(removeLineBreaks(result)).toEqual(
99
- '<p><a href="https://example.com" title="Title with &amp;lt;script&amp;gt; &amp;amp; quotes" data-answer-inline-link="true">Link</a></p>'
100
- );
101
- });
102
-
103
- it('should render link text as span when href is missing', () => {
104
- const text = '[Link]()';
105
- const result = transformMarkdownToHtml(text, marked);
106
- expect(removeLineBreaks(result)).toEqual('<p><span>Link</span></p>');
107
- });
108
- });
109
- });
@@ -1,233 +0,0 @@
1
- import {
2
- I18nUtils,
3
- buildTemplateTextFromResult,
4
- copyToClipboard,
5
- unwrapLockerProxiedObject,
6
- } from 'c/quanticUtils';
7
-
8
- describe('c/quanticUtils', () => {
9
- describe('I18nUtils', () => {
10
- it('getTextWithDecorator should return text wrapped in given tags', () => {
11
- const text = 'sample text';
12
- const startTag = '<test-start-tag>';
13
- const endTag = '<test-end-tag>';
14
- expect(I18nUtils.getTextWithDecorator(text, startTag, endTag)).toBe(
15
- `${startTag}${text}${endTag}`
16
- );
17
- });
18
-
19
- it('getTextBold should return text wrapped in bold tags', () => {
20
- const text = 'sample text';
21
- expect(I18nUtils.getTextBold(text)).toBe(`<b>${text}</b>`);
22
- });
23
-
24
- describe('getLabelNameWithCount', () => {
25
- const testLabelName = 'thisLabelName';
26
- const testLabelNamePlural = `${testLabelName}_plural`;
27
- const testLabelNameZero = `${testLabelName}_zero`;
28
-
29
- it('should return plural variant if count not equal to 1', () => {
30
- expect(I18nUtils.getLabelNameWithCount(testLabelName, 99)).toBe(
31
- testLabelNamePlural
32
- );
33
- });
34
-
35
- it('should return plural variant if count is fraction of 1', () => {
36
- expect(I18nUtils.getLabelNameWithCount(testLabelName, 0.5)).toBe(
37
- testLabelNamePlural
38
- );
39
- });
40
-
41
- it('should return zero variant if count is 0', () => {
42
- expect(I18nUtils.getLabelNameWithCount(testLabelName, 0)).toBe(
43
- testLabelNameZero
44
- );
45
- });
46
-
47
- it('should return singular variant if count is equal to 1', () => {
48
- expect(I18nUtils.getLabelNameWithCount(testLabelName, 1)).toBe(
49
- testLabelName
50
- );
51
- });
52
-
53
- it('should return singular variant if count is equal to -1', () => {
54
- expect(I18nUtils.getLabelNameWithCount(testLabelName, -1)).toBe(
55
- testLabelName
56
- );
57
- });
58
-
59
- describe('given other locale', () => {
60
- jest.resetModules();
61
- jest.mock('@salesforce/i18n/locale', () => ({
62
- default: 'de-DE',
63
- }));
64
- const withOtherLocale = require('c/quanticUtils');
65
-
66
- it('should return label name without failing', () => {
67
- expect(() =>
68
- withOtherLocale.I18nUtils.getLabelNameWithCount(testLabelName, 2)
69
- ).not.toThrow();
70
- });
71
- });
72
- });
73
-
74
- describe('format', () => {
75
- it('should throw an error if the given string is not a string', () => {
76
- let caughtError;
77
- try {
78
- I18nUtils.format(undefined);
79
- } catch (error) {
80
- caughtError = error;
81
- }
82
- expect(caughtError).toBeDefined();
83
- });
84
-
85
- it('should return the given string if no formatting arguments are given', () => {
86
- const testString = 'this is a test string';
87
- expect(I18nUtils.format(testString)).toBe(testString);
88
- });
89
-
90
- it('should return the given string with formatting arguments inserted in order', () => {
91
- const testString = 'this is a {{0}} string, {{1}}.';
92
- const test = 'test';
93
- const buddy = 'buddy';
94
- expect(I18nUtils.format(testString, test, buddy)).toBe(
95
- 'this is a test string, buddy.'
96
- );
97
- });
98
- });
99
-
100
- describe('escapeHTML', () => {
101
- it('should escape html tags', () => {
102
- let htmlWithTags = '<div>test string</div>';
103
-
104
- expect(I18nUtils.escapeHTML(htmlWithTags)).toBe(
105
- '&lt;div&gt;test string&lt;/div&gt;'
106
- );
107
- });
108
-
109
- it('should escape html anchor tags', () => {
110
- let htmlWithTags = '<a src="http://www.sketchysite.com"></a>';
111
-
112
- expect(I18nUtils.escapeHTML(htmlWithTags)).toBe(
113
- '&lt;a src="http://www.sketchysite.com"&gt;&lt;/a&gt;'
114
- );
115
- });
116
- });
117
- });
118
-
119
- describe('copy to clipboard', () => {
120
- const mockExecCommand = jest.fn(() => {});
121
- const mockWriteText = jest.fn(() => new Promise(() => {}));
122
-
123
- beforeAll(() => {
124
- Object.defineProperty(document, 'execCommand', {
125
- value: mockExecCommand,
126
- writable: true,
127
- });
128
- });
129
-
130
- afterEach(() => {
131
- jest.clearAllMocks();
132
- });
133
-
134
- describe('when the Clipboard API is available', () => {
135
- it('should correctly perform the copy to clipboard operation using the writeText method', () => {
136
- const exampleText = 'example text';
137
-
138
- Object.defineProperty(navigator, 'clipboard', {
139
- value: {
140
- ...navigator.clipboard,
141
- writeText: mockWriteText,
142
- },
143
- writable: true,
144
- });
145
-
146
- copyToClipboard(exampleText);
147
- expect(mockWriteText).toHaveBeenCalledTimes(1);
148
- expect(mockWriteText.mock.calls[0][0]).toBe(exampleText);
149
- expect(mockExecCommand).toHaveBeenCalledTimes(0);
150
- });
151
- });
152
-
153
- describe('when the Clipboard API is not available', () => {
154
- it('should correctly perform the copy to clipboard operation using the DOM method', () => {
155
- const exampleText = 'example text';
156
-
157
- Object.defineProperty(navigator, 'clipboard', {
158
- value: undefined,
159
- writable: true,
160
- });
161
-
162
- copyToClipboard(exampleText);
163
- expect(mockWriteText).toHaveBeenCalledTimes(0);
164
- expect(mockExecCommand).toHaveBeenCalledTimes(1);
165
- });
166
- });
167
- });
168
-
169
- describe('buildTemplateTextFromResult', () => {
170
- const testTemplate =
171
- '<a href="${clickUri}">${title}</a><br/><br/><quote>${excerpt}</quote>';
172
- const testResult = {
173
- clickUri: 'https://www.example.com',
174
- title: 'Example Title',
175
- excerpt: 'This is an example excerpt.',
176
- };
177
-
178
- it('should return a string with the result values inserted into the template', () => {
179
- // @ts-ignore
180
- expect(buildTemplateTextFromResult(testTemplate, testResult)).toBe(
181
- `<a href="${testResult.clickUri}">${testResult.title}</a><br/><br/><quote>${testResult.excerpt}</quote>`
182
- );
183
- });
184
-
185
- it('should return an empty string if the template is undefined or falsy', () => {
186
- // @ts-ignore
187
- expect(buildTemplateTextFromResult(undefined, testResult)).toBe('');
188
- });
189
-
190
- it('should not return the template field name as placeholder if the result does not contain the field', () => {
191
- const resultWithoutExcerpt = {
192
- clickUri: 'https://www.example.com',
193
- title: 'Example Title',
194
- };
195
-
196
- // @ts-ignore
197
- expect(
198
- buildTemplateTextFromResult(testTemplate, resultWithoutExcerpt)
199
- ).toBe(
200
- `<a href="${testResult.clickUri}">${testResult.title}</a><br/><br/><quote></quote>`
201
- );
202
- });
203
- });
204
-
205
- describe('unwrapLockerObject', () => {
206
- it('should deeply clone complex objects while preserving primitive values', () => {
207
- const original = {
208
- title: 'Example',
209
- raw: {
210
- foo: 'bar',
211
- tags: ['a', {value: 'b'}],
212
- },
213
- score: 42,
214
- };
215
-
216
- const unwrapped = unwrapLockerProxiedObject(original);
217
-
218
- expect(unwrapped).toEqual(original);
219
- expect(unwrapped).not.toBe(original);
220
- expect(unwrapped.raw).not.toBe(original.raw);
221
- expect(unwrapped.raw.tags).not.toBe(original.raw.tags);
222
- expect(unwrapped.raw.tags[1]).not.toBe(original.raw.tags[1]);
223
- });
224
-
225
- it('should return primitive values as-is', () => {
226
- expect(unwrapLockerProxiedObject(undefined)).toBeUndefined();
227
- expect(unwrapLockerProxiedObject(null)).toBeNull();
228
- expect(unwrapLockerProxiedObject('value')).toBe('value');
229
- expect(unwrapLockerProxiedObject(0)).toBe(0);
230
- expect(unwrapLockerProxiedObject(false)).toBe(false);
231
- });
232
- });
233
- });
@@ -1,22 +0,0 @@
1
- import {TimeSpan} from '../timeAndDateUtils';
2
-
3
- describe('quanticUtils/timeAndDateUtils', () => {
4
- describe('TimeSpan', () => {
5
- describe('getYoutubeFormatTimestamp', () => {
6
- it('should return the correct YouTube timestamp format for timestamps of less than a minute', () => {
7
- const timeSpan = new TimeSpan(45000);
8
- expect(timeSpan.getYoutubeFormatTimestamp()).toBe('0:45');
9
- });
10
-
11
- it('should return the correct YouTube timestamp format for timestamps of more than an hour', () => {
12
- const timeSpan = new TimeSpan(3661000);
13
- expect(timeSpan.getYoutubeFormatTimestamp()).toBe('1:01:01');
14
- });
15
-
16
- it('should return the correct YouTube timestamp format for timestamps of less than an hour', () => {
17
- const timeSpan = new TimeSpan(300000);
18
- expect(timeSpan.getYoutubeFormatTimestamp()).toBe('05:00');
19
- });
20
- });
21
- });
22
- });