@coveo/quantic 3.44.0 → 3.44.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/force-app/main/default/classes/OrganizationEndpointsTest.cls +71 -15
  2. package/force-app/main/default/classes/RecommendationsControllerTest.cls +1 -1
  3. package/force-app/main/default/lwc/quanticNumberButton/quanticNumberButton.js +5 -1
  4. package/force-app/main/default/lwc/quanticPager/quanticPager.html +8 -5
  5. package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
  6. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  7. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  8. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  9. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
  10. package/package.json +37 -34
  11. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
  12. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
  13. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
  15. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  16. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
  17. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  18. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  19. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  20. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  21. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  22. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  23. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
  24. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
  25. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
  26. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
  27. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
  28. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
  29. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  30. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
  31. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
  32. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
  33. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
  34. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
  35. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
  36. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
  37. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
  38. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
  39. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
  40. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
  41. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
  42. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
  43. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
  44. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
  45. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
  46. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
  47. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
  48. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
  49. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  50. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  51. package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
  52. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
  53. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  54. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  55. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
  56. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  57. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  58. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
  59. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
  60. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
  61. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
  62. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
  63. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
  64. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  65. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
  66. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
  67. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
  68. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
  69. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
  70. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
  71. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
  72. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
  73. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
  74. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
  75. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
  76. package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
  77. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  78. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  79. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
  80. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
  81. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
  82. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
  83. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
  84. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
  85. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
  86. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
  87. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
  88. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
  89. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
  90. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
  91. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
  92. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
  93. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  94. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
  95. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
  96. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  97. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  98. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  99. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  100. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
  101. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
  102. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
  103. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
  104. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
  105. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
  106. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
  107. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
  108. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
  109. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
  110. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
  111. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
  112. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
  113. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
  114. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  115. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  116. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  117. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
  118. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
  119. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
  120. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
  121. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  122. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  123. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  124. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
  125. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
  126. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
  127. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
  128. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
  129. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  130. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  131. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  132. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
  133. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
  134. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
  135. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
  136. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
  137. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  138. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
  139. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
  140. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  141. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  142. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
  143. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
  144. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
  145. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
  146. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
  147. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
  148. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
  149. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
  150. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
  151. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  152. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  153. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
  154. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  155. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  156. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  157. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  158. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  159. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  160. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
  161. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  162. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  163. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  164. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
  165. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
  166. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
  167. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
  168. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
  169. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
  170. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
  171. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
  172. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  173. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
  174. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
  175. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
  176. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
  177. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
  178. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  179. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
  180. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  181. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
  182. package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
  183. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
  184. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
  185. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
  186. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
  187. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
  188. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  189. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  190. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  191. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  192. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  193. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  194. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  195. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  196. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  197. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  198. package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
  199. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
  200. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  201. package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
  202. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
  203. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
  204. package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
  205. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,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
- });