@coveo/quantic 3.44.1 → 3.44.3
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 +12 -3
- package/force-app/main/default/classes/OrganizationEndpointsTest.cls +71 -15
- package/force-app/main/default/classes/RecommendationsControllerTest.cls +1 -1
- package/force-app/main/default/lwc/quanticCitation/quanticCitation.js +2 -2
- package/force-app/main/default/lwc/quanticHeadlessLoader/quanticHeadlessLoader.js +158 -87
- package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
- package/force-app/main/default/staticresources/dompurify/purify.min.js +2 -2
- package/package.json +43 -41
- package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
- package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
- package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
- package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
- package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
- package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
- package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
- package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
- package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
- package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
- package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
- package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
- package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
- package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
- package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
- package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
- package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
- package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
- package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
- package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
- package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
- package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
- package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
- package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
- package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
- package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
- package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
- package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
- package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
- package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
- package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
- package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
- package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
- package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
- package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
- package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
- package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
- package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
- package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
- package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
- package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
- package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
- package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
- package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
- package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
- package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
- package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
- package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
- package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
- package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
- package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
- package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
- package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
- package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
- package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
- package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
- package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
- package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
- package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
- package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
- package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
- package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
- package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
- package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
- package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
- package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
- package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
- package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
- package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
- package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
- package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
- package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
- package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
- package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
- package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
- package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
- package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
- package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
- package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
- package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
- package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
- package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
- package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
- package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
- package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
- package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
- package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
- package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
- package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
- package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
- package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
- package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
- package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
- package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
- package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
- package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
- package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
- package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
- package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
- package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
- package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
- package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
- package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
- package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
- package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
- package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
- package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
- package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
|
@@ -1,86 +0,0 @@
|
|
|
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: string[];
|
|
15
|
-
let sortLabelWithValue: {label: string; value: string | null}[];
|
|
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
|
-
sortLabelWithValue = await sort.getSortLabelValue();
|
|
26
|
-
sortArrOptions = sortLabelWithValue.map(({label}) => label);
|
|
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}) => {
|
|
51
|
-
await expect(sort.sortDropDown).toHaveText(sortArrOptions[0]);
|
|
52
|
-
|
|
53
|
-
// Selecting the next sort using Enter to open dropdown, the ArrowDown, then ENTER key
|
|
54
|
-
await sort.focusSortDropDown();
|
|
55
|
-
await sort.openSortDropdownUsingKeyboardEnter();
|
|
56
|
-
await sort.selectNextSortOptionUsingKeyboard(sortArrOptions[1]);
|
|
57
|
-
await expect(sort.sortDropDown).toHaveText(sortArrOptions[1]);
|
|
58
|
-
|
|
59
|
-
// Selecting the next sort using Space to open dropdown, the ArrowDown, then ENTER key
|
|
60
|
-
await sort.focusSortDropDown();
|
|
61
|
-
await sort.openSortDropdownUsingKeyboardEnter(false);
|
|
62
|
-
await sort.selectNextSortOptionUsingKeyboard(sortArrOptions[2]);
|
|
63
|
-
await expect(sort.sortDropDown).toHaveText(sortArrOptions[2]);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
if (useCase.value === 'search') {
|
|
68
|
-
test.describe('when loading options from the url', () => {
|
|
69
|
-
test('should reflect the options of url in the component', async ({
|
|
70
|
-
sort,
|
|
71
|
-
page,
|
|
72
|
-
}) => {
|
|
73
|
-
const {label: expectedSortName, value: expectedSortValue} =
|
|
74
|
-
sortLabelWithValue[2]; // Assuming 0 is the first sort option
|
|
75
|
-
|
|
76
|
-
const currentUrl = await page.url();
|
|
77
|
-
const urlHash = `#sortCriteria=${encodeURI(expectedSortValue!)}`;
|
|
78
|
-
|
|
79
|
-
await page.goto(`${currentUrl}/${urlHash}`);
|
|
80
|
-
await page.getByRole('button', {name: 'Try it now'}).click();
|
|
81
|
-
await expect(sort.sortDropDown).toContainText(expectedSortName);
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
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
|
-
const mockBuildInteractiveCitation = jest.fn(
|
|
11
|
-
(engine, {options}) => options.citation
|
|
12
|
-
);
|
|
13
|
-
const mockEngine = {};
|
|
14
|
-
|
|
15
|
-
// @ts-ignore
|
|
16
|
-
mockHeadlessLoader.initializeWithHeadless = (element, engineId, initialize) => {
|
|
17
|
-
if (element instanceof QuanticSourceCitations) {
|
|
18
|
-
if (!isInitialized) {
|
|
19
|
-
isInitialized = true;
|
|
20
|
-
initialize(mockEngine);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
// @ts-ignore
|
|
26
|
-
mockHeadlessLoader.getHeadlessBundle = () => {
|
|
27
|
-
return {
|
|
28
|
-
buildInteractiveCitation: mockBuildInteractiveCitation,
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const mockCitations = [
|
|
33
|
-
{
|
|
34
|
-
id: '1',
|
|
35
|
-
title: 'Example title 1',
|
|
36
|
-
uri: 'https://example.com/',
|
|
37
|
-
clickUri: 'https://example.com/',
|
|
38
|
-
permanentid: '1',
|
|
39
|
-
text: 'text 01',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: '2',
|
|
43
|
-
title: 'Example title 2',
|
|
44
|
-
uri: 'https://example.com/',
|
|
45
|
-
clickUri: 'https://example.com/',
|
|
46
|
-
permanentid: '2',
|
|
47
|
-
text: 'text 02',
|
|
48
|
-
},
|
|
49
|
-
];
|
|
50
|
-
const mockAnswerId = 'test-answer-id';
|
|
51
|
-
|
|
52
|
-
const defaultOptions = {
|
|
53
|
-
citations: mockCitations,
|
|
54
|
-
answerId: mockAnswerId,
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const selectors = {
|
|
58
|
-
citation: 'c-quantic-citation',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
function createTestComponent(options = defaultOptions) {
|
|
62
|
-
const element = createElement('c-quantic-source-citations', {
|
|
63
|
-
is: QuanticSourceCitations,
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
for (const [key, value] of Object.entries(options)) {
|
|
67
|
-
element[key] = value;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
document.body.appendChild(element);
|
|
71
|
-
return element;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Helper function to wait until the microtask queue is empty.
|
|
75
|
-
function flushPromises() {
|
|
76
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
describe('c-quantic-source-citations', () => {
|
|
80
|
-
function cleanup() {
|
|
81
|
-
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
82
|
-
while (document.body.firstChild) {
|
|
83
|
-
document.body.removeChild(document.body.firstChild);
|
|
84
|
-
}
|
|
85
|
-
isInitialized = false;
|
|
86
|
-
jest.clearAllMocks();
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
afterEach(() => {
|
|
90
|
-
cleanup();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
describe('when there are citations found', () => {
|
|
94
|
-
it('should properly display the citations', async () => {
|
|
95
|
-
const element = createTestComponent();
|
|
96
|
-
await flushPromises();
|
|
97
|
-
|
|
98
|
-
const citations = element.shadowRoot.querySelectorAll(selectors.citation);
|
|
99
|
-
expect(citations).not.toBeNull();
|
|
100
|
-
expect(citations.length).toEqual(mockCitations.length);
|
|
101
|
-
|
|
102
|
-
citations.forEach((citationElement, index) => {
|
|
103
|
-
expect(citationElement.citation).toEqual({
|
|
104
|
-
...mockCitations[index],
|
|
105
|
-
index: index + 1,
|
|
106
|
-
});
|
|
107
|
-
expect(citationElement.interactiveCitation).toEqual(
|
|
108
|
-
mockCitations[index]
|
|
109
|
-
);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('should call buildInteractiveCitation for each citation with the correct parameters', async () => {
|
|
114
|
-
createTestComponent();
|
|
115
|
-
await flushPromises();
|
|
116
|
-
|
|
117
|
-
expect(mockBuildInteractiveCitation).toHaveBeenCalledTimes(
|
|
118
|
-
mockCitations.length
|
|
119
|
-
);
|
|
120
|
-
mockCitations.forEach((citation) => {
|
|
121
|
-
expect(mockBuildInteractiveCitation).toHaveBeenCalledWith(mockEngine, {
|
|
122
|
-
options: {citation, answerId: mockAnswerId},
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('should pass the disableCitationAnchoring property to the citation component', async () => {
|
|
128
|
-
const element = createTestComponent();
|
|
129
|
-
await flushPromises();
|
|
130
|
-
|
|
131
|
-
const citations = element.shadowRoot.querySelectorAll(selectors.citation);
|
|
132
|
-
expect(citations).not.toBeNull();
|
|
133
|
-
expect(citations.length).toEqual(mockCitations.length);
|
|
134
|
-
|
|
135
|
-
citations.forEach((citationElement) => {
|
|
136
|
-
expect(citationElement.disableCitationAnchoring).toBe(false);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
describe('when there are no citations found', () => {
|
|
142
|
-
it('should not display citations', async () => {
|
|
143
|
-
const element = createTestComponent({
|
|
144
|
-
...defaultOptions,
|
|
145
|
-
citations: null,
|
|
146
|
-
});
|
|
147
|
-
await flushPromises();
|
|
148
|
-
|
|
149
|
-
const citations = element.shadowRoot.querySelector(
|
|
150
|
-
selectors.sourceCitation
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
expect(citations).toBeNull();
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
});
|
|
@@ -1,387 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
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, search}, use) => {
|
|
43
|
-
await search.mockSearchWithBaseResponse();
|
|
44
|
-
await page.goto(
|
|
45
|
-
urlHash
|
|
46
|
-
? `${standaloneSearchBoxUrl}#${urlHash}`
|
|
47
|
-
: standaloneSearchBoxUrl
|
|
48
|
-
);
|
|
49
|
-
await configuration.configure(options);
|
|
50
|
-
await use(new StandaloneSearchBoxObject(page));
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export {expect} from '@playwright/test';
|