@coveo/quantic 3.33.0 → 3.33.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 (296) hide show
  1. package/README.md +15 -15
  2. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +106 -0
  3. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +752 -0
  4. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +76 -0
  5. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +282 -0
  6. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +167 -0
  7. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +262 -0
  8. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +819 -0
  9. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +23 -0
  10. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +51 -0
  11. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +152 -0
  12. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +269 -0
  13. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +1183 -0
  14. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +27 -0
  15. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +75 -0
  16. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +55 -0
  17. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +199 -0
  18. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +371 -0
  19. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +212 -0
  20. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +688 -0
  21. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +24 -0
  22. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +68 -0
  23. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +27 -0
  24. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +145 -0
  25. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +348 -0
  26. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +48 -0
  27. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +80 -0
  28. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +173 -0
  29. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +219 -0
  30. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +404 -0
  31. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +38 -0
  32. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +52 -0
  33. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +102 -0
  34. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +1105 -0
  35. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +21 -0
  36. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +73 -0
  37. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +67 -0
  38. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +208 -0
  39. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +28 -0
  40. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +178 -0
  41. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +64 -0
  42. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +23 -0
  43. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +82 -0
  44. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +392 -0
  45. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +448 -0
  46. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +298 -0
  47. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +323 -0
  48. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +70 -0
  49. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +81 -0
  50. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +69 -0
  51. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +1158 -0
  52. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +56 -0
  53. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +185 -0
  54. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +451 -0
  55. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +337 -0
  56. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +151 -0
  57. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +71 -0
  58. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +651 -0
  59. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +194 -0
  60. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +230 -0
  61. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +205 -0
  62. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +309 -0
  63. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +58 -0
  64. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +55 -0
  65. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +47 -0
  66. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +953 -0
  67. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +28 -0
  68. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +71 -0
  69. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +59 -0
  70. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +164 -0
  71. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +430 -0
  72. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +65 -0
  73. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +69 -0
  74. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +106 -0
  75. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +47 -0
  76. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +13 -0
  77. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +14 -0
  78. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +82 -0
  79. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +273 -0
  80. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +448 -0
  81. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +42 -0
  82. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +55 -0
  83. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +93 -0
  84. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +516 -0
  85. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +42 -0
  86. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +61 -0
  87. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +48 -0
  88. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +491 -0
  89. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +35 -0
  90. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +52 -0
  91. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +53 -0
  92. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +747 -0
  93. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +542 -0
  94. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +262 -0
  95. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +141 -0
  96. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +340 -0
  97. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +300 -0
  98. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +46 -0
  99. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +49 -0
  100. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +40 -0
  101. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +144 -0
  102. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +120 -0
  103. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +209 -0
  104. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +261 -0
  105. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +342 -0
  106. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +66 -0
  107. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +81 -0
  108. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +69 -0
  109. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +235 -0
  110. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +144 -0
  111. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +324 -0
  112. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +301 -0
  113. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +81 -0
  114. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +38 -0
  115. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +66 -0
  116. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +90 -0
  117. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +155 -0
  118. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +464 -0
  119. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +74 -0
  120. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +85 -0
  121. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +97 -0
  122. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +487 -0
  123. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +84 -0
  124. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +45 -0
  125. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +159 -0
  126. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +743 -0
  127. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +571 -0
  128. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +110 -0
  129. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +113 -0
  130. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +299 -0
  131. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +341 -0
  132. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +21 -0
  133. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +91 -0
  134. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +196 -0
  135. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +192 -0
  136. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +126 -0
  137. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +290 -0
  138. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +329 -0
  139. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +31 -0
  140. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +93 -0
  141. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +160 -0
  142. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +127 -0
  143. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +416 -0
  144. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +61 -0
  145. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +89 -0
  146. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +91 -0
  147. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +136 -0
  148. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +387 -0
  149. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +53 -0
  150. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +54 -0
  151. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +72 -0
  152. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +222 -0
  153. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +244 -0
  154. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +333 -0
  155. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +56 -0
  156. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +68 -0
  157. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +72 -0
  158. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +331 -0
  159. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +61 -0
  160. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +80 -0
  161. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +171 -0
  162. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +1037 -0
  163. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +58 -0
  164. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +43 -0
  165. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +160 -0
  166. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +107 -0
  167. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +427 -0
  168. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +269 -0
  169. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +89 -0
  170. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +511 -0
  171. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +229 -0
  172. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +32 -0
  173. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +32 -0
  174. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +71 -0
  175. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +39 -0
  176. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +84 -0
  177. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +92 -0
  178. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +71 -0
  179. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +223 -0
  180. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +131 -0
  181. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
  182. package/force-app/main/default/staticresources/coveoheadless/definitions/app/case-assist-engine/case-assist-engine.d.ts +3 -3
  183. package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-engine/commerce-engine.d.ts +16 -16
  184. package/force-app/main/default/staticresources/coveoheadless/definitions/app/common-reducers.d.ts +1 -1
  185. package/force-app/main/default/staticresources/coveoheadless/definitions/app/insight-engine/insight-engine.d.ts +5 -5
  186. package/force-app/main/default/staticresources/coveoheadless/definitions/app/recommendation-engine/recommendation-engine.d.ts +4 -4
  187. package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine.d.ts +4 -4
  188. package/force-app/main/default/staticresources/coveoheadless/definitions/app/store.d.ts +2 -2
  189. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/headless-core-commerce-facet.d.ts +1 -1
  190. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/headless-core-range-facet.d.ts +1 -1
  191. package/force-app/main/default/staticresources/coveoheadless/definitions/features/actions-history/ipx-actions-history-actions.d.ts +1 -1
  192. package/force-app/main/default/staticresources/coveoheadless/definitions/features/advanced-search-queries/advanced-search-queries-slice.d.ts +1 -1
  193. package/force-app/main/default/staticresources/coveoheadless/definitions/features/attached-results/attached-results-slice.d.ts +1 -1
  194. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-assist-configuration/case-assist-configuration-slice.d.ts +1 -1
  195. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-context/case-context-slice.d.ts +1 -1
  196. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-actions.d.ts +1 -1
  197. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-slice.d.ts +1 -1
  198. package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-input/case-input-slice.d.ts +1 -1
  199. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/configuration/configuration-slice.d.ts +1 -1
  200. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-actions.d.ts +2 -2
  201. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-slice.d.ts +1 -1
  202. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-slice.d.ts +1 -1
  203. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/did-you-mean/did-you-mean-slice.d.ts +1 -1
  204. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/commerce-facet-search-actions.d.ts +2 -2
  205. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-set/facet-set-slice.d.ts +1 -1
  206. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/field-suggestions-order/field-suggestions-order-slice.d.ts +1 -1
  207. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/manual-numeric-facet-slice.d.ts +1 -1
  208. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/instant-products/instant-products-slice.d.ts +1 -1
  209. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-slice.d.ts +1 -1
  210. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/parameters/parameters-slice.d.ts +1 -1
  211. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product/product-actions.d.ts +2 -2
  212. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +2 -2
  213. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-slice.d.ts +1 -1
  214. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query/query-slice.d.ts +1 -1
  215. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-actions.d.ts +1 -1
  216. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recent-queries/recent-queries-slice.d.ts +1 -1
  217. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions.d.ts +2 -2
  218. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-slice.d.ts +1 -1
  219. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions.d.ts +4 -4
  220. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-slice.d.ts +1 -1
  221. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/sort/sort-slice.d.ts +1 -1
  222. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
  223. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
  224. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/triggers/triggers-slice.d.ts +1 -1
  225. package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-slice.d.ts +1 -1
  226. package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-slice.d.ts +1 -1
  227. package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/debug-slice.d.ts +1 -1
  228. package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/version-slice.d.ts +1 -1
  229. package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-slice.d.ts +1 -1
  230. package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-slice.d.ts +1 -1
  231. package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-actions.d.ts +1 -1
  232. package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-slice.d.ts +1 -1
  233. package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-slice.d.ts +1 -1
  234. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-slice.d.ts +1 -1
  235. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/automatic-facet-set/automatic-facet-set-slice.d.ts +1 -1
  236. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-slice.d.ts +1 -1
  237. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-order/facet-order-slice.d.ts +1 -1
  238. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/category/category-facet-search-set-slice.d.ts +1 -1
  239. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/generic/generic-facet-search-actions.d.ts +2 -2
  240. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/specific/specific-facet-search-set-slice.d.ts +1 -1
  241. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-controller-actions.d.ts +2 -2
  242. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-slice.d.ts +1 -1
  243. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-controller-actions.d.ts +2 -2
  244. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-set-slice.d.ts +1 -1
  245. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-controller-actions.d.ts +2 -2
  246. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-set-slice.d.ts +1 -1
  247. package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-actions.d.ts +1 -1
  248. package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-slice.d.ts +1 -1
  249. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-actions.d.ts +1 -1
  250. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-slice.d.ts +1 -1
  251. package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/insight-folding-actions.d.ts +1 -1
  252. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +2 -2
  253. package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-slice.d.ts +1 -1
  254. package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-actions.d.ts +3 -3
  255. package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-slice.d.ts +2 -2
  256. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-configuration/insight-configuration-slice.d.ts +1 -1
  257. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-actions.d.ts +1 -1
  258. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-slice.d.ts +1 -1
  259. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions.d.ts +5 -5
  260. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/legacy/insight-search-actions.d.ts +4 -4
  261. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-actions.d.ts +1 -1
  262. package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-slice.d.ts +1 -1
  263. package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-results/instant-results-slice.d.ts +1 -1
  264. package/force-app/main/default/staticresources/coveoheadless/definitions/features/pagination/pagination-slice.d.ts +1 -1
  265. package/force-app/main/default/staticresources/coveoheadless/definitions/features/pipeline/pipeline-slice.d.ts +1 -1
  266. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-slice.d.ts +1 -1
  267. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-set/query-set-slice.d.ts +1 -1
  268. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-actions.d.ts +1 -1
  269. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-slice.d.ts +1 -1
  270. package/force-app/main/default/staticresources/coveoheadless/definitions/features/question-answering/question-answering-slice.d.ts +1 -1
  271. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-queries/recent-queries-slice.d.ts +1 -1
  272. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-results/recent-results-slice.d.ts +1 -1
  273. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-actions.d.ts +1 -1
  274. package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-slice.d.ts +1 -1
  275. package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-actions.d.ts +2 -2
  276. package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-slice.d.ts +1 -1
  277. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-actions.d.ts +5 -5
  278. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +6 -6
  279. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-slice.d.ts +1 -1
  280. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-hub/search-hub-slice.d.ts +1 -1
  281. package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-slice.d.ts +1 -1
  282. package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
  283. package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
  284. package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-slice.d.ts +1 -1
  285. package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-slice.d.ts +1 -1
  286. package/force-app/main/default/staticresources/coveoheadless/definitions/features/triggers/triggers-slice.d.ts +1 -1
  287. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +6 -1
  288. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/access-token-manager.d.ts +19 -0
  289. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +4 -2
  290. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +19 -0
  291. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +2 -2
  292. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-ssr-controller-definitions.d.ts +2 -2
  293. package/force-app/main/default/staticresources/coveoheadless/headless.js +2 -2
  294. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
  295. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
  296. package/package.json +46 -44
