@coveo/quantic 3.44.1 → 3.44.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/force-app/main/default/classes/OrganizationEndpointsTest.cls +71 -15
  2. package/force-app/main/default/classes/RecommendationsControllerTest.cls +1 -1
  3. package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
  4. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  5. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  6. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  7. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
  8. package/package.json +33 -31
  9. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
  10. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
  11. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
  12. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
  13. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
  15. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  16. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  17. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  18. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  19. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  20. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  21. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
  22. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
  23. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
  24. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
  25. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
  26. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
  27. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  28. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
  29. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
  30. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
  31. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
  32. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
  33. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
  34. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
  35. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
  36. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
  37. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
  38. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
  39. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
  40. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
  41. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
  42. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
  43. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
  44. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
  45. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
  46. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
  47. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  48. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  49. package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
  50. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
  51. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  52. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  53. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
  54. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  55. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  56. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
  57. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
  58. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
  59. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
  60. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
  61. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
  62. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  63. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
  64. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
  65. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
  66. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
  67. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
  68. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
  69. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
  70. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
  71. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
  72. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
  73. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
  74. package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
  75. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  76. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  77. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
  78. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
  79. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
  80. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
  81. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
  82. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
  83. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
  84. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
  85. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
  86. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
  87. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
  88. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
  89. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
  90. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
  91. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  92. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
  93. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
  94. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  95. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  96. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  97. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  98. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
  99. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
  100. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
  101. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
  102. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
  103. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
  104. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
  105. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
  106. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
  107. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
  108. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
  109. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
  110. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
  111. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
  112. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  113. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  114. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  115. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
  116. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
  117. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
  118. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
  119. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  120. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  121. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  122. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
  123. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
  124. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
  125. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
  126. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
  127. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  128. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  129. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  130. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
  131. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
  132. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
  133. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
  134. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
  135. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  136. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
  137. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
  138. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  139. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  140. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
  141. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
  142. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
  143. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
  144. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
  145. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
  146. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
  147. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
  148. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
  149. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  150. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  151. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
  152. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  153. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  154. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  155. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  156. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  157. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  158. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
  159. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  160. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  161. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  162. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
  163. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
  164. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
  165. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
  166. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
  167. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
  168. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
  169. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
  170. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  171. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
  172. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
  173. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
  174. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
  175. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
  176. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  177. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
  178. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  179. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
  180. package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
  181. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
  182. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
  183. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
  184. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
  185. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
  186. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  187. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  188. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  189. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  190. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  191. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  192. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  193. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  194. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  195. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  196. package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
  197. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
  198. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  199. package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
  200. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
  201. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
  202. package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
  203. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,229 +0,0 @@
