@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,331 +0,0 @@
1
- /* eslint-disable no-import-assign */
2
- import QuanticTabBar from '../quanticTabBar';
3
- // @ts-ignore
4
- import {createElement} from 'lwc';
5
-
6
- const tabSlotWidth = 100;
7
- const moreButtonWidth = 50;
8
- let mockContainerWidth = 200;
9
- let exampleTabSlots = [];
10
-
11
- jest.mock('@salesforce/label/c.quantic_More', () => ({default: 'More'}), {
12
- virtual: true,
13
- });
14
-
15
- jest.mock('c/quanticUtils', () => ({
16
- getAbsoluteWidth: jest.fn((element) => {
17
- if (element?.tagName === 'C-QUANTIC-TAB') {
18
- return tabSlotWidth;
19
- } else if (element?.dataset?.testid === 'tab-bar_more-section') {
20
- return moreButtonWidth;
21
- }
22
- return mockContainerWidth;
23
- }),
24
- }));
25
-
26
- const defaultOptions = {
27
- lightTheme: false,
28
- };
29
-
30
- const selectors = {
31
- tabBarContainer: '.tab-bar_container',
32
- moreTabsSection: '[data-testid="tab-bar_more-section"]',
33
- moreTabsButton: '[data-testid="tab-bar_more-button"]',
34
- tabsDropdown: '.slds-dropdown-trigger',
35
- tabItemsInDropdown: '.slds-dropdown__list li button',
36
- };
37
-
38
- const functionMocks = {
39
- select: jest.fn(),
40
- };
41
-
42
- function createExampleTabSlots(numberOfSlots) {
43
- const tabSlots = [];
44
-
45
- for (let i = 0; i < numberOfSlots; i++) {
46
- const exampleSlot = document.createElement('c-quantic-tab');
47
- const value = `tab ${i + 1}`;
48
- // @ts-ignore
49
- exampleSlot.getBoundingClientRect = () => ({right: (i + 1) * tabSlotWidth});
50
- // @ts-ignore
51
- exampleSlot.label = value;
52
- // @ts-ignore
53
- exampleSlot.expression = value;
54
- // @ts-ignoreF
55
- exampleSlot.select = () => {
56
- functionMocks.select(i);
57
- };
58
-
59
- exampleSlot.dataset.role = 'tab';
60
- exampleSlot.dataset.value = value;
61
- exampleSlot.dataset.label = value;
62
-
63
- tabSlots.push(exampleSlot);
64
- }
65
-
66
- return tabSlots;
67
- }
68
-
69
- /**
70
- * Mocks the return value of the assignedNodes method.
71
- * @param {Array<Element>} assignedElements
72
- */
73
- function mockSlotAssignedElements(assignedElements) {
74
- HTMLSlotElement.prototype.assignedElements = function () {
75
- return assignedElements;
76
- };
77
- }
78
-
79
- function createTestComponent(options = defaultOptions, assignedElements = []) {
80
- mockSlotAssignedElements(assignedElements);
81
-
82
- const element = createElement('c-quantic-tab-bar', {
83
- is: QuanticTabBar,
84
- });
85
- for (const [key, value] of Object.entries(options)) {
86
- element[key] = value;
87
- }
88
-
89
- document.body.appendChild(element);
90
-
91
- // mocking the positioning of the tab bar container.
92
- const tabBarContainer = element.shadowRoot.querySelector(
93
- selectors.tabBarContainer
94
- );
95
- tabBarContainer.getBoundingClientRect = () => ({right: mockContainerWidth});
96
-
97
- window.dispatchEvent(new CustomEvent('resize'));
98
- return element;
99
- }
100
-
101
- // Helper function to wait until the microtask queue is empty.
102
- function flushPromises() {
103
- return new Promise((resolve) => setTimeout(resolve, 0));
104
- }
105
-
106
- function cleanup() {
107
- // The jsdom instance is shared across test cases in a single file so reset the DOM
108
- while (document.body.firstChild) {
109
- document.body.removeChild(document.body.firstChild);
110
- }
111
- jest.clearAllMocks();
112
- }
113
-
114
- describe('c-quantic-tab-bar', () => {
115
- afterEach(() => {
116
- cleanup();
117
- });
118
-
119
- describe("when the total tabs width is lower than the container's width", () => {
120
- beforeEach(() => {
121
- const numberOfTabs = 2;
122
- exampleTabSlots = createExampleTabSlots(numberOfTabs);
123
- });
124
-
125
- it('should display the tabs without displaying the more tabs section', async () => {
126
- const element = createTestComponent(defaultOptions, exampleTabSlots);
127
- await flushPromises();
128
-
129
- const moreTabsSection = element.shadowRoot.querySelector(
130
- selectors.moreTabsSection
131
- );
132
- expect(moreTabsSection).not.toBeNull();
133
- const moreTabsSectionIsHidden = moreTabsSection.style.display === 'none';
134
- expect(moreTabsSectionIsHidden).toBe(true);
135
-
136
- const expectedNumberOfTabsToBeVisible = 2;
137
- for (let i = 0; i < expectedNumberOfTabsToBeVisible - 1; i++) {
138
- const tabIsVisible = exampleTabSlots[i].style.visibility === 'visible';
139
- expect(tabIsVisible).toBe(true);
140
- }
141
- });
142
-
143
- describe('reactivity to window resize', () => {
144
- afterAll(() => {
145
- mockContainerWidth = 200;
146
- });
147
-
148
- it('should display the more tab section when the window is resized to a smaller width', async () => {
149
- const element = createTestComponent(defaultOptions, exampleTabSlots);
150
- await flushPromises();
151
-
152
- const moreTabsSection = element.shadowRoot.querySelector(
153
- selectors.moreTabsSection
154
- );
155
- expect(moreTabsSection).not.toBeNull();
156
- const moreTabsSectionIsHidden =
157
- moreTabsSection.style.display === 'none';
158
- expect(moreTabsSectionIsHidden).toBe(true);
159
-
160
- mockContainerWidth = 100;
161
- // mocking the positioning of the tab bar container.
162
- const tabBarContainer = element.shadowRoot.querySelector(
163
- selectors.tabBarContainer
164
- );
165
- tabBarContainer.getBoundingClientRect = () => ({
166
- right: mockContainerWidth,
167
- });
168
- window.dispatchEvent(new CustomEvent('resize'));
169
- await flushPromises();
170
-
171
- const moreTabsSectionIsVisible =
172
- moreTabsSection.style.display === 'block';
173
- expect(moreTabsSectionIsVisible).toBe(true);
174
- });
175
-
176
- it('should hide the more tab section when the window is resized to a bigger width', async () => {
177
- const element = createTestComponent(defaultOptions, exampleTabSlots);
178
- await flushPromises();
179
-
180
- const moreTabsSection = element.shadowRoot.querySelector(
181
- selectors.moreTabsSection
182
- );
183
- expect(moreTabsSection).not.toBeNull();
184
- const moreTabsSectionIsVisible =
185
- moreTabsSection.style.display === 'block';
186
- expect(moreTabsSectionIsVisible).toBe(true);
187
-
188
- mockContainerWidth = 300;
189
- // mocking the positioning of the tab bar container.
190
- const tabBarContainer = element.shadowRoot.querySelector(
191
- selectors.tabBarContainer
192
- );
193
- tabBarContainer.getBoundingClientRect = () => ({
194
- right: mockContainerWidth,
195
- });
196
- window.dispatchEvent(new CustomEvent('resize'));
197
- await flushPromises();
198
-
199
- const moreTabsSectionIsHidden =
200
- moreTabsSection.style.display === 'none';
201
- expect(moreTabsSectionIsHidden).toBe(true);
202
- });
203
- });
204
- });
205
-
206
- describe("when the total tabs width is higher than the container's width", () => {
207
- beforeEach(() => {
208
- const numberOfTabs = 3;
209
- exampleTabSlots = createExampleTabSlots(numberOfTabs);
210
- });
211
-
212
- it('should only display a sub set of tabs and display the more tabs button', async () => {
213
- const element = createTestComponent(defaultOptions, exampleTabSlots);
214
- await flushPromises();
215
-
216
- const moreTabsSection = element.shadowRoot.querySelector(
217
- selectors.moreTabsSection
218
- );
219
- expect(moreTabsSection).not.toBeNull();
220
- const moreTabsSectionIsVisible =
221
- moreTabsSection.style.display === 'block';
222
- expect(moreTabsSectionIsVisible).toBe(true);
223
-
224
- const expectedNumberOfTabsToBeVisible = 1;
225
- const visibleTabs = exampleTabSlots.filter(
226
- (tab) => tab.style.visibility === 'visible'
227
- );
228
- expect(visibleTabs.length).toBe(expectedNumberOfTabsToBeVisible);
229
-
230
- const expectedNumberOfTabsToBeHidden = 2;
231
- const hiddenTabs = exampleTabSlots.filter(
232
- (tab) => tab.style.visibility === 'hidden'
233
- );
234
- expect(hiddenTabs.length).toBe(expectedNumberOfTabsToBeHidden);
235
- });
236
-
237
- it('should display the correct tabs in the tabs dropdown list', async () => {
238
- const element = createTestComponent(defaultOptions, exampleTabSlots);
239
- await flushPromises();
240
-
241
- const tabItemsInDropdown = element.shadowRoot.querySelectorAll(
242
- selectors.tabItemsInDropdown
243
- );
244
-
245
- const expectedNumberOfTabsToBeVisible = 1;
246
- const expectedNumberOfTabsToBeHidden = 2;
247
-
248
- expect(tabItemsInDropdown.length).toBe(expectedNumberOfTabsToBeHidden);
249
- const tabsInDropdownLabels = Array.from(tabItemsInDropdown).map(
250
- (tab) => tab.textContent
251
- );
252
- const expectedTabsInDropdownLabels = exampleTabSlots
253
- .slice(expectedNumberOfTabsToBeVisible)
254
- .map((tab) => tab.label);
255
- expect(tabsInDropdownLabels).toEqual(expectedTabsInDropdownLabels);
256
- });
257
-
258
- it('should open and close the tabs dropdown list after clicking the more tabs button', async () => {
259
- const element = createTestComponent(defaultOptions, exampleTabSlots);
260
- await flushPromises();
261
-
262
- const moreTabsButton = element.shadowRoot.querySelector(
263
- selectors.moreTabsButton
264
- );
265
- const tabsDropdown = element.shadowRoot.querySelector(
266
- selectors.tabsDropdown
267
- );
268
- const expectedOpentabsDropdownCSSClass = 'slds-is-open';
269
-
270
- expect(moreTabsButton).not.toBeNull();
271
- expect(tabsDropdown).not.toBeNull();
272
- expect(tabsDropdown.classList).not.toContain(
273
- expectedOpentabsDropdownCSSClass
274
- );
275
-
276
- await moreTabsButton.click();
277
- expect(tabsDropdown.classList).toContain(
278
- expectedOpentabsDropdownCSSClass
279
- );
280
-
281
- await moreTabsButton.click();
282
- expect(tabsDropdown.classList).not.toContain(
283
- expectedOpentabsDropdownCSSClass
284
- );
285
- });
286
-
287
- it('should call the select method of a tab when selecting it from the tabs dropdown list', async () => {
288
- const element = createTestComponent(defaultOptions, exampleTabSlots);
289
- await flushPromises();
290
-
291
- const expectedNumberOfTabsToBeVisible = 1;
292
- const expectedNumberOfTabsToBeHidden = 2;
293
-
294
- const tabItemsInDropdown = element.shadowRoot.querySelectorAll(
295
- selectors.tabItemsInDropdown
296
- );
297
-
298
- const exampleIndex = 0;
299
- await tabItemsInDropdown[exampleIndex].click();
300
- expect(tabItemsInDropdown.length).toBe(expectedNumberOfTabsToBeHidden);
301
- expect(functionMocks.select).toHaveBeenCalledTimes(1);
302
- expect(functionMocks.select).toHaveBeenCalledWith(
303
- expectedNumberOfTabsToBeVisible + exampleIndex
304
- );
305
- });
306
- });
307
-
308
- describe('the lightTheme property', () => {
309
- it('should display the component with the light theme styles when lightTheme is true', async () => {
310
- const expectedDarkThemeClass = 'slds-theme_shade';
311
- const element = createTestComponent({lightTheme: true});
312
- await flushPromises();
313
-
314
- const tabBarContainer = element.shadowRoot.querySelector(
315
- selectors.tabBarContainer
316
- );
317
- expect(tabBarContainer.classList).not.toContain(expectedDarkThemeClass);
318
- });
319
-
320
- it('should display the component with the dark theme styles when lightTheme is false', async () => {
321
- const expectedDarkThemeClass = 'slds-theme_shade';
322
- const element = createTestComponent({lightTheme: false});
323
- await flushPromises();
324
-
325
- const tabBarContainer = element.shadowRoot.querySelector(
326
- selectors.tabBarContainer
327
- );
328
- expect(tabBarContainer.classList).toContain(expectedDarkThemeClass);
329
- });
330
- });
331
- });
@@ -1,65 +0,0 @@
1
- import {TabBarObject} from './pageObject';
2
- import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
3
- import {SearchObject} from '../../../../../../playwright/page-object/searchObject';
4
- import {
5
- searchRequestRegex,
6
- insightSearchRequestRegex,
7
- } from '../../../../../../playwright/utils/requests';
8
- import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
9
- import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
10
-
11
- const pageUrl = 's/quantic-tab-bar';
12
-
13
- interface TabBarOptions {
14
- lightTheme: boolean;
15
- }
16
-
17
- type QuanticTabBarE2EFixtures = {
18
- tabBar: TabBarObject;
19
- search: SearchObject;
20
- options: Partial<TabBarOptions>;
21
- };
22
-
23
- type QuanticTabBarE2ESearchFixtures = QuanticTabBarE2EFixtures;
24
-
25
- type QuanticTabBarE2EInsightFixtures = QuanticTabBarE2ESearchFixtures & {
26
- insightSetup: InsightSetupObject;
27
- };
28
-
29
- export const testSearch = quanticBase.extend<QuanticTabBarE2ESearchFixtures>({
30
- options: {},
31
- search: async ({page}, use) => {
32
- await use(new SearchObject(page, searchRequestRegex));
33
- },
34
- tabBar: async ({page, options, configuration, search}, use) => {
35
- await search.mockSearchWithBaseResponse();
36
- await page.goto(pageUrl);
37
- configuration.configure(options);
38
- await search.waitForSearchResponse();
39
-
40
- await use(new TabBarObject(page));
41
- },
42
- });
43
-
44
- export const testInsight = quanticBase.extend<QuanticTabBarE2EInsightFixtures>({
45
- options: {},
46
- search: async ({page}, use) => {
47
- await use(new SearchObject(page, insightSearchRequestRegex));
48
- },
49
- insightSetup: async ({page}, use) => {
50
- await use(new InsightSetupObject(page));
51
- },
52
- tabBar: async ({page, options, search, configuration, insightSetup}, use) => {
53
- await search.mockSearchWithBaseResponse();
54
- await page.goto(pageUrl);
55
- configuration.configure({...options, useCase: useCaseEnum.insight});
56
- await insightSetup.waitForInsightInterfaceInitialization();
57
- await Promise.all([
58
- search.waitForSearchResponse(),
59
- search.performSearch(),
60
- ]);
61
- await use(new TabBarObject(page));
62
- },
63
- });
64
-
65
- export {expect} from '@playwright/test';
@@ -1,80 +0,0 @@
1
- import type {Locator, Page, Request} from '@playwright/test';
2
- import {isUaSearchEvent} from '../../../../../../playwright/utils/requests';
3
-
4
- export class TabBarObject {
5
- constructor(public page: Page) {
6
- this.page = page;
7
- }
8
-
9
- get tabBar(): Locator {
10
- return this.page.locator('c-quantic-tab-bar');
11
- }
12
-
13
- get allTabs(): Locator {
14
- return this.tabBar.locator('c-quantic-tab');
15
- }
16
-
17
- get allVisibleTabs(): Locator {
18
- return this.tabBar.locator('c-quantic-tab').filter({
19
- has: this.page.locator(':visible'),
20
- });
21
- }
22
-
23
- get activeTab(): Locator {
24
- return this.tabBar.locator('c-quantic-tab').filter({
25
- has: this.page.locator('.slds-is-active'),
26
- });
27
- }
28
-
29
- get moreButton(): Locator {
30
- return this.tabBar.getByTestId('tab-bar_more-button');
31
- }
32
-
33
- get dropdownContainer(): Locator {
34
- return this.page.getByTestId('tab-bar_dropdown-container');
35
- }
36
-
37
- get allDropdownOptions(): Locator {
38
- return this.page.getByTestId('tab-bar_dropdown-item');
39
- }
40
-
41
- get tabBarContainer(): Locator {
42
- return this.page.locator('.tab-bar_container');
43
- }
44
-
45
- get tabBarDropdown(): Locator {
46
- return this.tabBar.locator('.tab-bar_dropdown');
47
- }
48
-
49
- async clickMoreButton(): Promise<void> {
50
- await this.moreButton.click();
51
- }
52
-
53
- async clickDropdownOption(optionIndex: number): Promise<void> {
54
- await this.allDropdownOptions.nth(optionIndex).click();
55
- }
56
-
57
- async clickComponentContainer(): Promise<void> {
58
- await this.tabBarContainer.click();
59
- }
60
-
61
- async waitForTabUaAnalytics(actionCause): Promise<Request> {
62
- const uaRequest = this.page.waitForRequest((request) => {
63
- if (isUaSearchEvent(request)) {
64
- const requestBody = request.postDataJSON?.();
65
- const expectedFields = {
66
- actionCause: actionCause,
67
- };
68
- return Object.keys(expectedFields).every(
69
- (key) => requestBody?.[key] === expectedFields[key]
70
- );
71
- }
72
- return false;
73
- });
74
- return uaRequest;
75
- }
76
-
77
- async waitForDropdownOptionSelectUaAnalytics(): Promise<Request> {
78
- return this.waitForTabUaAnalytics('interfaceChange');
79
- }
80
- }
@@ -1,172 +0,0 @@
1
- import {testSearch, testInsight, expect} from './fixture';
2
- import {useCaseTestCases} from '../../../../../../playwright/utils/useCase';
3
-
4
- const fixtures = {
5
- search: testSearch,
6
- insight: testInsight,
7
- };
8
-
9
- const extraSmallViewportWidth = 200;
10
- const smallViewportWidth = 260;
11
- const mediumViewportWidth = 300;
12
- const standardViewportHeight = 1080;
13
- const expectedNumberOfTabs = 4;
14
-
15
- const viewportTests = [
16
- {
17
- testDescribe: 'when the viewport is resized to a extra small width',
18
- viewportWidth: extraSmallViewportWidth,
19
- testLabel:
20
- 'should display only the selected tab and the more button without a label, the other tabs are in the dropdown',
21
- expectedNumberOfTabsDisplayed: 1,
22
- expectedMoreButtonLabel: '',
23
- },
24
- {
25
- testDescribe: 'when the viewport is resized to a small width',
26
- viewportWidth: smallViewportWidth,
27
- testLabel:
28
- 'should display only the selected tab and the more button with a label, the other tabs are in the dropdown',
29
- expectedNumberOfTabsDisplayed: 1,
30
- expectedMoreButtonLabel: 'More',
31
- },
32
- {
33
- testDescribe: 'when the viewport is resized to a medium width',
34
- viewportWidth: mediumViewportWidth,
35
- testLabel:
36
- 'should display only the first two tabs and the more button with a label, the other tabs are in the dropdown',
37
- expectedNumberOfTabsDisplayed: 2,
38
- expectedMoreButtonLabel: 'More',
39
- },
40
- ];
41
-
42
- useCaseTestCases.forEach((useCase) => {
43
- let test = fixtures[useCase.value];
44
- test.describe(`quantic tab bar ${useCase.label}`, () => {
45
- test.describe("when the container's width can fit all the tabs", () => {
46
- test('should display all the tabs without displaying the dropdown list', async ({
47
- tabBar,
48
- }) => {
49
- const tabBarElement = tabBar.tabBar;
50
- await tabBarElement.scrollIntoViewIfNeeded();
51
- const tabs = tabBar.allTabs;
52
- expect(tabs).not.toBeNull();
53
- expect(await tabs.count()).toEqual(expectedNumberOfTabs);
54
-
55
- const isMoreDropdownVisible =
56
- await tabBar.dropdownContainer.isVisible();
57
- expect(isMoreDropdownVisible).toBe(false);
58
- });
59
- });
60
-
61
- // Test different behaviors based on the viewport width.
62
- viewportTests.forEach(
63
- ({
64
- testDescribe,
65
- viewportWidth,
66
- testLabel,
67
- expectedNumberOfTabsDisplayed,
68
- expectedMoreButtonLabel,
69
- }) => {
70
- test.describe(testDescribe, () => {
71
- test.use({
72
- viewport: {width: viewportWidth, height: standardViewportHeight},
73
- });
74
- test(testLabel, async ({tabBar}) => {
75
- const dropdownContainer = tabBar.dropdownContainer;
76
- await dropdownContainer.scrollIntoViewIfNeeded();
77
-
78
- const displayedTabs = tabBar.allVisibleTabs;
79
- expect(displayedTabs).not.toBeNull();
80
- expect(await displayedTabs.count()).toEqual(
81
- expectedNumberOfTabsDisplayed
82
- );
83
-
84
- expect(await dropdownContainer.isVisible()).toBe(true);
85
-
86
- await tabBar.clickMoreButton();
87
-
88
- const tabsInDropdown = tabBar.allDropdownOptions;
89
- expect(tabsInDropdown).not.toBeNull();
90
- expect(await tabsInDropdown.count()).toEqual(
91
- expectedNumberOfTabs - expectedNumberOfTabsDisplayed
92
- );
93
-
94
- expect(await tabBar.moreButton.textContent()).toEqual(
95
- expectedMoreButtonLabel
96
- );
97
- });
98
- });
99
- }
100
- );
101
-
102
- test.describe('when the more button is clicked', () => {
103
- // Using medium width (300px), 2 tabs should be displayed and 2 should be in the dropdown.
104
- test.use({
105
- viewport: {width: mediumViewportWidth, height: standardViewportHeight},
106
- });
107
-
108
- test.describe('when a tab is selected from the dropdown list', () => {
109
- test('should make the tab active, trigger a new search and send the correct analytics event', async ({
110
- tabBar,
111
- search,
112
- }) => {
113
- const expectedSelectedTabLabel = 'Tab 4';
114
- const expectedNumberOfDropdownOptions = 2;
115
- const expectedActionCause = 'interfaceChange';
116
- const expectedTabValue = 'Tab 4';
117
-
118
- const searchResponsePromise = search.waitForSearchResponse();
119
- const uaRequestPromise =
120
- tabBar.waitForDropdownOptionSelectUaAnalytics();
121
-
122
- await tabBar.clickMoreButton();
123
- const dropdownOptionsCount = await tabBar.allDropdownOptions.count();
124
- expect(dropdownOptionsCount).not.toBeNull();
125
- expect(dropdownOptionsCount).toEqual(expectedNumberOfDropdownOptions);
126
- await tabBar.clickDropdownOption(1);
127
-
128
- const activeTab = await tabBar.activeTab.textContent();
129
-
130
- expect(activeTab).not.toBeNull();
131
- expect(activeTab).toEqual(expectedSelectedTabLabel);
132
-
133
- const searchResponse = await searchResponsePromise;
134
- const searchResponseBody = searchResponse.request().postDataJSON();
135
-
136
- expect(searchResponseBody).toEqual(
137
- expect.objectContaining({
138
- analytics: expect.objectContaining({
139
- actionCause: expectedActionCause,
140
- }),
141
- tab: expectedTabValue,
142
- })
143
- );
144
-
145
- const uaRequest = await uaRequestPromise;
146
- const requestBody = uaRequest.postDataJSON?.();
147
-
148
- expect(requestBody).not.toBeNull();
149
- expect(requestBody.actionCause).toEqual(expectedActionCause);
150
- expect(requestBody.customData.interfaceChangeTo).toEqual(
151
- expectedTabValue
152
- );
153
- });
154
- });
155
- });
156
-
157
- test.describe('when the dropdown loses focus', () => {
158
- test.use({
159
- viewport: {width: mediumViewportWidth, height: standardViewportHeight},
160
- });
161
- test('should automatically close the dropdown list', async ({tabBar}) => {
162
- await tabBar.clickMoreButton();
163
-
164
- expect(await tabBar.tabBarDropdown.isVisible()).toBe(true);
165
-
166
- await tabBar.clickComponentContainer();
167
-
168
- expect(await tabBar.tabBarDropdown.isVisible()).toBe(false);
169
- });
170
- });
171
- });
172
- });