@@ -0,0 +1,1037 @@
1
+ /* eslint-disable no-import-assign */
2
+ import QuanticTimeframeFacet from 'c/quanticTimeframeFacet';
3
+ import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
4
+ import {generateFacetDependencyConditions} from 'c/quanticUtils';
5
+ import {cleanup, buildCreateTestComponent, flushPromises} from 'c/testUtils';
6
+
7
+ jest.mock('c/quanticUtils', () => ({
8
+ generateFacetDependencyConditions: jest.fn(),
9
+ Store: {
10
+ facetTypes: {
11
+ DATEFACETS: 'dateFacets',
12
+ },
13
+ },
14
+ I18nUtils: {
15
+ format: jest.fn(),
16
+ formatDate: jest.fn(
17
+ (date) =>
18
+ `${date.getUTCFullYear()}-${date.getUTCMonth() + 1}-${date.getUTCDate()}`
19
+ ),
20
+ getShortDatePattern: jest.fn(),
21
+ getLabelNameWithCount: jest.fn(),
22
+ },
23
+ DateUtils: {
24
+ fromLocalIsoDate: jest.fn((value) => value),
25
+ toLocalSearchApiDate: jest.fn((value) => value),
26
+ },
27
+ fromSearchApiDate: jest.fn((value) => value),
28
+ }));
29
+ jest.mock('c/quanticHeadlessLoader');
30
+
31
+ const selectors = {
32
+ facetContent: '[data-testid="facet-content"]',
33
+ cardContainer: 'c-quantic-card-container',
34
+ componentError: 'c-quantic-component-error',
35
+ placeholder: 'c-quantic-placeholder',
36
+ datePicker: '[data-testid="facet__date-picker"]',
37
+ facetValue: 'c-quantic-facet-value',
38
+ clearSelectionButton: '[data-testid="clear-selection-button"]',
39
+ facetBody: '[data-testid="facet__body"]',
40
+ facetCollapseToggle: 'lightning-button-icon',
41
+ datePickerForm: '[data-testid="facet__date-picker"]',
42
+ };
43
+
44
+ const exampleFacetId = 'example facet id';
45
+ const exampleField = 'exampleField';
46
+ const exampleFilterId = `${exampleFacetId}_input`;
47
+ const exampleStartDate = '2025-1-1';
48
+ const exampleEndDate = '2025-1-2';
49
+
50
+ const exampleFacetValues = [
51
+ {start: exampleStartDate, end: exampleEndDate, numberOfResults: 10},
52
+ ];
53
+ const exampleEngineId = 'exampleEngineId';
54
+
55
+ const defaultOptions = {
56
+ engineId: exampleEngineId,
57
+ field: exampleField,
58
+ facetId: exampleFacetId,
59
+ label: 'example label',
60
+ injectionDepth: 1000,
61
+ withDatePicker: true,
62
+ };
63
+
64
+ const initialFacetState = {
65
+ facetId: exampleFacetId,
66
+ values: exampleFacetValues,
67
+ enabled: true,
68
+ };
69
+ let facetState = initialFacetState;
70
+
71
+ const initialFilterState = {
72
+ facetId: exampleFilterId,
73
+ };
74
+ let filterState = initialFilterState;
75
+
76
+ const initialSearchStatusState = {
77
+ isLoading: false,
78
+ hasError: false,
79
+ firstSearchExecuted: true,
80
+ hasResults: true,
81
+ };
82
+ let searchStatusState = initialSearchStatusState;
83
+
84
+ const parentFacetIdError = `The ${exampleField} c-quantic-timeframe-facet requires dependsOn.parentFacetId to be a valid string.`;
85
+ const expectedValueError = `The ${exampleField} c-quantic-timeframe-facet requires dependsOn.expectedValue to be a valid string.`;
86
+
87
+ const functionsMocks = {
88
+ buildDateFacet: jest.fn(() => ({
89
+ subscribe: functionsMocks.dateFacetStateSubscriber,
90
+ toggleSingleSelect: functionsMocks.toggleSingleSelect,
91
+ state: facetState,
92
+ deselectAll: functionsMocks.deselectAll,
93
+ })),
94
+ buildDateFilter: jest.fn(() => ({
95
+ subscribe: functionsMocks.dateFilterStateSubscriber,
96
+ clear: functionsMocks.clear,
97
+ setRange: functionsMocks.setRange,
98
+ state: filterState,
99
+ })),
100
+ stopWatching: jest.fn(),
101
+ buildFacetConditionsManager: jest.fn(() => ({
102
+ stopWatching: functionsMocks.stopWatching,
103
+ })),
104
+ buildSearchStatus: jest.fn(() => ({
105
+ subscribe: functionsMocks.searchStatusStateSubscriber,
106
+ state: searchStatusState,
107
+ })),
108
+ dateFacetStateSubscriber: jest.fn((cb) => {
109
+ cb();
110
+ return functionsMocks.dateFacetStateUnsubscriber;
111
+ }),
112
+ dateFilterStateSubscriber: jest.fn((cb) => {
113
+ cb();
114
+ return functionsMocks.dateFilterStateUnsubscriber;
115
+ }),
116
+ searchStatusStateSubscriber: jest.fn((cb) => {
117
+ cb();
118
+ return functionsMocks.searchStatusStateUnsubscriber;
119
+ }),
120
+ dateFacetStateUnsubscriber: jest.fn(),
121
+ searchStatusStateUnsubscriber: jest.fn(),
122
+ dateFilterStateUnsubscriber: jest.fn(),
123
+ registerToStore: jest.fn(),
124
+ eventHandler: jest.fn(),
125
+ toggleSingleSelect: jest.fn(),
126
+ deselectAll: jest.fn(),
127
+ clear: jest.fn(),
128
+ reportValidity: jest.fn(() => true),
129
+ checkValidity: jest.fn(() => true),
130
+ loadDateFacetSetActions: jest.fn(() => ({
131
+ deselectAllDateFacetValues: functionsMocks.deselectAllDateFacetValues,
132
+ })),
133
+ deselectAllDateFacetValues: jest.fn(),
134
+ dispatch: jest.fn(),
135
+ buildDateRange: jest.fn(),
136
+ setRange: jest.fn(),
137
+ };
138
+
139
+ const exampleEngine = {
140
+ id: exampleEngineId,
141
+ dispatch: functionsMocks.dispatch,
142
+ };
143
+
144
+ const createTestComponent = buildCreateTestComponent(
145
+ QuanticTimeframeFacet,
146
+ 'c-quantic-timeframe-facet',
147
+ defaultOptions
148
+ );
149
+
150
+ // @ts-ignore
151
+ mockHeadlessLoader.registerToStore = functionsMocks.registerToStore;
152
+
153
+ function prepareHeadlessState() {
154
+ // @ts-ignore
155
+ mockHeadlessLoader.getHeadlessBundle = () => {
156
+ return {
157
+ buildDateFacet: functionsMocks.buildDateFacet,
158
+ buildDateFilter: functionsMocks.buildDateFilter,
159
+ buildSearchStatus: functionsMocks.buildSearchStatus,
160
+ buildFacetConditionsManager: functionsMocks.buildFacetConditionsManager,
161
+ loadDateFacetSetActions: functionsMocks.loadDateFacetSetActions,
162
+ buildDateRange: functionsMocks.buildDateRange,
163
+ };
164
+ };
165
+ }
166
+
167
+ let isInitialized = false;
168
+
169
+ function mockBueno() {
170
+ // @ts-ignore
171
+ mockHeadlessLoader.getBueno = () => {
172
+ // @ts-ignore
173
+ global.Bueno = {
174
+ isString: jest
175
+ .fn()
176
+ .mockImplementation(
177
+ (value) => Object.prototype.toString.call(value) === '[object String]'
178
+ ),
179
+ };
180
+ return new Promise((resolve) => resolve());
181
+ };
182
+ }
183
+
184
+ function mockSuccessfulHeadlessInitialization() {
185
+ // @ts-ignore
186
+ mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
187
+ if (element instanceof QuanticTimeframeFacet && !isInitialized) {
188
+ isInitialized = true;
189
+ initialize(exampleEngine);
190
+ }
191
+ };
192
+ }
193
+
194
+ function mockErroneousHeadlessInitialization() {
195
+ // @ts-ignore
196
+ mockHeadlessLoader.initializeWithHeadless = (element) => {
197
+ if (element instanceof QuanticTimeframeFacet) {
198
+ element.setInitializationError();
199
+ }
200
+ };
201
+ }
202
+
203
+ async function submitFacetSearchForm(element) {
204
+ const form = element.shadowRoot.querySelector(selectors.datePickerForm);
205
+ form.dispatchEvent(
206
+ new CustomEvent('submit', {bubbles: true, composed: true})
207
+ );
208
+ await flushPromises();
209
+ }
210
+
211
+ function mockInputReportValidity(element) {
212
+ const inputs = [...element.shadowRoot.querySelectorAll('lightning-input')];
213
+ inputs.forEach((input) => {
214
+ input.reportValidity = functionsMocks.reportValidity;
215
+ input.checkValidity = functionsMocks.checkValidity;
216
+ });
217
+ }
218
+
219
+ describe('c-quantic-timeframe-facet', () => {
220
+ beforeEach(() => {
221
+ mockSuccessfulHeadlessInitialization();
222
+ mockBueno();
223
+ prepareHeadlessState();
224
+ });
225
+
226
+ afterEach(() => {
227
+ cleanup();
228
+ facetState = initialFacetState;
229
+ filterState = initialFilterState;
230
+ searchStatusState = initialSearchStatusState;
231
+ isInitialized = false;
232
+ });
233
+
234
+ describe('component initialization', () => {
235
+ it('should initialize the facet controller and the search status controller', async () => {
236
+ createTestComponent();
237
+ await flushPromises();
238
+
239
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledTimes(1);
240
+ expect(functionsMocks.buildSearchStatus).toHaveBeenCalledTimes(1);
241
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledWith(
242
+ exampleEngine,
243
+ expect.objectContaining({
244
+ options: expect.objectContaining({
245
+ field: defaultOptions.field,
246
+ facetId: defaultOptions.facetId,
247
+ generateAutomaticRanges: false,
248
+ sortCriteria: 'descending',
249
+ injectionDepth: defaultOptions.injectionDepth,
250
+ }),
251
+ })
252
+ );
253
+ });
254
+
255
+ it('should register the facet to the quantic store', async () => {
256
+ const expectedFacetType = 'dateFacets';
257
+ const element = createTestComponent();
258
+ await flushPromises();
259
+
260
+ expect(functionsMocks.registerToStore).toHaveBeenCalledTimes(1);
261
+ expect(functionsMocks.registerToStore).toHaveBeenCalledWith(
262
+ exampleEngine.id,
263
+ expectedFacetType,
264
+ expect.objectContaining({
265
+ label: defaultOptions.label,
266
+ facetId: defaultOptions.facetId,
267
+ element: element,
268
+ })
269
+ );
270
+ });
271
+
272
+ it('should subscribe to the headless facet state and search status state changes', async () => {
273
+ createTestComponent();
274
+ await flushPromises();
275
+
276
+ expect(functionsMocks.dateFacetStateSubscriber).toHaveBeenCalledTimes(1);
277
+ expect(functionsMocks.searchStatusStateSubscriber).toHaveBeenCalledTimes(
278
+ 1
279
+ );
280
+ });
281
+
282
+ describe('the facet conditions manager', () => {
283
+ it('should build the controller when the dependsOn property is set', async () => {
284
+ const exampleFacetDependency = {
285
+ parentFacetId: 'filetype',
286
+ expectedValue: 'txt',
287
+ };
288
+ createTestComponent({
289
+ ...defaultOptions,
290
+ dependsOn: exampleFacetDependency,
291
+ });
292
+ await flushPromises();
293
+
294
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledTimes(1);
295
+ expect(functionsMocks.buildDateFilter).toHaveBeenCalledTimes(1);
296
+ expect(
297
+ functionsMocks.buildFacetConditionsManager
298
+ ).toHaveBeenCalledTimes(2);
299
+ expect(functionsMocks.buildFacetConditionsManager).toHaveBeenCalledWith(
300
+ exampleEngine,
301
+ {
302
+ facetId: exampleFacetId,
303
+ }
304
+ );
305
+ expect(functionsMocks.buildFacetConditionsManager).toHaveBeenCalledWith(
306
+ exampleEngine,
307
+ {
308
+ facetId: exampleFilterId,
309
+ }
310
+ );
311
+
312
+ expect(generateFacetDependencyConditions).toHaveBeenCalledTimes(2);
313
+ expect(generateFacetDependencyConditions).toHaveBeenCalledWith({
314
+ [exampleFacetDependency.parentFacetId]:
315
+ exampleFacetDependency.expectedValue,
316
+ });
317
+ });
318
+
319
+ it('should not build the controller when the dependsOn property is not set', async () => {
320
+ createTestComponent();
321
+ await flushPromises();
322
+
323
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledTimes(1);
324
+ expect(functionsMocks.buildDateFilter).toHaveBeenCalledTimes(1);
325
+ expect(
326
+ functionsMocks.buildFacetConditionsManager
327
+ ).toHaveBeenCalledTimes(0);
328
+ expect(generateFacetDependencyConditions).toHaveBeenCalledTimes(0);
329
+ });
330
+ });
331
+
332
+ describe('the date filter controller', () => {
333
+ it('should initialize the date filter controller and subscribe to its state changes when the property withDatePicker is set to true', async () => {
334
+ createTestComponent({
335
+ ...defaultOptions,
336
+ withDatePicker: true,
337
+ });
338
+ await flushPromises();
339
+
340
+ expect(functionsMocks.buildDateFilter).toHaveBeenCalledTimes(1);
341
+ expect(functionsMocks.buildDateFilter).toHaveBeenCalledWith(
342
+ exampleEngine,
343
+ expect.objectContaining({
344
+ options: expect.objectContaining({
345
+ field: defaultOptions.field,
346
+ facetId: `${defaultOptions.facetId}_input`,
347
+ }),
348
+ })
349
+ );
350
+ expect(functionsMocks.dateFilterStateSubscriber).toHaveBeenCalledTimes(
351
+ 1
352
+ );
353
+ });
354
+
355
+ it('should not initialize the date filter controller and subscribe to its state changes when the property withDatePicker is set to false', async () => {
356
+ createTestComponent({
357
+ ...defaultOptions,
358
+ withDatePicker: false,
359
+ });
360
+ await flushPromises();
361
+
362
+ expect(functionsMocks.buildDateFilter).toHaveBeenCalledTimes(0);
363
+ expect(functionsMocks.dateFilterStateSubscriber).toHaveBeenCalledTimes(
364
+ 0
365
+ );
366
+ });
367
+ });
368
+
369
+ describe('when an initialization error occurs', () => {
370
+ beforeEach(() => {
371
+ mockErroneousHeadlessInitialization();
372
+ });
373
+
374
+ it('should display the initialization error component', async () => {
375
+ const element = createTestComponent();
376
+ await flushPromises();
377
+
378
+ const componentError = element.shadowRoot.querySelector(
379
+ selectors.componentError
380
+ );
381
+
382
+ expect(componentError).not.toBeNull();
383
+ });
384
+ });
385
+ });
386
+
387
+ describe('the facet enablement', () => {
388
+ describe('when the facet is enabled', () => {
389
+ it('should display the facet content', async () => {
390
+ const element = createTestComponent();
391
+ await flushPromises();
392
+
393
+ const facetContent = element.shadowRoot.querySelector(
394
+ selectors.facetContent
395
+ );
396
+ expect(facetContent).not.toBeNull();
397
+ });
398
+ });
399
+
400
+ describe('when the facet is not enabled', () => {
401
+ beforeAll(() => {
402
+ facetState = {...facetState, enabled: false};
403
+ });
404
+
405
+ it('should not display the facet content', async () => {
406
+ const element = createTestComponent();
407
+ await flushPromises();
408
+
409
+ const facetContent = element.shadowRoot.querySelector(
410
+ selectors.facetContent
411
+ );
412
+ expect(facetContent).toBeNull();
413
+ });
414
+ });
415
+ });
416
+
417
+ describe('when the component is loading', () => {
418
+ beforeEach(() => {
419
+ searchStatusState = {
420
+ ...initialSearchStatusState,
421
+ isLoading: true,
422
+ hasError: false,
423
+ firstSearchExecuted: false,
424
+ };
425
+ });
426
+
427
+ it('should display the placeholder component', async () => {
428
+ const element = createTestComponent();
429
+ await flushPromises();
430
+
431
+ const placeholder = element.shadowRoot.querySelector(
432
+ selectors.placeholder
433
+ );
434
+ expect(placeholder).not.toBeNull();
435
+ });
436
+
437
+ describe('when the interface has an error', () => {
438
+ beforeEach(() => {
439
+ searchStatusState = {
440
+ ...initialSearchStatusState,
441
+ isLoading: true,
442
+ hasError: true,
443
+ firstSearchExecuted: false,
444
+ };
445
+ });
446
+
447
+ it('should not display the placeholder component', async () => {
448
+ const element = createTestComponent();
449
+ await flushPromises();
450
+
451
+ const placeholder = element.shadowRoot.querySelector(
452
+ selectors.placeholder
453
+ );
454
+ expect(placeholder).toBeNull();
455
+ });
456
+ });
457
+ });
458
+
459
+ describe('when the component is ready', () => {
460
+ describe('when the facet has values', () => {
461
+ beforeEach(() => {
462
+ facetState = {
463
+ ...initialFacetState,
464
+ values: exampleFacetValues,
465
+ };
466
+ });
467
+
468
+ it('should display the facet card when the facet values have results', async () => {
469
+ const element = createTestComponent();
470
+ await flushPromises();
471
+
472
+ const cardContainer = element.shadowRoot.querySelector(
473
+ selectors.cardContainer
474
+ );
475
+ expect(cardContainer).not.toBeNull();
476
+ });
477
+
478
+ it('should not display the facet card when the facet values have no results', async () => {
479
+ facetState = {
480
+ ...initialFacetState,
481
+ values: [
482
+ {start: '2025-01-01', end: '2025-01-02', numberOfResults: 0},
483
+ ],
484
+ };
485
+ const element = createTestComponent();
486
+ await flushPromises();
487
+
488
+ const cardContainer = element.shadowRoot.querySelector(
489
+ selectors.cardContainer
490
+ );
491
+ expect(cardContainer).toBeNull();
492
+ });
493
+
494
+ it('should display the facet values', async () => {
495
+ const expectedFacetValues = exampleFacetValues.map((facetValue) => ({
496
+ ...facetValue,
497
+ selected: false,
498
+ key: JSON.stringify([facetValue.start, facetValue.end]),
499
+ }));
500
+ const element = createTestComponent();
501
+ await flushPromises();
502
+
503
+ const facetValueElements = element.shadowRoot.querySelectorAll(
504
+ selectors.facetValue
505
+ );
506
+ expect(facetValueElements.length).toBe(exampleFacetValues.length);
507
+ expectedFacetValues.forEach((facetValue, index) => {
508
+ expect(facetValueElements[index].item).toEqual(
509
+ expect.objectContaining(facetValue)
510
+ );
511
+ expect(facetValueElements[index].isRangeFacet).toEqual(true);
512
+ expect(facetValueElements[index].displayAsLink).toEqual(true);
513
+ });
514
+ });
515
+
516
+ it('should call the controller function toggleSingleSelect when clicked', async () => {
517
+ const element = createTestComponent({
518
+ ...defaultOptions,
519
+ });
520
+ const selectedIndex = 0;
521
+ await flushPromises();
522
+
523
+ const facetValueElement = element.shadowRoot.querySelector(
524
+ selectors.facetValue
525
+ );
526
+ const selection = exampleFacetValues[selectedIndex];
527
+ facetValueElement.dispatchEvent(
528
+ new CustomEvent('quantic__selectvalue', {
529
+ bubbles: true,
530
+ detail: {
531
+ value: `${exampleStartDate} - ${exampleEndDate}`,
532
+ },
533
+ })
534
+ );
535
+ await flushPromises();
536
+
537
+ expect(functionsMocks.toggleSingleSelect).toHaveBeenCalledTimes(1);
538
+ expect(functionsMocks.toggleSingleSelect).toHaveBeenCalledWith(
539
+ expect.objectContaining(selection)
540
+ );
541
+ });
542
+
543
+ describe('when the facet has active values', () => {
544
+ beforeEach(() => {
545
+ facetState = {
546
+ ...initialFacetState,
547
+ hasActiveValues: true,
548
+ };
549
+ });
550
+
551
+ it('should display the clear selection button', async () => {
552
+ const element = createTestComponent();
553
+ await flushPromises();
554
+
555
+ const clearSelectionButton = element.shadowRoot.querySelector(
556
+ selectors.clearSelectionButton
557
+ );
558
+ expect(clearSelectionButton).not.toBeNull();
559
+ });
560
+
561
+ it('should call the deselectAll function of the date facet controller when clicking on the clear selection button', async () => {
562
+ const element = createTestComponent();
563
+ await flushPromises();
564
+
565
+ const clearSelectionButton = element.shadowRoot.querySelector(
566
+ selectors.clearSelectionButton
567
+ );
568
+
569
+ await clearSelectionButton.click();
570
+
571
+ expect(functionsMocks.deselectAll).toHaveBeenCalledTimes(1);
572
+ });
573
+ });
574
+
575
+ describe('when the facet has an active range', () => {
576
+ beforeEach(() => {
577
+ filterState = {
578
+ ...initialFilterState,
579
+ range: {start: exampleStartDate, end: exampleEndDate},
580
+ };
581
+ });
582
+
583
+ it('should display the clear selection button', async () => {
584
+ const element = createTestComponent();
585
+ await flushPromises();
586
+
587
+ const clearSelectionButton = element.shadowRoot.querySelector(
588
+ selectors.clearSelectionButton
589
+ );
590
+ expect(clearSelectionButton).not.toBeNull();
591
+ });
592
+
593
+ it('should call the clear function of the date filter controller when clicking on the clear selection button', async () => {
594
+ const element = createTestComponent();
595
+ await flushPromises();
596
+
597
+ const clearSelectionButton = element.shadowRoot.querySelector(
598
+ selectors.clearSelectionButton
599
+ );
600
+
601
+ await clearSelectionButton.click();
602
+
603
+ expect(functionsMocks.clear).toHaveBeenCalledTimes(1);
604
+ });
605
+
606
+ it('should not display the facet values', async () => {
607
+ const element = createTestComponent();
608
+ await flushPromises();
609
+
610
+ const facetValueElements = element.shadowRoot.querySelectorAll(
611
+ selectors.facetValue
612
+ );
613
+ expect(facetValueElements.length).toBe(0);
614
+ });
615
+ });
616
+
617
+ describe('when the facet is not collapsed', () => {
618
+ it('should display the facet body', async () => {
619
+ const element = createTestComponent();
620
+ await flushPromises();
621
+
622
+ const facetBody = element.shadowRoot.querySelector(
623
+ selectors.facetBody
624
+ );
625
+ expect(facetBody).not.toBeNull();
626
+ });
627
+
628
+ it('should correctly display the facet collapse toggle', async () => {
629
+ const expectedIcon = 'utility:dash';
630
+ const expectedCSSClass = 'facet__collapse';
631
+ const element = createTestComponent();
632
+ await flushPromises();
633
+
634
+ const facetCollapseToggle = element.shadowRoot.querySelector(
635
+ selectors.facetCollapseToggle
636
+ );
637
+ expect(facetCollapseToggle).not.toBeNull();
638
+ expect(facetCollapseToggle.iconName).toBe(expectedIcon);
639
+ expect(facetCollapseToggle.classList.contains(expectedCSSClass)).toBe(
640
+ true
641
+ );
642
+ });
643
+ });
644
+
645
+ describe('when the facet is collapsed', () => {
646
+ it('should not display the facet body', async () => {
647
+ const element = createTestComponent({
648
+ ...defaultOptions,
649
+ isCollapsed: true,
650
+ });
651
+ await flushPromises();
652
+
653
+ const facetBody = element.shadowRoot.querySelector(
654
+ selectors.facetBody
655
+ );
656
+ expect(facetBody).toBeNull();
657
+ });
658
+
659
+ it('should correctly display the facet collapse toggle', async () => {
660
+ const expectedIcon = 'utility:add';
661
+ const expectedCSSClass = 'facet__expand';
662
+
663
+ const element = createTestComponent({
664
+ ...defaultOptions,
665
+ isCollapsed: true,
666
+ });
667
+ await flushPromises();
668
+
669
+ const facetCollapseToggle = element.shadowRoot.querySelector(
670
+ selectors.facetCollapseToggle
671
+ );
672
+ expect(facetCollapseToggle).not.toBeNull();
673
+ expect(facetCollapseToggle.iconName).toBe(expectedIcon);
674
+ expect(facetCollapseToggle.classList.contains(expectedCSSClass)).toBe(
675
+ true
676
+ );
677
+ });
678
+
679
+ describe('when a facet value is selected', () => {
680
+ beforeEach(() => {
681
+ facetState = {
682
+ ...initialFacetState,
683
+ hasActiveValues: true,
684
+ };
685
+ });
686
+
687
+ it('should display the clear selection button', async () => {
688
+ const element = createTestComponent({
689
+ ...defaultOptions,
690
+ isCollapsed: true,
691
+ });
692
+ await flushPromises();
693
+
694
+ const clearSelectionButton = element.shadowRoot.querySelector(
695
+ selectors.clearSelectionButton
696
+ );
697
+ expect(clearSelectionButton).not.toBeNull();
698
+ });
699
+ });
700
+ });
701
+
702
+ describe('when a facet range is submitted', () => {
703
+ describe('when one of the inputs is invalid', () => {
704
+ it('should not call the method set range of the date filter controller', async () => {
705
+ const element = createTestComponent();
706
+ await flushPromises();
707
+
708
+ mockInputReportValidity(element);
709
+ // Making the first input invalid
710
+ functionsMocks.checkValidity.mockReturnValueOnce(false);
711
+
712
+ await submitFacetSearchForm(element);
713
+ expect(functionsMocks.reportValidity).toHaveBeenCalledTimes(2);
714
+ expect(functionsMocks.setRange).not.toHaveBeenCalled();
715
+ });
716
+ });
717
+
718
+ describe('when the inputs are valid', () => {
719
+ beforeEach(() => {
720
+ filterState = {
721
+ ...initialFilterState,
722
+ range: {start: exampleStartDate, end: exampleEndDate},
723
+ };
724
+ });
725
+
726
+ it('should call the method setRange of the date filter controller', async () => {
727
+ const element = createTestComponent();
728
+ await flushPromises();
729
+
730
+ mockInputReportValidity(element);
731
+
732
+ await submitFacetSearchForm(element);
733
+ expect(functionsMocks.reportValidity).toHaveBeenCalledTimes(2);
734
+ expect(functionsMocks.setRange).toHaveBeenCalledTimes(1);
735
+ });
736
+
737
+ it('should call the method deselectAllDateFacetValues of the date facet controller', async () => {
738
+ const element = createTestComponent();
739
+ await flushPromises();
740
+
741
+ mockInputReportValidity(element);
742
+
743
+ await submitFacetSearchForm(element);
744
+ expect(
745
+ functionsMocks.deselectAllDateFacetValues
746
+ ).toHaveBeenCalledTimes(1);
747
+ expect(
748
+ functionsMocks.deselectAllDateFacetValues
749
+ ).toHaveBeenCalledWith(exampleFacetId);
750
+ });
751
+ });
752
+ });
753
+ });
754
+
755
+ describe('when the facet has no values', () => {
756
+ beforeEach(() => {
757
+ facetState = {
758
+ ...initialFacetState,
759
+ values: [],
760
+ };
761
+ });
762
+
763
+ it('should not display the facet card', async () => {
764
+ const element = createTestComponent();
765
+ await flushPromises();
766
+
767
+ const cardContainer = element.shadowRoot.querySelector(
768
+ selectors.cardContainer
769
+ );
770
+ expect(cardContainer).toBeNull();
771
+ });
772
+
773
+ describe('when a facet range is selected', () => {
774
+ beforeEach(() => {
775
+ filterState = {
776
+ ...initialFilterState,
777
+ range: {start: '2025/01/01', end: '2025/01/02'},
778
+ };
779
+ });
780
+
781
+ it('should display the facet card', async () => {
782
+ const element = createTestComponent();
783
+ await flushPromises();
784
+
785
+ const cardContainer = element.shadowRoot.querySelector(
786
+ selectors.cardContainer
787
+ );
788
+ expect(cardContainer).not.toBeNull();
789
+ });
790
+ });
791
+
792
+ it('should not display the facet card when a facet range is not selected', async () => {
793
+ const element = createTestComponent();
794
+ await flushPromises();
795
+
796
+ const cardContainer = element.shadowRoot.querySelector(
797
+ selectors.cardContainer
798
+ );
799
+ expect(cardContainer).toBeNull();
800
+ });
801
+
802
+ it('should dispatch quantic__renderfacet event', async () => {
803
+ document.addEventListener(
804
+ 'quantic__renderfacet',
805
+ // @ts-ignore
806
+ (event) => functionsMocks.eventHandler(event.detail),
807
+ {once: true}
808
+ );
809
+ createTestComponent();
810
+
811
+ await flushPromises();
812
+
813
+ expect(functionsMocks.eventHandler).toHaveBeenCalledTimes(1);
814
+ expect(functionsMocks.eventHandler).toHaveBeenCalledWith({
815
+ id: exampleFacetId,
816
+ shouldRenderFacet: false,
817
+ });
818
+ });
819
+ });
820
+ });
821
+
822
+ describe('validation of the dependsOn property', () => {
823
+ let consoleError;
824
+ beforeAll(() => {
825
+ consoleError = jest.spyOn(console, 'error').mockImplementation(() => {});
826
+ });
827
+ describe('when dependsOn.parentFacetId is not provided', () => {
828
+ it('should display the error component', async () => {
829
+ const invalidFacetDependency = {
830
+ expectedValue: 'txt',
831
+ };
832
+ const element = createTestComponent({
833
+ ...defaultOptions,
834
+ dependsOn: invalidFacetDependency,
835
+ });
836
+ await flushPromises();
837
+
838
+ const componentError = element.shadowRoot.querySelector(
839
+ selectors.componentError
840
+ );
841
+ const facetContent = element.shadowRoot.querySelector(
842
+ selectors.facetContent
843
+ );
844
+
845
+ expect(consoleError).toHaveBeenCalledTimes(1);
846
+ expect(consoleError).toHaveBeenCalledWith(parentFacetIdError);
847
+ expect(componentError).not.toBeNull();
848
+ expect(facetContent).toBeNull();
849
+ });
850
+ });
851
+
852
+ describe('when dependsOn.parentFacetId is not a string', () => {
853
+ it('should display the error component', async () => {
854
+ const invalidFacetDependency = {
855
+ parentFacetId: 1,
856
+ expectedValue: 'txt',
857
+ };
858
+ const element = createTestComponent({
859
+ ...defaultOptions,
860
+ dependsOn: invalidFacetDependency,
861
+ });
862
+ await flushPromises();
863
+
864
+ const componentError = element.shadowRoot.querySelector(
865
+ selectors.componentError
866
+ );
867
+ const facetContent = element.shadowRoot.querySelector(
868
+ selectors.facetContent
869
+ );
870
+
871
+ expect(consoleError).toHaveBeenCalledTimes(1);
872
+ expect(consoleError).toHaveBeenCalledWith(parentFacetIdError);
873
+ expect(componentError).not.toBeNull();
874
+ expect(facetContent).toBeNull();
875
+ });
876
+ });
877
+
878
+ describe('when dependsOn.expectedValue is not a string', () => {
879
+ it('should display the error component', async () => {
880
+ const invalidFacetDependency = {
881
+ parentFacetId: 'filetype',
882
+ expectedValue: 2,
883
+ };
884
+ const element = createTestComponent({
885
+ ...defaultOptions,
886
+ dependsOn: invalidFacetDependency,
887
+ });
888
+ await flushPromises();
889
+
890
+ const componentError = element.shadowRoot.querySelector(
891
+ selectors.componentError
892
+ );
893
+ const facetContent = element.shadowRoot.querySelector(
894
+ selectors.facetContent
895
+ );
896
+
897
+ expect(consoleError).toHaveBeenCalledTimes(1);
898
+ expect(consoleError).toHaveBeenCalledWith(expectedValueError);
899
+ expect(componentError).not.toBeNull();
900
+ expect(facetContent).toBeNull();
901
+ });
902
+ });
903
+ });
904
+
905
+ describe('the date picker', () => {
906
+ describe('when the property withDatePicker is set to false', () => {
907
+ it('should not display the date picker', async () => {
908
+ const element = createTestComponent({
909
+ ...defaultOptions,
910
+ withDatePicker: false,
911
+ });
912
+ await flushPromises();
913
+
914
+ const datePicker = element.shadowRoot.querySelector(
915
+ selectors.datePicker
916
+ );
917
+ expect(datePicker).toBeNull();
918
+ });
919
+ });
920
+
921
+ describe('when the property withDatePicker is set to true', () => {
922
+ describe('when a filter range is selected', () => {
923
+ beforeEach(() => {
924
+ filterState = {
925
+ ...filterState,
926
+ range: {start: '2025-04-06', end: '2025-04-07'},
927
+ };
928
+ });
929
+
930
+ it('should display the date picker', async () => {
931
+ const element = createTestComponent({
932
+ ...defaultOptions,
933
+ withDatePicker: true,
934
+ });
935
+ await flushPromises();
936
+
937
+ const datePicker = element.shadowRoot.querySelector(
938
+ selectors.datePicker
939
+ );
940
+ expect(datePicker).not.toBeNull();
941
+ });
942
+ });
943
+
944
+ describe('no results are returned', () => {
945
+ beforeEach(() => {
946
+ searchStatusState = {...searchStatusState, hasResults: false};
947
+ });
948
+ it('should not display the date picker', async () => {
949
+ const element = createTestComponent({
950
+ ...defaultOptions,
951
+ withDatePicker: false,
952
+ });
953
+ await flushPromises();
954
+
955
+ const datePicker = element.shadowRoot.querySelector(
956
+ selectors.datePicker
957
+ );
958
+ expect(datePicker).toBeNull();
959
+ });
960
+ });
961
+
962
+ describe('when results are returned', () => {
963
+ beforeEach(() => {
964
+ searchStatusState = {...searchStatusState, hasResults: true};
965
+ });
966
+
967
+ describe('when no facet values have results', () => {
968
+ beforeEach(() => {
969
+ facetState = {
970
+ ...facetState,
971
+ values: [
972
+ {start: '2025-04-06', end: '2025-04-07', numberOfResults: 0},
973
+ ],
974
+ };
975
+ });
976
+
977
+ it('should not display the date picker', async () => {
978
+ const element = createTestComponent({
979
+ ...defaultOptions,
980
+ withDatePicker: true,
981
+ });
982
+ await flushPromises();
983
+
984
+ const datePicker = element.shadowRoot.querySelector(
985
+ selectors.datePicker
986
+ );
987
+ expect(datePicker).toBeNull();
988
+ });
989
+ });
990
+
991
+ describe('when at least one facet value has results', () => {
992
+ beforeEach(() => {
993
+ facetState = {
994
+ ...facetState,
995
+ values: [
996
+ {start: '2025-04-06', end: '2025-04-07', numberOfResults: 10},
997
+ ],
998
+ };
999
+ });
1000
+
1001
+ it('should display the date picker', async () => {
1002
+ const element = createTestComponent({
1003
+ ...defaultOptions,
1004
+ withDatePicker: true,
1005
+ });
1006
+ await flushPromises();
1007
+
1008
+ const datePicker = element.shadowRoot.querySelector(
1009
+ selectors.datePicker
1010
+ );
1011
+ expect(datePicker).not.toBeNull();
1012
+ });
1013
+ });
1014
+ });
1015
+ });
1016
+ });
1017
+
1018
+ describe('when the component is disconnected', () => {
1019
+ it('should make the condition manager stop watching the facet', async () => {
1020
+ const exampleFacetDependency = {
1021
+ parentFacetId: 'filetype',
1022
+ expectedValue: 'txt',
1023
+ };
1024
+ const element = createTestComponent({
1025
+ ...defaultOptions,
1026
+ dependsOn: exampleFacetDependency,
1027
+ });
1028
+ await flushPromises();
1029
+ expect(functionsMocks.buildFacetConditionsManager).toHaveBeenCalledTimes(
1030
+ 2
1031
+ );
1032
+
1033
+ document.body.removeChild(element);
1034
+ expect(functionsMocks.stopWatching).toHaveBeenCalledTimes(2);
1035
+ });
1036
+ });
1037
+ });