@coveo/quantic 3.32.0 → 3.33.1
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.
- package/README.md +15 -15
- package/docs/out/quantic-docs.json +1 -1
- package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +106 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +752 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +76 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +282 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +167 -0
- package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +262 -0
- package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +819 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +23 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +51 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +152 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +269 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +1183 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +27 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +75 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +199 -0
- package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +371 -0
- package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +212 -0
- package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +688 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +24 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +68 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +27 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +145 -0
- package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +348 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +48 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +80 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +173 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +219 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +404 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +38 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +52 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +102 -0
- package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +1105 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +21 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +73 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +67 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +208 -0
- package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +28 -0
- package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +178 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +64 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +23 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +82 -0
- package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +392 -0
- package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +448 -0
- package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +298 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +323 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +70 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +81 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +69 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +1158 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +56 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +185 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +451 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +337 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +151 -0
- package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +71 -0
- package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +651 -0
- package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +194 -0
- package/force-app/main/default/lwc/quanticInsightInterface/quanticInsightInterface.js +1 -1
- package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +230 -0
- package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +205 -0
- package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +309 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +58 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +47 -0
- package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +953 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +28 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +71 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +59 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +164 -0
- package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +430 -0
- package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +65 -0
- package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +69 -0
- package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +106 -0
- package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +47 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +13 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +14 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +82 -0
- package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +273 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +448 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +42 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +93 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +516 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +42 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +61 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +48 -0
- package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +491 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +35 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +52 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +53 -0
- package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +747 -0
- package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +542 -0
- package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +262 -0
- package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +141 -0
- package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +340 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +300 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +46 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +49 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +40 -0
- package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +144 -0
- package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +120 -0
- package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +209 -0
- package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +261 -0
- package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +342 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +66 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +81 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +69 -0
- package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +235 -0
- package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +144 -0
- package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +324 -0
- package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +301 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +81 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +38 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +66 -0
- package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +90 -0
- package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +155 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +464 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +74 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +85 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +97 -0
- package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +487 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +84 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +45 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +159 -0
- package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +743 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +571 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +110 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +113 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +299 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +341 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +21 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +91 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +196 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +192 -0
- package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +126 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +290 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +329 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +31 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +93 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +160 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +127 -0
- package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +416 -0
- package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +61 -0
- package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +89 -0
- package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +91 -0
- package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +136 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +387 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +53 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +54 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +72 -0
- package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +222 -0
- package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +244 -0
- package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +333 -0
- package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +56 -0
- package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +68 -0
- package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +72 -0
- package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +331 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +61 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +80 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +171 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +1037 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +58 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +43 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +160 -0
- package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +107 -0
- package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +427 -0
- package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +269 -0
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +89 -0
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +511 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +229 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +71 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +39 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +84 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +92 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +71 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +223 -0
- package/force-app/main/default/lwc/quanticUtils/recentQueriesUtils.js +20 -12
- package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +131 -0
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/case-assist-engine/case-assist-engine.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-engine/commerce-engine.d.ts +16 -16
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/common-reducers.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/insight-engine/insight-engine.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/recommendation-engine/recommendation-engine.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/store.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/headless-core-commerce-facet.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/headless-core-range-facet.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/recent-queries-list/headless-core-recent-queries-list.d.ts +91 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/attach-to-case/headless-attach-to-case.d.ts +2 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/attached-results/headless-attached-results.d.ts +68 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/insight/recent-queries-list/headless-insight-recent-queries-list.d.ts +14 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-queries-list/headless-recent-queries-list.d.ts +2 -79
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/actions-history/ipx-actions-history-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/advanced-search-queries/advanced-search-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/search-action-cause.d.ts +9 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/attached-results/attached-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/attached-results/attached-results-state.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-assist-configuration/case-assist-configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-context/case-context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-input/case-input-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/configuration/configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/did-you-mean/did-you-mean-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/commerce-facet-search-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-set/facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/field-suggestions-order/field-suggestions-order-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/manual-numeric-facet-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/instant-products/instant-products-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/parameters/parameters-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product/product-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query/query-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recent-queries/recent-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/sort/sort-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/triggers/triggers-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/debug-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/version-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/automatic-facet-set/automatic-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-order/facet-order-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/category/category-facet-search-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/generic/generic-facet-search-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/specific/specific-facet-search-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/insight-folding-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-actions.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-slice.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-configuration/insight-configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/legacy/insight-search-actions.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-results/instant-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/pagination/pagination-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/pipeline/pipeline-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-set/query-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/question-answering/question-answering-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-queries/recent-queries-insight-analytics-actions.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-queries/recent-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-results/recent-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-actions.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +6 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-hub/search-hub-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/triggers/triggers-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/insight.index.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +6 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/fetch-static-state.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/from-build-result.d.ts +6 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/types/hydrate-static-state.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/access-token-manager.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/augment-preprocess-request.d.ts +7 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/fetch-static-state.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/types/hydrate-static-state.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +4 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/augment-preprocess-request.d.ts +7 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/state/insight-app-state.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-ssr-controller-definitions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +9 -9
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +3 -3
- package/package.json +46 -44
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {testSearch, testInsight, expect} from './fixture';
|
|
2
|
+
import {
|
|
3
|
+
useCaseEnum,
|
|
4
|
+
useCaseTestCases,
|
|
5
|
+
} from '../../../../../../playwright/utils/useCase';
|
|
6
|
+
|
|
7
|
+
const fixtures = {
|
|
8
|
+
search: testSearch as typeof testSearch,
|
|
9
|
+
insight: testInsight as typeof testInsight,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
useCaseTestCases.forEach((useCase) => {
|
|
13
|
+
let test;
|
|
14
|
+
let sortArrOptions;
|
|
15
|
+
let sortLabelWithValue;
|
|
16
|
+
if (useCase.value === useCaseEnum.search) {
|
|
17
|
+
test = fixtures[useCase.value] as typeof testSearch;
|
|
18
|
+
} else {
|
|
19
|
+
test = fixtures[useCase.value] as typeof testInsight;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
test.describe(`quantic sort ${useCase.label}`, () => {
|
|
23
|
+
test.beforeEach(async ({sort}) => {
|
|
24
|
+
await sort.clickSortDropDown();
|
|
25
|
+
sortArrOptions = await sort.allSortLabelOptions();
|
|
26
|
+
sortLabelWithValue = await sort.getSortLabelValue();
|
|
27
|
+
await sort.clickSortDropDown();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test.describe(`when changing sort option to 2nd position`, () => {
|
|
31
|
+
test('should trigger a new search and log analytics', async ({
|
|
32
|
+
sort,
|
|
33
|
+
search,
|
|
34
|
+
}) => {
|
|
35
|
+
const {label: expectedSortName, value: expectedSortValue} =
|
|
36
|
+
sortLabelWithValue[1]; // Assuming 0 is the first sort option, 1 should be the 2nd one after that.
|
|
37
|
+
|
|
38
|
+
const searchResponsePromise = search.waitForSearchResponse();
|
|
39
|
+
await sort.clickSortDropDown();
|
|
40
|
+
await sort.clickSortButton(expectedSortName);
|
|
41
|
+
|
|
42
|
+
const searchResponse = await searchResponsePromise;
|
|
43
|
+
const {sortCriteria} = searchResponse.request().postDataJSON();
|
|
44
|
+
expect(sortCriteria).toBe(expectedSortValue);
|
|
45
|
+
await sort.waitForSortUaAnalytics(expectedSortValue);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test.describe('when testing accessibility', () => {
|
|
50
|
+
test('should be accessible to keyboard', async ({sort, page}) => {
|
|
51
|
+
let selectedSortLabel = await sort.sortDropDown.textContent();
|
|
52
|
+
expect(selectedSortLabel).toEqual(sortArrOptions[0]);
|
|
53
|
+
|
|
54
|
+
// Selecting the next sort using Enter to open dropdown, the ArrowDown, then ENTER key
|
|
55
|
+
await sort.focusSortDropDown();
|
|
56
|
+
await sort.openSortDropdownUsingKeyboardEnter();
|
|
57
|
+
await page.keyboard.press('ArrowDown');
|
|
58
|
+
await page.keyboard.press('Enter');
|
|
59
|
+
selectedSortLabel = await sort.sortDropDown.textContent();
|
|
60
|
+
expect(selectedSortLabel).toEqual(sortArrOptions[1]);
|
|
61
|
+
|
|
62
|
+
// Selecting the next sort using Space to open dropdown, the ArrowDown, then ENTER key
|
|
63
|
+
await sort.focusSortDropDown();
|
|
64
|
+
await sort.openSortDropdownUsingKeyboardEnter(false);
|
|
65
|
+
await page.keyboard.press('ArrowDown');
|
|
66
|
+
await page.keyboard.press('Enter');
|
|
67
|
+
selectedSortLabel = await sort.sortDropDown.textContent();
|
|
68
|
+
expect(selectedSortLabel).toEqual(sortArrOptions[2]);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
if (useCase.value === 'search') {
|
|
73
|
+
test.describe('when loading options from the url', () => {
|
|
74
|
+
test('should reflect the options of url in the component', async ({
|
|
75
|
+
sort,
|
|
76
|
+
page,
|
|
77
|
+
}) => {
|
|
78
|
+
const {label: expectedSortName, value: expectedSortValue} =
|
|
79
|
+
sortLabelWithValue[2]; // Assuming 0 is the first sort option
|
|
80
|
+
|
|
81
|
+
const currentUrl = await page.url();
|
|
82
|
+
const urlHash = `#sortCriteria=${encodeURI(expectedSortValue)}`;
|
|
83
|
+
|
|
84
|
+
await page.goto(`${currentUrl}/${urlHash}`);
|
|
85
|
+
await page.getByRole('button', {name: 'Try it now'}).click();
|
|
86
|
+
await expect(sort.sortDropDown).toContainText(expectedSortName);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
});
|
package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/* eslint-disable no-import-assign */
|
|
2
|
+
import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import {createElement} from 'lwc';
|
|
5
|
+
import QuanticSourceCitations from '../quanticSourceCitations';
|
|
6
|
+
|
|
7
|
+
jest.mock('c/quanticHeadlessLoader');
|
|
8
|
+
|
|
9
|
+
let isInitialized = false;
|
|
10
|
+
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
mockHeadlessLoader.initializeWithHeadless = (element, engineId, initialize) => {
|
|
13
|
+
if (element instanceof QuanticSourceCitations) {
|
|
14
|
+
if (!isInitialized) {
|
|
15
|
+
isInitialized = true;
|
|
16
|
+
initialize();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
mockHeadlessLoader.getHeadlessBundle = () => {
|
|
23
|
+
return {
|
|
24
|
+
buildInteractiveCitation: jest.fn((engine, {options}) => options.citation),
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const mockCitations = [
|
|
29
|
+
{
|
|
30
|
+
id: '1',
|
|
31
|
+
title: 'Example title 1',
|
|
32
|
+
uri: 'https://example.com/',
|
|
33
|
+
clickUri: 'https://example.com/',
|
|
34
|
+
permanentid: '1',
|
|
35
|
+
text: 'text 01',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: '2',
|
|
39
|
+
title: 'Example title 2',
|
|
40
|
+
uri: 'https://example.com/',
|
|
41
|
+
clickUri: 'https://example.com/',
|
|
42
|
+
permanentid: '2',
|
|
43
|
+
text: 'text 02',
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
const defaultOptions = {
|
|
48
|
+
citations: mockCitations,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const selectors = {
|
|
52
|
+
citation: 'c-quantic-citation',
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function createTestComponent(options = defaultOptions) {
|
|
56
|
+
const element = createElement('c-quantic-source-citations', {
|
|
57
|
+
is: QuanticSourceCitations,
|
|
58
|
+
});
|
|
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
|
+
// Helper function to wait until the microtask queue is empty.
|
|
69
|
+
function flushPromises() {
|
|
70
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
describe('c-quantic-source-citations', () => {
|
|
74
|
+
function cleanup() {
|
|
75
|
+
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
76
|
+
while (document.body.firstChild) {
|
|
77
|
+
document.body.removeChild(document.body.firstChild);
|
|
78
|
+
}
|
|
79
|
+
isInitialized = false;
|
|
80
|
+
jest.clearAllMocks();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
afterEach(() => {
|
|
84
|
+
cleanup();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('when there are citations found', () => {
|
|
88
|
+
it('should properly display the citations', async () => {
|
|
89
|
+
const element = createTestComponent();
|
|
90
|
+
await flushPromises();
|
|
91
|
+
|
|
92
|
+
const citations = element.shadowRoot.querySelectorAll(selectors.citation);
|
|
93
|
+
expect(citations).not.toBeNull();
|
|
94
|
+
expect(citations.length).toEqual(mockCitations.length);
|
|
95
|
+
|
|
96
|
+
citations.forEach((citationElement, index) => {
|
|
97
|
+
expect(citationElement.citation).toEqual({
|
|
98
|
+
...mockCitations[index],
|
|
99
|
+
index: index + 1,
|
|
100
|
+
});
|
|
101
|
+
expect(citationElement.interactiveCitation).toEqual(
|
|
102
|
+
mockCitations[index]
|
|
103
|
+
);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('should pass the disableCitationAnchoring property to the citation component', async () => {
|
|
108
|
+
const element = createTestComponent();
|
|
109
|
+
await flushPromises();
|
|
110
|
+
|
|
111
|
+
const citations = element.shadowRoot.querySelectorAll(selectors.citation);
|
|
112
|
+
expect(citations).not.toBeNull();
|
|
113
|
+
expect(citations.length).toEqual(mockCitations.length);
|
|
114
|
+
|
|
115
|
+
citations.forEach((citationElement) => {
|
|
116
|
+
expect(citationElement.disableCitationAnchoring).toBe(false);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe('when there are no citations found', () => {
|
|
122
|
+
it('should not display citations', async () => {
|
|
123
|
+
const element = createTestComponent({
|
|
124
|
+
...defaultOptions,
|
|
125
|
+
citations: null,
|
|
126
|
+
});
|
|
127
|
+
await flushPromises();
|
|
128
|
+
|
|
129
|
+
const citations = element.shadowRoot.querySelector(
|
|
130
|
+
selectors.sourceCitation
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
expect(citations).toBeNull();
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
/* eslint-disable @lwc/lwc/no-unexpected-wire-adapter-usages */
|
|
2
|
+
/* eslint-disable no-import-assign */
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import QuanticStandaloneSearchBox from 'c/quanticStandaloneSearchBox';
|
|
5
|
+
import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
|
|
6
|
+
import {CurrentPageReference} from 'lightning/navigation';
|
|
7
|
+
import getHeadlessConfiguration from '@salesforce/apex/HeadlessController.getHeadlessConfiguration';
|
|
8
|
+
import {STANDALONE_SEARCH_BOX_STORAGE_KEY} from 'c/quanticUtils';
|
|
9
|
+
import {buildCreateTestComponent, cleanup, flushPromises} from 'c/testUtils';
|
|
10
|
+
|
|
11
|
+
const selectors = {
|
|
12
|
+
searchBoxInput: 'c-quantic-search-box-input',
|
|
13
|
+
searchBox: 'c-quantic-search-box',
|
|
14
|
+
searchInterface: 'c-quantic-search-interface',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const nonStandaloneURL = 'https://www.example.com/global-search/%40uri';
|
|
18
|
+
const defaultHeadlessConfiguration = JSON.stringify({
|
|
19
|
+
organization: 'testOrgId',
|
|
20
|
+
accessToken: 'testAccessToken',
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
jest.mock('c/quanticHeadlessLoader');
|
|
24
|
+
|
|
25
|
+
jest.mock(
|
|
26
|
+
'@salesforce/apex/HeadlessController.getHeadlessConfiguration',
|
|
27
|
+
() => ({
|
|
28
|
+
default: jest.fn(),
|
|
29
|
+
}),
|
|
30
|
+
{virtual: true}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
mockHeadlessLoader.loadDependencies = () =>
|
|
35
|
+
new Promise((resolve) => {
|
|
36
|
+
resolve();
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
let isInitialized = false;
|
|
40
|
+
|
|
41
|
+
const exampleEngine = {
|
|
42
|
+
id: 'engineId',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
let updateState;
|
|
46
|
+
let stateMock = {};
|
|
47
|
+
const mockStandaloneSearchBox = {
|
|
48
|
+
state: stateMock,
|
|
49
|
+
subscribe: jest.fn((cb) => {
|
|
50
|
+
updateState = cb;
|
|
51
|
+
cb();
|
|
52
|
+
// eslint-disable-next-line no-use-before-define
|
|
53
|
+
return functionsMocks.unsubscribe;
|
|
54
|
+
}),
|
|
55
|
+
updateText: jest.fn(),
|
|
56
|
+
submit: jest.fn(),
|
|
57
|
+
showSuggestions: jest.fn(),
|
|
58
|
+
selectSuggestion: jest.fn(),
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const functionsMocks = {
|
|
62
|
+
buildStandaloneSearchBox: jest.fn(() => mockStandaloneSearchBox),
|
|
63
|
+
unsubscribe: jest.fn(() => {}),
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const defaultOptions = {
|
|
67
|
+
engineId: exampleEngine.id,
|
|
68
|
+
placeholder: null,
|
|
69
|
+
withoutSubmitButton: false,
|
|
70
|
+
numberOfSuggestions: 7,
|
|
71
|
+
textarea: false,
|
|
72
|
+
disableRecentQueries: false,
|
|
73
|
+
keepFiltersOnSearch: false,
|
|
74
|
+
redirectUrl: '/global-search/%40uri',
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const createTestComponent = buildCreateTestComponent(
|
|
78
|
+
QuanticStandaloneSearchBox,
|
|
79
|
+
'c-quantic-standalone-search-box',
|
|
80
|
+
defaultOptions
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
function mockSuccessfulHeadlessInitialization() {
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
|
|
86
|
+
if (element instanceof QuanticStandaloneSearchBox && !isInitialized) {
|
|
87
|
+
isInitialized = true;
|
|
88
|
+
initialize(exampleEngine);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
describe('c-quantic-standalone-search-box', () => {
|
|
94
|
+
beforeEach(() => {
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
getHeadlessConfiguration.mockResolvedValue(defaultHeadlessConfiguration);
|
|
97
|
+
mockSuccessfulHeadlessInitialization();
|
|
98
|
+
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
global.CoveoHeadless = {
|
|
101
|
+
buildStandaloneSearchBox: functionsMocks.buildStandaloneSearchBox,
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
afterEach(() => {
|
|
106
|
+
cleanup();
|
|
107
|
+
isInitialized = false;
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe('with default options', () => {
|
|
111
|
+
it('should properly pass the options to the the quantic-search-box-input component', async () => {
|
|
112
|
+
const element = createTestComponent();
|
|
113
|
+
await flushPromises();
|
|
114
|
+
|
|
115
|
+
expect(element).not.toBeNull();
|
|
116
|
+
|
|
117
|
+
const quanticSearchInterface = element.shadowRoot.querySelector(
|
|
118
|
+
selectors.searchInterface
|
|
119
|
+
);
|
|
120
|
+
expect(quanticSearchInterface).not.toBeNull();
|
|
121
|
+
|
|
122
|
+
const input = quanticSearchInterface.querySelector(
|
|
123
|
+
selectors.searchBoxInput
|
|
124
|
+
);
|
|
125
|
+
expect(input).not.toBeNull();
|
|
126
|
+
expect(input.withoutSubmitButton).toBe(false);
|
|
127
|
+
expect(input.textarea).toBe(false);
|
|
128
|
+
expect(input.placeholder).toBe(null);
|
|
129
|
+
expect(input.inputValue).toBe('');
|
|
130
|
+
expect(input.recentQueries).toBeUndefined();
|
|
131
|
+
expect(input.maxNumberOfSuggestions).toBe(7);
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('with custom options', () => {
|
|
136
|
+
it('should properly render the quantic standalone search box component', async () => {
|
|
137
|
+
const element = createTestComponent({
|
|
138
|
+
engineId: exampleEngine.id,
|
|
139
|
+
placeholder: 'place',
|
|
140
|
+
withoutSubmitButton: true,
|
|
141
|
+
numberOfSuggestions: 10,
|
|
142
|
+
keepFiltersOnSearch: true,
|
|
143
|
+
redirectUrl: '/custom-search/%40uri',
|
|
144
|
+
searchHub: 'customHub',
|
|
145
|
+
pipeline: 'customPipeline',
|
|
146
|
+
textarea: true,
|
|
147
|
+
disableRecentQueries: true,
|
|
148
|
+
});
|
|
149
|
+
await flushPromises();
|
|
150
|
+
expect(element).not.toBeNull();
|
|
151
|
+
|
|
152
|
+
const input = element.shadowRoot.querySelector(selectors.searchBoxInput);
|
|
153
|
+
expect(input).not.toBeNull();
|
|
154
|
+
expect(input.withoutSubmitButton).toBe(true);
|
|
155
|
+
expect(input.textarea).toBe(true);
|
|
156
|
+
expect(input.placeholder).toBe('place');
|
|
157
|
+
expect(input.inputValue).toBe('');
|
|
158
|
+
expect(input.recentQueries).toBeUndefined();
|
|
159
|
+
expect(input.maxNumberOfSuggestions).toBe(7);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
describe('with suggestions', () => {
|
|
164
|
+
it('should render the standalone searchbox component with suggestions', async () => {
|
|
165
|
+
const element = createTestComponent();
|
|
166
|
+
await flushPromises();
|
|
167
|
+
|
|
168
|
+
stateMock.suggestions = [
|
|
169
|
+
{
|
|
170
|
+
rawValue: 'suggestion1',
|
|
171
|
+
highlightedValue: 'suggestion1',
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
rawValue: 'suggestion2',
|
|
175
|
+
highlightedValue: 'suggestion2',
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
updateState();
|
|
179
|
+
await flushPromises();
|
|
180
|
+
|
|
181
|
+
const input = element.shadowRoot.querySelector(selectors.searchBoxInput);
|
|
182
|
+
expect(input.suggestions).toStrictEqual([
|
|
183
|
+
{
|
|
184
|
+
key: 0,
|
|
185
|
+
rawValue: 'suggestion1',
|
|
186
|
+
value: 'suggestion1',
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
key: 1,
|
|
190
|
+
rawValue: 'suggestion2',
|
|
191
|
+
value: 'suggestion2',
|
|
192
|
+
},
|
|
193
|
+
]);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
describe('with redirect', () => {
|
|
198
|
+
it('should redirect to the search page when a redirect is triggered', async () => {
|
|
199
|
+
createTestComponent();
|
|
200
|
+
await flushPromises();
|
|
201
|
+
|
|
202
|
+
stateMock.redirectTo = true;
|
|
203
|
+
stateMock.value = 'search term';
|
|
204
|
+
stateMock.analytics = 'analytics babyyyy';
|
|
205
|
+
updateState();
|
|
206
|
+
await flushPromises();
|
|
207
|
+
|
|
208
|
+
expect(localStorage.getItem(STANDALONE_SEARCH_BOX_STORAGE_KEY)).toBe(
|
|
209
|
+
JSON.stringify({value: 'search term', analytics: 'analytics babyyyy'})
|
|
210
|
+
);
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
describe('controller initialization', () => {
|
|
215
|
+
it('should subscribe to the headless state changes', async () => {
|
|
216
|
+
createTestComponent();
|
|
217
|
+
await flushPromises();
|
|
218
|
+
|
|
219
|
+
expect(mockStandaloneSearchBox.subscribe).toHaveBeenCalledTimes(1);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
describe('when the current page reference changes', () => {
|
|
223
|
+
beforeAll(() => {
|
|
224
|
+
// This is needed to mock the window.location.href property to test the keepFiltersOnSearch property in the quanticSearchBox.
|
|
225
|
+
// https://stackoverflow.com/questions/54021037/how-to-mock-window-location-href-with-jest-vuejs
|
|
226
|
+
Object.defineProperty(window, 'location', {
|
|
227
|
+
writable: true,
|
|
228
|
+
value: {href: nonStandaloneURL},
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('should display the searchbox as a non-standalone component', async () => {
|
|
233
|
+
const element = createTestComponent();
|
|
234
|
+
|
|
235
|
+
// @ts-ignore
|
|
236
|
+
CurrentPageReference.emit({url: nonStandaloneURL});
|
|
237
|
+
await flushPromises();
|
|
238
|
+
|
|
239
|
+
const searchBox = element.shadowRoot.querySelector(selectors.searchBox);
|
|
240
|
+
expect(searchBox).not.toBeNull();
|
|
241
|
+
const quanticSearchInterface = element.shadowRoot.querySelector(
|
|
242
|
+
selectors.searchInterface
|
|
243
|
+
);
|
|
244
|
+
expect(quanticSearchInterface).toBeNull();
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should properly pass the keepFiltersOnSearch property to the quanticSearchBox', async () => {
|
|
248
|
+
const element = createTestComponent({
|
|
249
|
+
...defaultOptions,
|
|
250
|
+
keepFiltersOnSearch: false,
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// @ts-ignore
|
|
254
|
+
CurrentPageReference.emit({url: nonStandaloneURL});
|
|
255
|
+
await flushPromises();
|
|
256
|
+
|
|
257
|
+
const searchBox = element.shadowRoot.querySelector(selectors.searchBox);
|
|
258
|
+
|
|
259
|
+
expect(searchBox).not.toBeNull();
|
|
260
|
+
expect(searchBox.keepFiltersOnSearch).toEqual(false);
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
describe('when keepFiltersOnSearch is false (default)', () => {
|
|
265
|
+
it('should properly initialize the controller with clear filters enabled', async () => {
|
|
266
|
+
createTestComponent();
|
|
267
|
+
await flushPromises();
|
|
268
|
+
|
|
269
|
+
expect(functionsMocks.buildStandaloneSearchBox).toHaveBeenCalledTimes(
|
|
270
|
+
1
|
|
271
|
+
);
|
|
272
|
+
expect(functionsMocks.buildStandaloneSearchBox).toHaveBeenCalledWith(
|
|
273
|
+
exampleEngine,
|
|
274
|
+
expect.objectContaining({
|
|
275
|
+
options: expect.objectContaining({clearFilters: true}),
|
|
276
|
+
})
|
|
277
|
+
);
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
describe('when keepFiltersOnSearch is true', () => {
|
|
282
|
+
it('should properly initialize the controller with clear filters disabled', async () => {
|
|
283
|
+
createTestComponent({
|
|
284
|
+
...defaultOptions,
|
|
285
|
+
keepFiltersOnSearch: true,
|
|
286
|
+
});
|
|
287
|
+
await flushPromises();
|
|
288
|
+
|
|
289
|
+
expect(functionsMocks.buildStandaloneSearchBox).toHaveBeenCalledTimes(
|
|
290
|
+
1
|
|
291
|
+
);
|
|
292
|
+
expect(functionsMocks.buildStandaloneSearchBox).toHaveBeenCalledWith(
|
|
293
|
+
exampleEngine,
|
|
294
|
+
expect.objectContaining({
|
|
295
|
+
options: expect.objectContaining({clearFilters: false}),
|
|
296
|
+
})
|
|
297
|
+
);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
describe('event handling', () => {
|
|
303
|
+
describe('quantic__inputvaluechange event', () => {
|
|
304
|
+
it('should call updateText when input value changes', async () => {
|
|
305
|
+
const element = createTestComponent();
|
|
306
|
+
await flushPromises();
|
|
307
|
+
|
|
308
|
+
const newValue = 'test query';
|
|
309
|
+
const event = new CustomEvent('quantic__inputvaluechange', {
|
|
310
|
+
detail: {value: newValue},
|
|
311
|
+
});
|
|
312
|
+
const eventSpy = jest.spyOn(event, 'stopPropagation');
|
|
313
|
+
|
|
314
|
+
element.dispatchEvent(event);
|
|
315
|
+
expect(mockStandaloneSearchBox.updateText).toHaveBeenCalledWith(
|
|
316
|
+
newValue
|
|
317
|
+
);
|
|
318
|
+
expect(eventSpy).toHaveBeenCalled();
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it('should not call updateText when value is the same', async () => {
|
|
322
|
+
const currentValue = 'current query';
|
|
323
|
+
mockStandaloneSearchBox.state.value = currentValue;
|
|
324
|
+
|
|
325
|
+
const element = createTestComponent();
|
|
326
|
+
await flushPromises();
|
|
327
|
+
|
|
328
|
+
const event = new CustomEvent('quantic__inputvaluechange', {
|
|
329
|
+
detail: {value: currentValue},
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
element.dispatchEvent(event);
|
|
333
|
+
|
|
334
|
+
expect(mockStandaloneSearchBox.updateText).not.toHaveBeenCalled();
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
describe('quantic__submitsearch event', () => {
|
|
339
|
+
it('should call submit', async () => {
|
|
340
|
+
const element = createTestComponent();
|
|
341
|
+
await flushPromises();
|
|
342
|
+
|
|
343
|
+
const event = new CustomEvent('quantic__submitsearch');
|
|
344
|
+
const eventSpy = jest.spyOn(event, 'stopPropagation');
|
|
345
|
+
element.dispatchEvent(event);
|
|
346
|
+
|
|
347
|
+
expect(mockStandaloneSearchBox.submit).toHaveBeenCalledTimes(1);
|
|
348
|
+
expect(eventSpy).toHaveBeenCalled();
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
describe('quantic__showsuggestions event', () => {
|
|
353
|
+
it('should call showSuggestions when suggestions should be shown', async () => {
|
|
354
|
+
const element = createTestComponent();
|
|
355
|
+
await flushPromises();
|
|
356
|
+
|
|
357
|
+
const event = new CustomEvent('quantic__showsuggestions');
|
|
358
|
+
const eventSpy = jest.spyOn(event, 'stopPropagation');
|
|
359
|
+
element.dispatchEvent(event);
|
|
360
|
+
|
|
361
|
+
expect(mockStandaloneSearchBox.showSuggestions).toHaveBeenCalledTimes(
|
|
362
|
+
1
|
|
363
|
+
);
|
|
364
|
+
expect(eventSpy).toHaveBeenCalled();
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
describe('quantic__selectsuggestion event', () => {
|
|
369
|
+
it('should call selectSuggestion with the correct value', async () => {
|
|
370
|
+
const element = createTestComponent();
|
|
371
|
+
await flushPromises();
|
|
372
|
+
|
|
373
|
+
const selectedSuggestion = {value: 'selected suggestion'};
|
|
374
|
+
const event = new CustomEvent('quantic__selectsuggestion', {
|
|
375
|
+
detail: {selectedSuggestion},
|
|
376
|
+
});
|
|
377
|
+
const eventSpy = jest.spyOn(event, 'stopPropagation');
|
|
378
|
+
element.dispatchEvent(event);
|
|
379
|
+
|
|
380
|
+
expect(mockStandaloneSearchBox.selectSuggestion).toHaveBeenCalledWith(
|
|
381
|
+
selectedSuggestion.value
|
|
382
|
+
);
|
|
383
|
+
expect(eventSpy).toHaveBeenCalled();
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {StandaloneSearchBoxObject} from './pageObject';
|
|
2
|
+
import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
|
|
3
|
+
import {SearchObject} from '../../../../../../playwright/page-object/searchObject';
|
|
4
|
+
import {
|
|
5
|
+
querySuggestRegex,
|
|
6
|
+
searchRequestRegex,
|
|
7
|
+
} from '../../../../../../playwright/utils/requests';
|
|
8
|
+
import {QuerySuggestObject} from '../../../../../../playwright/page-object/querySuggestObject';
|
|
9
|
+
|
|
10
|
+
const standaloneSearchBoxUrl = 's/quantic-standalone-search-box';
|
|
11
|
+
|
|
12
|
+
interface StandaloneSearchBoxOptions {
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
withoutSubmitButton?: boolean;
|
|
15
|
+
numberOfSuggestions?: number;
|
|
16
|
+
redirectUrl?: string;
|
|
17
|
+
searchHub?: string;
|
|
18
|
+
pipeline?: string;
|
|
19
|
+
textarea?: boolean;
|
|
20
|
+
disableRecentQueries?: boolean;
|
|
21
|
+
keepFiltersOnSearch?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type QuanticStandaloneSearchBoxE2EFixtures = {
|
|
25
|
+
searchBox: StandaloneSearchBoxObject;
|
|
26
|
+
search: SearchObject;
|
|
27
|
+
querySuggest: QuerySuggestObject;
|
|
28
|
+
options: Partial<StandaloneSearchBoxOptions>;
|
|
29
|
+
urlHash: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const testStandaloneSearchBox =
|
|
33
|
+
quanticBase.extend<QuanticStandaloneSearchBoxE2EFixtures>({
|
|
34
|
+
options: {},
|
|
35
|
+
urlHash: '',
|
|
36
|
+
search: async ({page}, use) => {
|
|
37
|
+
await use(new SearchObject(page, searchRequestRegex));
|
|
38
|
+
},
|
|
39
|
+
querySuggest: async ({page}, use) => {
|
|
40
|
+
await use(new QuerySuggestObject(page, querySuggestRegex));
|
|
41
|
+
},
|
|
42
|
+
searchBox: async ({page, options, configuration, urlHash}, use) => {
|
|
43
|
+
await page.goto(
|
|
44
|
+
urlHash
|
|
45
|
+
? `${standaloneSearchBoxUrl}#${urlHash}`
|
|
46
|
+
: standaloneSearchBoxUrl
|
|
47
|
+
);
|
|
48
|
+
await configuration.configure(options);
|
|
49
|
+
await use(new StandaloneSearchBoxObject(page));
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export {expect} from '@playwright/test';
|