@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,62 +0,0 @@
|
|
|
1
|
-
const facetId = 'objecttype';
|
|
2
|
-
const field = 'objecttype';
|
|
3
|
-
const label = 'Object type';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Facet response before any value is selected.
|
|
7
|
-
*/
|
|
8
|
-
export const initialFacetData = {
|
|
9
|
-
facetId,
|
|
10
|
-
field,
|
|
11
|
-
moreValuesAvailable: true,
|
|
12
|
-
values: [
|
|
13
|
-
{
|
|
14
|
-
value: 'People',
|
|
15
|
-
state: 'idle',
|
|
16
|
-
numberOfResults: 126959,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
value: 'Contact',
|
|
20
|
-
state: 'idle',
|
|
21
|
-
numberOfResults: 179426,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
indexScore: 0.40500903971252294,
|
|
25
|
-
label,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const [people, contact] = initialFacetData.values;
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Facet response after clicking "Show more".
|
|
32
|
-
*/
|
|
33
|
-
export const expandedFacetData = {
|
|
34
|
-
...initialFacetData,
|
|
35
|
-
values: [
|
|
36
|
-
...initialFacetData.values,
|
|
37
|
-
{
|
|
38
|
-
value: 'Variant',
|
|
39
|
-
state: 'idle',
|
|
40
|
-
numberOfResults: 30827,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
value: 'Message',
|
|
44
|
-
state: 'idle',
|
|
45
|
-
numberOfResults: 26879,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Facet response after the first value is selected.
|
|
52
|
-
*/
|
|
53
|
-
export const selectedFacetData = {
|
|
54
|
-
...initialFacetData,
|
|
55
|
-
values: [
|
|
56
|
-
{
|
|
57
|
-
...people,
|
|
58
|
-
state: 'selected',
|
|
59
|
-
},
|
|
60
|
-
contact,
|
|
61
|
-
],
|
|
62
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import {FacetObject} from './pageObject';
|
|
2
|
-
import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
|
|
3
|
-
import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
|
|
4
|
-
import {
|
|
5
|
-
searchRequestRegex,
|
|
6
|
-
insightSearchRequestRegex,
|
|
7
|
-
} from '../../../../../../playwright/utils/requests';
|
|
8
|
-
import {BaseFacetObject} from '../../../../../../playwright/page-object/baseFacetObject';
|
|
9
|
-
import {initialFacetData} from './data';
|
|
10
|
-
import {facetBase} from '../../../../../../playwright/fixtures/baseFacetFixture';
|
|
11
|
-
|
|
12
|
-
const pageUrl = 's/quantic-facet';
|
|
13
|
-
|
|
14
|
-
interface FacetOptions {
|
|
15
|
-
value?: string;
|
|
16
|
-
caption?: string;
|
|
17
|
-
numberOfValues?: number;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
type QuanticFacetE2EFixtures = {
|
|
21
|
-
facet: FacetObject;
|
|
22
|
-
options: Partial<FacetOptions>;
|
|
23
|
-
insightSetup?: InsightSetupObject;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const testSearch = facetBase.extend<QuanticFacetE2EFixtures>({
|
|
27
|
-
options: {},
|
|
28
|
-
facetResponses: {responses: [[initialFacetData]]},
|
|
29
|
-
baseFacet: async ({page}, use) => {
|
|
30
|
-
await use(new BaseFacetObject(page, searchRequestRegex));
|
|
31
|
-
},
|
|
32
|
-
facet: async (
|
|
33
|
-
{page, options, configuration, baseFacet, urlHash, facetResponses},
|
|
34
|
-
use
|
|
35
|
-
) => {
|
|
36
|
-
// search use case: interface auto-triggers a search on load, hence the mockSearchWithBaseResponse call below
|
|
37
|
-
await baseFacet.mockSearchWithBaseResponse();
|
|
38
|
-
await page.goto(
|
|
39
|
-
`${pageUrl}${options.caption ? '-with-captions' : ''}#${urlHash ? urlHash : ''}`
|
|
40
|
-
);
|
|
41
|
-
await baseFacet.mockSearchWithFacetResponseSequence(
|
|
42
|
-
facetResponses?.responses
|
|
43
|
-
);
|
|
44
|
-
configuration.configure(options);
|
|
45
|
-
await baseFacet.waitForSearchResponse();
|
|
46
|
-
|
|
47
|
-
await use(new FacetObject(page));
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export const testInsight = facetBase.extend<QuanticFacetE2EFixtures>({
|
|
52
|
-
options: {},
|
|
53
|
-
facetResponses: {responses: [[initialFacetData]]},
|
|
54
|
-
baseFacet: async ({page}, use) => {
|
|
55
|
-
await use(new BaseFacetObject(page, insightSearchRequestRegex));
|
|
56
|
-
},
|
|
57
|
-
insightSetup: async ({page}, use) => {
|
|
58
|
-
await use(new InsightSetupObject(page));
|
|
59
|
-
},
|
|
60
|
-
facet: async (
|
|
61
|
-
{page, options, baseFacet, configuration, insightSetup, facetResponses},
|
|
62
|
-
use
|
|
63
|
-
) => {
|
|
64
|
-
await page.goto(`${pageUrl}${options.caption ? '-with-captions' : ''}`);
|
|
65
|
-
await baseFacet.mockSearchWithFacetResponseSequence(
|
|
66
|
-
facetResponses?.responses
|
|
67
|
-
);
|
|
68
|
-
configuration.configure({...options, useCase: useCaseEnum.insight});
|
|
69
|
-
await insightSetup?.waitForInsightInterfaceInitialization();
|
|
70
|
-
await Promise.all([
|
|
71
|
-
baseFacet.waitForSearchResponse(),
|
|
72
|
-
baseFacet.performSearch(),
|
|
73
|
-
]);
|
|
74
|
-
await use(new FacetObject(page));
|
|
75
|
-
},
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
export {expect} from '@playwright/test';
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type {Locator, Page} from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
export class FacetObject {
|
|
4
|
-
constructor(public page: Page) {
|
|
5
|
-
this.page = page;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get facet(): Locator {
|
|
9
|
-
return this.page.locator('c-quantic-facet');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get facetValue(): Locator {
|
|
13
|
-
return this.facet.getByTestId('facet__value');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get facetValueInput(): Locator {
|
|
17
|
-
return this.facet.getByRole('checkbox', {name: 'Facet value option'});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
get showMoreFacetValuesButton(): Locator {
|
|
21
|
-
return this.facet.getByRole('button', {
|
|
22
|
-
name: /Show more values for the .* facet/i,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get showLessFacetValuesButton(): Locator {
|
|
27
|
-
return this.facet.getByRole('button', {
|
|
28
|
-
name: /Show less values for the .* facet/i,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
get facetSearchBoxInput(): Locator {
|
|
33
|
-
return this.facet.getByTestId('facet__searchbox-input').locator('input');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get facetBreadcrumb(): Locator {
|
|
37
|
-
return this.page.getByTestId('facet-breadcrumb');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
get clearSelectionButton(): Locator {
|
|
41
|
-
return this.page.getByTestId('clear-selection-button');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
facetBreadcrumbValueByIndex(index: number): Locator {
|
|
45
|
-
return this.facetBreadcrumb.locator('c-quantic-pill').nth(index);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async clickOnFacetValue(index: number): Promise<void> {
|
|
49
|
-
await this.facetValue.nth(index).click();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async clickOnShowMoreFacetValuesButton(): Promise<void> {
|
|
53
|
-
await this.showMoreFacetValuesButton.click();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async clickOnShowLessFacetValuesButton(): Promise<void> {
|
|
57
|
-
await this.showLessFacetValuesButton.click();
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async fillFacetSearchBoxInput(query: string): Promise<void> {
|
|
61
|
-
await this.facetSearchBoxInput.fill(query);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async clickOnClearSelectionButton(): Promise<void> {
|
|
65
|
-
await this.clearSelectionButton.click();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
import {testSearch, testInsight, expect} from './fixture';
|
|
2
|
-
import {
|
|
3
|
-
useCaseEnum,
|
|
4
|
-
useCaseTestCases,
|
|
5
|
-
} from '../../../../../../playwright/utils/useCase';
|
|
6
|
-
import {initialFacetData, expandedFacetData, selectedFacetData} from './data';
|
|
7
|
-
|
|
8
|
-
const fixtures = {
|
|
9
|
-
search: testSearch,
|
|
10
|
-
insight: testInsight,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
useCaseTestCases.forEach((useCase) => {
|
|
14
|
-
let test = fixtures[useCase.value];
|
|
15
|
-
test.describe(`quantic facet ${useCase.label}`, () => {
|
|
16
|
-
test.describe('when selecting and deselecting a facet value', () => {
|
|
17
|
-
test.use({
|
|
18
|
-
facetResponses: {
|
|
19
|
-
responses: [
|
|
20
|
-
[initialFacetData],
|
|
21
|
-
[selectedFacetData],
|
|
22
|
-
[initialFacetData],
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('should trigger a new search and log the corresponding UA analytics events', async ({
|
|
28
|
-
baseFacet,
|
|
29
|
-
facet,
|
|
30
|
-
}) => {
|
|
31
|
-
const selectedIndex = 0;
|
|
32
|
-
const {facetId, field, values} = initialFacetData;
|
|
33
|
-
const facetSelectUaRequest = baseFacet.waitForFacetSelectUaAnalytics({
|
|
34
|
-
facetId,
|
|
35
|
-
facetField: field,
|
|
36
|
-
facetValue: values[selectedIndex].value,
|
|
37
|
-
});
|
|
38
|
-
let searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
39
|
-
|
|
40
|
-
await facet.clickOnFacetValue(selectedIndex);
|
|
41
|
-
|
|
42
|
-
await facetSelectUaRequest;
|
|
43
|
-
let searchResponse = await searchResponsePromise;
|
|
44
|
-
const {analytics: analyticsForFacetSelect} =
|
|
45
|
-
baseFacet.extractDataFromResponse(searchResponse);
|
|
46
|
-
expect(analyticsForFacetSelect.actionCause).toEqual('facetSelect');
|
|
47
|
-
|
|
48
|
-
const facetDeselectUaRequest =
|
|
49
|
-
baseFacet.waitForFacetDeselectUaAnalytics({
|
|
50
|
-
facetId,
|
|
51
|
-
facetField: field,
|
|
52
|
-
facetValue: values[selectedIndex].value,
|
|
53
|
-
});
|
|
54
|
-
searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
55
|
-
|
|
56
|
-
await facet.clickOnFacetValue(selectedIndex);
|
|
57
|
-
|
|
58
|
-
await facetDeselectUaRequest;
|
|
59
|
-
searchResponse = await searchResponsePromise;
|
|
60
|
-
const {analytics: analyticsForFacetDeselect} =
|
|
61
|
-
baseFacet.extractDataFromResponse(searchResponse);
|
|
62
|
-
expect(analyticsForFacetDeselect.actionCause).toEqual('facetDeselect');
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test.describe('when selecting a facet value and clicking the clear filter button', () => {
|
|
67
|
-
test.use({
|
|
68
|
-
facetResponses: {
|
|
69
|
-
responses: [
|
|
70
|
-
[initialFacetData],
|
|
71
|
-
[selectedFacetData],
|
|
72
|
-
[initialFacetData],
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
test('should trigger a new search and log the corresponding UA analytics events', async ({
|
|
78
|
-
baseFacet,
|
|
79
|
-
facet,
|
|
80
|
-
}) => {
|
|
81
|
-
const selectedIndex = 0;
|
|
82
|
-
const {facetId, field, values} = initialFacetData;
|
|
83
|
-
const facetSelectUaRequest = baseFacet.waitForFacetSelectUaAnalytics({
|
|
84
|
-
facetId,
|
|
85
|
-
facetField: field,
|
|
86
|
-
facetValue: values[selectedIndex].value,
|
|
87
|
-
});
|
|
88
|
-
let searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
89
|
-
|
|
90
|
-
await facet.clickOnFacetValue(selectedIndex);
|
|
91
|
-
|
|
92
|
-
await facetSelectUaRequest;
|
|
93
|
-
let searchResponse = await searchResponsePromise;
|
|
94
|
-
const {analytics: analyticsForFacetSelect} =
|
|
95
|
-
baseFacet.extractDataFromResponse(searchResponse);
|
|
96
|
-
expect(analyticsForFacetSelect.actionCause).toEqual('facetSelect');
|
|
97
|
-
|
|
98
|
-
const clearAllUaRequest = baseFacet.waitForFacetClearAllUaAnalytics({
|
|
99
|
-
facetId,
|
|
100
|
-
facetField: field,
|
|
101
|
-
});
|
|
102
|
-
searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
103
|
-
|
|
104
|
-
await facet.clickOnClearSelectionButton();
|
|
105
|
-
|
|
106
|
-
await clearAllUaRequest;
|
|
107
|
-
searchResponse = await searchResponsePromise;
|
|
108
|
-
const {analytics: analyticsForFacetDeselect} =
|
|
109
|
-
baseFacet.extractDataFromResponse(searchResponse);
|
|
110
|
-
expect(analyticsForFacetDeselect.actionCause).toEqual('facetClearAll');
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test.describe('when expanding and collapsing facet values using Show More/Less buttons', () => {
|
|
115
|
-
test.use({
|
|
116
|
-
facetResponses: {
|
|
117
|
-
responses: [[initialFacetData], [expandedFacetData], [initialFacetData]],
|
|
118
|
-
},
|
|
119
|
-
options: {
|
|
120
|
-
numberOfValues: 2,
|
|
121
|
-
},
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
test('should fetch additional facet values and send correct UA analytics', async ({
|
|
125
|
-
baseFacet,
|
|
126
|
-
facet,
|
|
127
|
-
}) => {
|
|
128
|
-
const {facetId, field} = initialFacetData;
|
|
129
|
-
const uaRequest = baseFacet.waitForShowMoreFacetResultsUaAnalytics({
|
|
130
|
-
facetId,
|
|
131
|
-
facetField: field,
|
|
132
|
-
});
|
|
133
|
-
let searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
134
|
-
|
|
135
|
-
await facet.clickOnShowMoreFacetValuesButton();
|
|
136
|
-
|
|
137
|
-
await uaRequest;
|
|
138
|
-
let searchResponse = await searchResponsePromise;
|
|
139
|
-
const {analytics: analyticsForShowMore} =
|
|
140
|
-
baseFacet.extractDataFromResponse(searchResponse);
|
|
141
|
-
expect(analyticsForShowMore.actionCause).toEqual(
|
|
142
|
-
'showMoreFacetResults'
|
|
143
|
-
);
|
|
144
|
-
|
|
145
|
-
const showLessUaRequest =
|
|
146
|
-
baseFacet.waitForShowLessFacetResultsUaAnalytics({
|
|
147
|
-
facetId,
|
|
148
|
-
facetField: field,
|
|
149
|
-
});
|
|
150
|
-
searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
151
|
-
|
|
152
|
-
await facet.clickOnShowLessFacetValuesButton();
|
|
153
|
-
|
|
154
|
-
await showLessUaRequest;
|
|
155
|
-
searchResponse = await searchResponsePromise;
|
|
156
|
-
const {analytics: analyticsForShowLess} =
|
|
157
|
-
baseFacet.extractDataFromResponse(searchResponse);
|
|
158
|
-
expect(analyticsForShowLess.actionCause).toEqual(
|
|
159
|
-
'showLessFacetResults'
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test.describe('when a custom caption is provided', () => {
|
|
165
|
-
const exampleCaption = 'example caption';
|
|
166
|
-
const facetValueIndex = 0;
|
|
167
|
-
|
|
168
|
-
test.use({
|
|
169
|
-
facetResponses: {
|
|
170
|
-
responses: [[initialFacetData], [selectedFacetData]],
|
|
171
|
-
},
|
|
172
|
-
options: {
|
|
173
|
-
caption: exampleCaption,
|
|
174
|
-
value: initialFacetData.values[facetValueIndex].value,
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
test('should display the custom caption instead of the raw facet value', async ({
|
|
178
|
-
baseFacet,
|
|
179
|
-
facet,
|
|
180
|
-
}) => {
|
|
181
|
-
expect(facet.facetValue.nth(facetValueIndex)).toHaveText(
|
|
182
|
-
new RegExp(exampleCaption)
|
|
183
|
-
);
|
|
184
|
-
const {facetId, field, values} = initialFacetData;
|
|
185
|
-
const uaRequest = baseFacet.waitForFacetSelectUaAnalytics({
|
|
186
|
-
facetId,
|
|
187
|
-
facetField: field,
|
|
188
|
-
facetValue: values[facetValueIndex].value,
|
|
189
|
-
});
|
|
190
|
-
const searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
191
|
-
|
|
192
|
-
await facet.clickOnFacetValue(facetValueIndex);
|
|
193
|
-
|
|
194
|
-
await uaRequest;
|
|
195
|
-
await searchResponsePromise;
|
|
196
|
-
expect(facet.facetBreadcrumbValueByIndex(facetValueIndex)).toHaveText(
|
|
197
|
-
exampleCaption
|
|
198
|
-
);
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
if (useCase.value === useCaseEnum.search) {
|
|
203
|
-
test.describe('when typing in the facet search box input', () => {
|
|
204
|
-
test('should fetch facet values according to the query typed', async ({
|
|
205
|
-
baseFacet,
|
|
206
|
-
facet,
|
|
207
|
-
}) => {
|
|
208
|
-
const {field: expectedField} = initialFacetData;
|
|
209
|
-
const exampleQuery = 'test';
|
|
210
|
-
const facetSearchResponsePromise =
|
|
211
|
-
baseFacet.waitForFacetSearchResponse();
|
|
212
|
-
|
|
213
|
-
await facet.fillFacetSearchBoxInput(exampleQuery);
|
|
214
|
-
|
|
215
|
-
const facetSearchResponse = await facetSearchResponsePromise;
|
|
216
|
-
const {field, query} =
|
|
217
|
-
baseFacet.extractDataFromResponse(facetSearchResponse);
|
|
218
|
-
expect(field).toEqual(expectedField);
|
|
219
|
-
expect(query).toContain(exampleQuery);
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
test.describe('with a selected value in the URL', () => {
|
|
224
|
-
const selectedIndex = 0;
|
|
225
|
-
const {field, values} = initialFacetData;
|
|
226
|
-
test.use({
|
|
227
|
-
urlHash: `f-${field}=${values[selectedIndex].value}`,
|
|
228
|
-
facetResponses: {
|
|
229
|
-
responses: [],
|
|
230
|
-
},
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
test('should select the correct facet value', async ({facet}) => {
|
|
234
|
-
await expect(facet.facetValueInput.nth(selectedIndex)).toBeChecked();
|
|
235
|
-
expect(facet.facetValue.nth(selectedIndex)).toHaveText(
|
|
236
|
-
new RegExp(values[selectedIndex].value)
|
|
237
|
-
);
|
|
238
|
-
});
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
});
|
|
242
|
-
});
|
package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
import {createElement} from 'lwc';
|
|
3
|
-
import QuanticFacetCaption from '../quanticFacetCaption';
|
|
4
|
-
|
|
5
|
-
function createTestComponent(options) {
|
|
6
|
-
const element = createElement('c-quantic-facet-caption', {
|
|
7
|
-
is: QuanticFacetCaption,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
for (const [key, value] of Object.entries(options)) {
|
|
11
|
-
element[key] = value;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
document.body.appendChild(element);
|
|
15
|
-
return element;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
describe('c-quantic-facet-caption', () => {
|
|
19
|
-
it('should expose captions through the `captions` property', () => {
|
|
20
|
-
const value = 'the-facet-value';
|
|
21
|
-
const caption = 'The custom caption';
|
|
22
|
-
const element = createTestComponent({value, caption});
|
|
23
|
-
|
|
24
|
-
const captions = element.captions;
|
|
25
|
-
|
|
26
|
-
expect(captions[value]).toBe(caption);
|
|
27
|
-
});
|
|
28
|
-
});
|
package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-import-assign */
|
|
2
|
-
import QuanticFacetManager from '../quanticFacetManager';
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import {createElement} from 'lwc';
|
|
5
|
-
import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
|
|
6
|
-
|
|
7
|
-
jest.mock('c/quanticHeadlessLoader');
|
|
8
|
-
|
|
9
|
-
let isInitialized = false;
|
|
10
|
-
|
|
11
|
-
const exampleEngine = {
|
|
12
|
-
id: 'exampleEngineId',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const defaultSearchStatusState = {
|
|
16
|
-
hasResults: true,
|
|
17
|
-
firstSearchExecuted: true,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
let searchStatusState = defaultSearchStatusState;
|
|
21
|
-
|
|
22
|
-
const defaultOptions = {
|
|
23
|
-
engineId: exampleEngine.id,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const selectors = {
|
|
27
|
-
initializationError: 'c-quantic-component-error',
|
|
28
|
-
facetManagerHost: '.facet-manager__host',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const functionsMocks = {
|
|
32
|
-
buildFacetManager: jest.fn(() => ({
|
|
33
|
-
state: {},
|
|
34
|
-
subscribe: functionsMocks.facetManagerStateSubscriber,
|
|
35
|
-
})),
|
|
36
|
-
buildSearchStatus: jest.fn(() => ({
|
|
37
|
-
state: searchStatusState,
|
|
38
|
-
subscribe: functionsMocks.searchStatusStateSubscriber,
|
|
39
|
-
})),
|
|
40
|
-
facetManagerStateSubscriber: jest.fn((cb) => {
|
|
41
|
-
cb();
|
|
42
|
-
return functionsMocks.facetManagerStateUnsubscriber;
|
|
43
|
-
}),
|
|
44
|
-
searchStatusStateSubscriber: jest.fn((cb) => {
|
|
45
|
-
cb();
|
|
46
|
-
return functionsMocks.searchStatusStateUnsubscriber;
|
|
47
|
-
}),
|
|
48
|
-
facetManagerStateUnsubscriber: jest.fn(),
|
|
49
|
-
searchStatusStateUnsubscriber: jest.fn(),
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
function createTestComponent(options = defaultOptions) {
|
|
53
|
-
const element = createElement('c-quantic-facet-manager', {
|
|
54
|
-
is: QuanticFacetManager,
|
|
55
|
-
});
|
|
56
|
-
for (const [key, value] of Object.entries(options)) {
|
|
57
|
-
element[key] = value;
|
|
58
|
-
}
|
|
59
|
-
document.body.appendChild(element);
|
|
60
|
-
return element;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Helper function to wait until the microtask queue is empty.
|
|
64
|
-
function flushPromises() {
|
|
65
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function prepareHeadlessState() {
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
mockHeadlessLoader.getHeadlessBundle = () => {
|
|
71
|
-
return {
|
|
72
|
-
buildFacetManager: functionsMocks.buildFacetManager,
|
|
73
|
-
buildSearchStatus: functionsMocks.buildSearchStatus,
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function mockSuccessfulHeadlessInitialization() {
|
|
79
|
-
// @ts-ignore
|
|
80
|
-
mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
|
|
81
|
-
if (element instanceof QuanticFacetManager && !isInitialized) {
|
|
82
|
-
isInitialized = true;
|
|
83
|
-
initialize(exampleEngine);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function mockErroneousHeadlessInitialization() {
|
|
89
|
-
// @ts-ignore
|
|
90
|
-
mockHeadlessLoader.initializeWithHeadless = (element) => {
|
|
91
|
-
if (element instanceof QuanticFacetManager) {
|
|
92
|
-
element.setInitializationError();
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function cleanup() {
|
|
98
|
-
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
99
|
-
while (document.body.firstChild) {
|
|
100
|
-
document.body.removeChild(document.body.firstChild);
|
|
101
|
-
}
|
|
102
|
-
jest.clearAllMocks();
|
|
103
|
-
isInitialized = false;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
describe('c-quantic-facet-manager', () => {
|
|
107
|
-
afterEach(() => {
|
|
108
|
-
cleanup();
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe('controller initialization', () => {
|
|
112
|
-
beforeEach(() => {
|
|
113
|
-
mockSuccessfulHeadlessInitialization();
|
|
114
|
-
prepareHeadlessState();
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('should build the facet manager controller with the proper parameters and subscribe to its state', async () => {
|
|
118
|
-
createTestComponent();
|
|
119
|
-
await flushPromises();
|
|
120
|
-
|
|
121
|
-
expect(functionsMocks.buildFacetManager).toHaveBeenCalledTimes(1);
|
|
122
|
-
expect(functionsMocks.buildFacetManager).toHaveBeenCalledWith(
|
|
123
|
-
exampleEngine
|
|
124
|
-
);
|
|
125
|
-
expect(functionsMocks.facetManagerStateSubscriber).toHaveBeenCalledTimes(
|
|
126
|
-
1
|
|
127
|
-
);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('should build the search status controller with the proper parameters and subscribe to its state', async () => {
|
|
131
|
-
createTestComponent();
|
|
132
|
-
await flushPromises();
|
|
133
|
-
|
|
134
|
-
expect(functionsMocks.buildSearchStatus).toHaveBeenCalledTimes(1);
|
|
135
|
-
expect(functionsMocks.buildSearchStatus).toHaveBeenCalledWith(
|
|
136
|
-
exampleEngine
|
|
137
|
-
);
|
|
138
|
-
expect(functionsMocks.searchStatusStateSubscriber).toHaveBeenCalledTimes(
|
|
139
|
-
1
|
|
140
|
-
);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
describe('when an initialization error occurs', () => {
|
|
145
|
-
beforeEach(() => {
|
|
146
|
-
mockErroneousHeadlessInitialization();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('should display the initialization error component', async () => {
|
|
150
|
-
const element = createTestComponent();
|
|
151
|
-
await flushPromises();
|
|
152
|
-
|
|
153
|
-
const initializationError = element.shadowRoot.querySelector(
|
|
154
|
-
selectors.initializationError
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
expect(initializationError).not.toBeNull();
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
describe('when the component is initialized', () => {
|
|
162
|
-
beforeEach(() => {
|
|
163
|
-
mockSuccessfulHeadlessInitialization();
|
|
164
|
-
prepareHeadlessState();
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('should properly render the facet manager component', async () => {
|
|
168
|
-
const element = createTestComponent();
|
|
169
|
-
await flushPromises();
|
|
170
|
-
|
|
171
|
-
const facetManager = element.shadowRoot.querySelector(
|
|
172
|
-
selectors.facetManagerHost
|
|
173
|
-
);
|
|
174
|
-
|
|
175
|
-
expect(facetManager).not.toBeNull();
|
|
176
|
-
});
|
|
177
|
-
});
|
|
178
|
-
});
|