1
- /* eslint-disable no-import-assign */
2
- // @ts-ignore
3
- import QuanticUserActionsToggle from 'c/quanticUserActionsToggle';
4
- // @ts-ignore
5
- import {createElement} from 'lwc';
6
- import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
7
-
8
- jest.mock('c/quanticHeadlessLoader');
9
-
10
- const userActionsIcon = 'utility:clock';
11
- const userActionsLabel = 'User actions';
12
- jest.mock(
13
- '@salesforce/label/c.quantic_UserActions',
14
- () => ({default: userActionsLabel}),
15
- {
16
- virtual: true,
17
- }
18
- );
19
-
20
- const functionsMocks = {
21
- buildUserActions: jest.fn(() => ({
22
- logOpenUserActions: functionsMocks.logOpenUserActions,
23
- })),
24
- logOpenUserActions: jest.fn(() => {}),
25
- };
26
-
27
- const selectors = {
28
- userActionsToggleButton: '[data-test="user-actions-toggle-button"]',
29
- userActionsToggleButtonIcon:
30
- '[data-test="user-actions-toggle-button"] lightning-icon',
31
- userActionsTimeline:
32
- 'c-quantic-modal [slot="content"] c-quantic-user-actions-timeline',
33
- modalHeaderIcon: 'c-quantic-modal [slot="header"] lightning-icon',
34
- modalHeaderLabel:
35
- 'c-quantic-modal [slot="header"] [data-test="user-actions-modal-label"]',
36
- initializationError: 'c-quantic-component-error',
37
- };
38
-
39
- const exampleTicketCreationDateTime = '2024-01-01T00:00:00Z';
40
- const exampleExcludedCustomActions = ['dummyEvent'];
41
- const exampleUserId = 'someone@company.com';
42
- const exampleEngineId = 'exampleEngineId';
43
- const exampleEngine = {
44
- id: exampleEngineId,
45
- };
46
-
47
- const defaultOptions = {
48
- engineId: exampleEngineId,
49
- ticketCreationDateTime: exampleTicketCreationDateTime,
50
- excludedCustomActions: exampleExcludedCustomActions,
51
- userId: exampleUserId,
52
- };
53
-
54
- function createTestComponent(options = defaultOptions) {
55
- prepareHeadlessState();
56
-
57
- const element = createElement('c-quantic-user-actions-toggle', {
58
- is: QuanticUserActionsToggle,
59
- });
60
- for (const [key, value] of Object.entries(options)) {
61
- element[key] = value;
62
- }
63
-
64
- document.body.appendChild(element);
65
- return element;
66
- }
67
-
68
- function prepareHeadlessState() {
69
- // @ts-ignore
70
- mockHeadlessLoader.getHeadlessBundle = () => {
71
- return {
72
- buildUserActions: functionsMocks.buildUserActions,
73
- };
74
- };
75
- }
76
-
77
- // Helper function to wait until the microtask queue is empty.
78
- function flushPromises() {
79
- // eslint-disable-next-line @lwc/lwc/no-async-operation
80
- return new Promise((resolve) => setTimeout(resolve, 0));
81
- }
82
-
83
- let isInitialized = false;
84
-
85
- function mockSuccessfulHeadlessInitialization() {
86
- // @ts-ignore
87
- mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
88
- if (element instanceof QuanticUserActionsToggle && !isInitialized) {
89
- isInitialized = true;
90
- initialize(exampleEngine);
91
- }
92
- };
93
- }
94
-
95
- function mockErroneousHeadlessInitialization() {
96
- // @ts-ignore
97
- mockHeadlessLoader.initializeWithHeadless = (element) => {
98
- if (element instanceof QuanticUserActionsToggle) {
99
- element.setInitializationError();
100
- }
101
- };
102
- }
103
-
104
- function cleanup() {
105
- // The jsdom instance is shared across test cases in a single file so reset the DOM
106
- while (document.body.firstChild) {
107
- document.body.removeChild(document.body.firstChild);
108
- }
109
- jest.clearAllMocks();
110
- isInitialized = false;
111
- }
112
-
113
- describe('c-quantic-user-actions-toggle', () => {
114
- beforeAll(() => {
115
- mockSuccessfulHeadlessInitialization();
116
- });
117
-
118
- afterEach(() => {
119
- cleanup();
120
- });
121
-
122
- describe('controller initialization', () => {
123
- it('should build the controller with the right parameters', async () => {
124
- createTestComponent();
125
- await flushPromises();
126
-
127
- expect(functionsMocks.buildUserActions).toHaveBeenCalledTimes(1);
128
- expect(functionsMocks.buildUserActions).toHaveBeenCalledWith(
129
- exampleEngine,
130
- {
131
- options: {
132
- ticketCreationDate: exampleTicketCreationDateTime,
133
- excludedCustomActions: exampleExcludedCustomActions,
134
- },
135
- }
136
- );
137
- });
138
- });
139
-
140
- it('should display the user actions toggle button', async () => {
141
- const element = createTestComponent();
142
- await flushPromises();
143
-
144
- const userActionsToggleButton = element.shadowRoot.querySelector(
145
- selectors.userActionsToggleButton
146
- );
147
- const userActionsToggleButtonIcon = element.shadowRoot.querySelector(
148
- selectors.userActionsToggleButtonIcon
149
- );
150
-
151
- expect(userActionsToggleButton).not.toBeNull();
152
- expect(userActionsToggleButton.title).toBe(userActionsLabel);
153
- expect(userActionsToggleButtonIcon.iconName).toBe(userActionsIcon);
154
- });
155
-
156
- it('should log analytics when the user action modal is opened', async () => {
157
- const element = createTestComponent();
158
- await flushPromises();
159
-
160
- const userActionsToggleButton = element.shadowRoot.querySelector(
161
- selectors.userActionsToggleButton
162
- );
163
-
164
- expect(userActionsToggleButton).not.toBeNull();
165
- await userActionsToggleButton.click();
166
- await flushPromises();
167
-
168
- expect(functionsMocks.logOpenUserActions).toHaveBeenCalledTimes(1);
169
- });
170
-
171
- it('should properly display the user actions modal header', async () => {
172
- const element = createTestComponent();
173
- await flushPromises();
174
-
175
- const modalHeaderIcon = element.shadowRoot.querySelector(
176
- selectors.modalHeaderIcon
177
- );
178
- const modalHeaderLabel = element.shadowRoot.querySelector(
179
- selectors.modalHeaderLabel
180
- );
181
-
182
- expect(modalHeaderIcon).not.toBeNull();
183
- expect(modalHeaderLabel).not.toBeNull();
184
-
185
- expect(modalHeaderIcon.iconName).toBe(userActionsIcon);
186
- expect(modalHeaderIcon.title).toBe(userActionsLabel);
187
- expect(modalHeaderLabel.textContent).toBe(userActionsLabel);
188
- });
189
-
190
- it('should properly display the user actions timeline inside the modal', async () => {
191
- const element = createTestComponent();
192
- await flushPromises();
193
-
194
- const userActionsTimeline = element.shadowRoot.querySelector(
195
- selectors.userActionsTimeline
196
- );
197
-
198
- expect(userActionsTimeline).not.toBeNull();
199
- expect(userActionsTimeline.engineId).toBe(exampleEngineId);
200
- expect(userActionsTimeline.userId).toBe(exampleUserId);
201
- expect(userActionsTimeline.ticketCreationDateTime).toBe(
202
- exampleTicketCreationDateTime
203
- );
204
- expect(userActionsTimeline.excludedCustomActions).toEqual(
205
- exampleExcludedCustomActions
206
- );
207
- });
208
-
209
- describe('when an initialization error occurs', () => {
210
- beforeEach(() => {
211
- mockErroneousHeadlessInitialization();
212
- });
213
-
214
- afterAll(() => {
215
- mockSuccessfulHeadlessInitialization();
216
- });
217
-
218
- it('should display the initialization error component', async () => {
219
- const element = createTestComponent();
220
- await flushPromises();
221
-
222
- const initializationError = element.shadowRoot.querySelector(
223
- selectors.initializationError
224
- );
225
-
226
- expect(initializationError).not.toBeNull();
227
- });
228
- });
229
- });
@@ -1,32 +0,0 @@
1
- const followingSessionsActions = [
2
- {
3
- name: 'CUSTOM',
4
- value:
5
- '{"event_type":"example","event_value":"exampleCustomAction","origin_level_1":"default"}',
6
- time: new Date('2024-09-01T15:30:00Z').valueOf(),
7
- },
8
- ];
9
-
10
- const ticketCreationSessionActions = [
11
- {
12
- name: 'CUSTOM',
13
- value:
14
- '{"event_type":"errors","event_value":"One","origin_level_1":"default","origin_level_2":"default"}',
15
- time: new Date('2024-08-30T00:10:00Z').valueOf(),
16
- },
17
- ];
18
-
19
- const precedingSessionsActions = [
20
- {
21
- name: 'CUSTOM',
22
- value:
23
- '{"event_type":"example","event_value":"exampleCustomAction","origin_level_1":"default"}',
24
- time: new Date('2024-08-29T15:40:00Z').valueOf(),
25
- },
26
- ];
27
-
28
- export const exampleUserActionsData = [
29
- ...followingSessionsActions,
30
- ...ticketCreationSessionActions,
31
- ...precedingSessionsActions,
32
- ];
@@ -1,32 +0,0 @@
1
- import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
2
- import {UserActionsToggleObject} from './pageObject';
3
- import {exampleUserActionsData} from './data';
4
-
5
- const pageUrl = 's/quantic-user-actions-toggle';
6
-
7
- interface UserActionsToggleOptions {
8
- userId: string;
9
- ticketCreationDateTime: string;
10
- }
11
- type QuanticUserActionsToggleE2EFixtures = {
12
- userActionsToggle: UserActionsToggleObject;
13
- options: UserActionsToggleOptions;
14
- };
15
-
16
- export const testInsight =
17
- quanticBase.extend<QuanticUserActionsToggleE2EFixtures>({
18
- options: {
19
- userId: 'someone@company.com',
20
- ticketCreationDateTime: '2024-01-01T00:00:00Z',
21
- },
22
- userActionsToggle: async ({page, options, configuration}, use) => {
23
- await page.goto(pageUrl);
24
- configuration.configure({...options});
25
- const userActionsToggleObject = new UserActionsToggleObject(page);
26
- userActionsToggleObject.mockUserActions(exampleUserActionsData);
27
- await userActionsToggleObject.waitForUserActionsResponse(options.userId);
28
- await use(userActionsToggleObject);
29
- },
30
- });
31
-
32
- export {expect} from '@playwright/test';
@@ -1,71 +0,0 @@
1
- import type {Locator, Page, Request, Response} from '@playwright/test';
2
- import {isUaCustomEvent} from '../../../../../../playwright/utils/requests';
3
-
4
- const userActionsRequestRegex =
5
- /\/rest\/organizations\/.*\/machinelearning\/user\/actions$/;
6
-
7
- export class UserActionsToggleObject {
8
- constructor(public page: Page) {
9
- this.page = page;
10
- }
11
-
12
- get userActionsToggleButton(): Locator {
13
- return this.page.getByRole('button', {name: /User actions/i});
14
- }
15
-
16
- get userActionsModal(): Locator {
17
- return this.page.locator(
18
- 'c-quantic-user-actions-toggle > c-quantic-modal > div'
19
- );
20
- }
21
-
22
- get userActionsModalCloseButton(): Locator {
23
- return this.page
24
- .locator('c-quantic-user-actions-toggle > c-quantic-modal')
25
- .getByRole('button', {name: 'Close'});
26
- }
27
-
28
- async mockUserActions(
29
- userActions: Array<{name: string; value: string; time: number}>
30
- ) {
31
- await this.page.route(userActionsRequestRegex, async (route) => {
32
- const body = {value: userActions};
33
-
34
- await route.fulfill({
35
- body: JSON.stringify(body),
36
- status: 200,
37
- headers: {
38
- 'content-type': 'text/html',
39
- },
40
- });
41
- });
42
- }
43
-
44
- async waitForUserActionsResponse(userId: string): Promise<Response> {
45
- return this.page.waitForResponse((response) => {
46
- const request = response.request();
47
- if (request.url().match(userActionsRequestRegex)) {
48
- const requestBody = request.postDataJSON?.();
49
- return requestBody?.objectId === userId;
50
- }
51
- return false;
52
- });
53
- }
54
-
55
- async waitForOpenUserActionsUaAnalytics(): Promise<Request> {
56
- const uaRequest = this.page.waitForRequest((request) => {
57
- if (isUaCustomEvent(request)) {
58
- const requestBody = request.postDataJSON?.();
59
- const expectedFields = {
60
- eventType: 'User Actions',
61
- eventValue: 'openUserActions',
62
- };
63
- return Object.keys(expectedFields).every(
64
- (key) => requestBody?.[key] === expectedFields[key]
65
- );
66
- }
67
- return false;
68
- });
69
- return uaRequest;
70
- }
71
- }
@@ -1,39 +0,0 @@
1
- import {testInsight, expect} from './fixture';
2
-
3
- const exampleUserId = 'exampleUserId';
4
- const exampleTicketCreateDateTime = encodeURIComponent('2024-08-30');
5
-
6
- testInsight.use({
7
- options: {
8
- userId: exampleUserId,
9
- ticketCreationDateTime: exampleTicketCreateDateTime,
10
- },
11
- });
12
-
13
- testInsight.describe('quantic user actions toggle', () => {
14
- testInsight.describe('when opening the user action modal', () => {
15
- testInsight(
16
- 'should open the user actions timeline and log analytics',
17
- async ({userActionsToggle}) => {
18
- await expect(userActionsToggle.userActionsModal).not.toBeVisible();
19
- const uaPromise = userActionsToggle.waitForOpenUserActionsUaAnalytics();
20
- await userActionsToggle.userActionsToggleButton.click();
21
- await expect(userActionsToggle.userActionsModal).toBeVisible();
22
- await uaPromise;
23
- }
24
- );
25
- });
26
-
27
- testInsight.describe('when closing the user action modal', () => {
28
- testInsight(
29
- 'should close the user actions timeline',
30
- async ({userActionsToggle}) => {
31
- await expect(userActionsToggle.userActionsModal).not.toBeVisible();
32
- await userActionsToggle.userActionsToggleButton.click();
33
- await expect(userActionsToggle.userActionsModal).toBeVisible();
34
- await userActionsToggle.userActionsModalCloseButton.click();
35
- await expect(userActionsToggle.userActionsModal).not.toBeVisible();
36
- }
37
- );
38
- });
39
- });
@@ -1,214 +0,0 @@
1
- import {
2
- AriaLiveRegion,
3
- isFocusable,
4
- getFirstFocusableElement,
5
- getLastFocusableElement,
6
- isCustomElement,
7
- isParentOf,
8
- } from 'c/quanticUtils';
9
-
10
- describe('accessibilityUtils', () => {
11
- describe('AriaLiveRegion', () => {
12
- let elem;
13
-
14
- beforeEach(() => {
15
- elem = {dispatchEvent: jest.fn()};
16
- });
17
-
18
- it('should dispatch a register region event on creation', () => {
19
- AriaLiveRegion('test-region', elem);
20
- expect(elem.dispatchEvent).toHaveBeenCalledTimes(1);
21
- const event = elem.dispatchEvent.mock.calls[0][0];
22
- expect(event.type).toBe('quantic__registerregion');
23
- expect(event.detail).toEqual({
24
- regionName: 'test-region',
25
- assertive: false,
26
- });
27
- });
28
-
29
- it('should dispatch a register region event with assertive flag', () => {
30
- AriaLiveRegion('test-region', elem, true);
31
- const event = elem.dispatchEvent.mock.calls[0][0];
32
- expect(event.detail.assertive).toBe(true);
33
- });
34
-
35
- it('should dispatch an aria live message event when dispatchMessage is called', () => {
36
- const region = AriaLiveRegion('test-region', elem);
37
- region.dispatchMessage('hello');
38
- expect(elem.dispatchEvent).toHaveBeenCalledTimes(2);
39
- const event = elem.dispatchEvent.mock.calls[1][0];
40
- expect(event.type).toBe('quantic__arialivemessage');
41
- expect(event.detail).toEqual({
42
- regionName: 'test-region',
43
- assertive: false,
44
- message: 'hello',
45
- });
46
- });
47
- });
48
-
49
- describe('isFocusable', () => {
50
- function createElement(tag, attrs = {}) {
51
- const el = document.createElement(tag);
52
- Object.entries(attrs).forEach(([k, v]) => el.setAttribute(k, v));
53
- return el;
54
- }
55
-
56
- it('should return true for a button', () => {
57
- expect(isFocusable(createElement('button'))).toBe(true);
58
- });
59
-
60
- it('should return false for a disabled button', () => {
61
- expect(isFocusable(createElement('button', {disabled: ''}))).toBe(false);
62
- });
63
-
64
- it('should return true for an anchor with href', () => {
65
- expect(isFocusable(createElement('a', {href: '#'}))).toBe(true);
66
- });
67
-
68
- it('should return false for an anchor without href', () => {
69
- expect(isFocusable(createElement('a'))).toBe(false);
70
- });
71
-
72
- it('should return true for an input', () => {
73
- expect(isFocusable(createElement('input'))).toBe(true);
74
- });
75
-
76
- it('should return false for a disabled input', () => {
77
- expect(isFocusable(createElement('input', {disabled: ''}))).toBe(false);
78
- });
79
-
80
- it('should return true for an element with tabindex >= 0', () => {
81
- expect(isFocusable(createElement('div', {tabindex: '0'}))).toBe(true);
82
- });
83
-
84
- it('should return false for an element with tabindex -1', () => {
85
- expect(isFocusable(createElement('div', {tabindex: '-1'}))).toBe(false);
86
- });
87
-
88
- it('should return true for a contentEditable element', () => {
89
- expect(isFocusable(createElement('div', {contentEditable: 'true'}))).toBe(
90
- true
91
- );
92
- });
93
-
94
- it('should return false for a plain div', () => {
95
- expect(isFocusable(createElement('div'))).toBe(false);
96
- });
97
-
98
- it('should return true for an iframe', () => {
99
- expect(isFocusable(createElement('iframe'))).toBe(true);
100
- });
101
-
102
- it('should return true for a select', () => {
103
- expect(isFocusable(createElement('select'))).toBe(true);
104
- });
105
-
106
- it('should return true for a textarea', () => {
107
- expect(isFocusable(createElement('textarea'))).toBe(true);
108
- });
109
- });
110
-
111
- describe('isCustomElement', () => {
112
- it('should return true for elements with a hyphen in the tag name', () => {
113
- const el = document.createElement('my-component');
114
- expect(isCustomElement(el)).toBe(true);
115
- });
116
-
117
- it('should return false for standard elements', () => {
118
- const el = document.createElement('div');
119
- expect(isCustomElement(el)).toBe(false);
120
- });
121
-
122
- it('should return false for null', () => {
123
- expect(isCustomElement(null)).toBe(false);
124
- });
125
- });
126
-
127
- describe('getFirstFocusableElement', () => {
128
- it('should return null for null input', () => {
129
- expect(getFirstFocusableElement(null)).toBeNull();
130
- });
131
-
132
- it('should return the element itself if it is focusable and has no focusable children', () => {
133
- const btn = document.createElement('button');
134
- expect(getFirstFocusableElement(btn)).toBe(btn);
135
- });
136
-
137
- it('should return the first focusable child', () => {
138
- const div = document.createElement('div');
139
- const span = document.createElement('span');
140
- const btn1 = document.createElement('button');
141
- const btn2 = document.createElement('button');
142
- div.appendChild(span);
143
- div.appendChild(btn1);
144
- div.appendChild(btn2);
145
- expect(getFirstFocusableElement(div)).toBe(btn1);
146
- });
147
-
148
- it('should return null for a custom element without data-focusable', () => {
149
- const el = document.createElement('my-component');
150
- expect(getFirstFocusableElement(el)).toBeNull();
151
- });
152
-
153
- it('should return the custom element if data-focusable is true', () => {
154
- const el = document.createElement('my-component');
155
- el.dataset.focusable = 'true';
156
- expect(getFirstFocusableElement(el)).toBe(el);
157
- });
158
-
159
- it('should return null for a text node', () => {
160
- const text = document.createTextNode('hello');
161
- expect(getFirstFocusableElement(text)).toBeNull();
162
- });
163
- });
164
-
165
- describe('getLastFocusableElement', () => {
166
- it('should return null for null input', () => {
167
- expect(getLastFocusableElement(null)).toBeNull();
168
- });
169
-
170
- it('should return the last focusable child', () => {
171
- const div = document.createElement('div');
172
- const btn1 = document.createElement('button');
173
- const btn2 = document.createElement('button');
174
- div.appendChild(btn1);
175
- div.appendChild(btn2);
176
- expect(getLastFocusableElement(div)).toBe(btn2);
177
- });
178
-
179
- it('should return the element itself if it is focusable and has no focusable children', () => {
180
- const input = document.createElement('input');
181
- expect(getLastFocusableElement(input)).toBe(input);
182
- });
183
- });
184
-
185
- describe('isParentOf', () => {
186
- it('should return false for null', () => {
187
- expect(isParentOf(null, 'MY-COMPONENT')).toBe(false);
188
- });
189
-
190
- it('should return true if the element itself matches the target tag', () => {
191
- const el = document.createElement('my-component');
192
- expect(isParentOf(el, 'MY-COMPONENT')).toBe(true);
193
- });
194
-
195
- it('should return true if a descendant matches the target tag', () => {
196
- const wrapper = document.createElement('div');
197
- const child = document.createElement('my-component');
198
- wrapper.appendChild(child);
199
- expect(isParentOf(wrapper, 'MY-COMPONENT')).toBe(true);
200
- });
201
-
202
- it('should return false if no descendant matches', () => {
203
- const wrapper = document.createElement('div');
204
- const child = document.createElement('span');
205
- wrapper.appendChild(child);
206
- expect(isParentOf(wrapper, 'MY-COMPONENT')).toBe(false);
207
- });
208
-
209
- it('should return false for a text node', () => {
210
- const text = document.createTextNode('hello');
211
- expect(isParentOf(text, 'MY-COMPONENT')).toBe(false);
212
- });
213
- });
214
- });