@coveo/quantic 3.44.0 → 3.44.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/quanticNumberButton/quanticNumberButton.js +5 -1
- package/force-app/main/default/lwc/quanticPager/quanticPager.html +8 -5
- 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/package.json +37 -34
- 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,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Facet response builder for the facet manager example page
|
|
3
|
-
* (`exampleQuanticFacetManager.html`), which registers three facets:
|
|
4
|
-
* a `language` facet, a `date` timeframe facet, and an `objecttype` facet.
|
|
5
|
-
*/
|
|
6
|
-
const facetManagerData = [
|
|
7
|
-
{
|
|
8
|
-
facetId: 'language',
|
|
9
|
-
field: 'language',
|
|
10
|
-
moreValuesAvailable: false,
|
|
11
|
-
values: [{value: 'English', state: 'idle', numberOfResults: 100}],
|
|
12
|
-
indexScore: 0.3,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
facetId: 'date',
|
|
16
|
-
field: 'date',
|
|
17
|
-
moreValuesAvailable: false,
|
|
18
|
-
values: [
|
|
19
|
-
{
|
|
20
|
-
start: 'past-1-week',
|
|
21
|
-
end: 'now',
|
|
22
|
-
endInclusive: false,
|
|
23
|
-
state: 'idle',
|
|
24
|
-
numberOfResults: 10,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
start: 'past-1-month',
|
|
28
|
-
end: 'now',
|
|
29
|
-
endInclusive: false,
|
|
30
|
-
state: 'idle',
|
|
31
|
-
numberOfResults: 20,
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
start: 'past-6-month',
|
|
35
|
-
end: 'now',
|
|
36
|
-
endInclusive: false,
|
|
37
|
-
state: 'idle',
|
|
38
|
-
numberOfResults: 30,
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
start: 'past-1-year',
|
|
42
|
-
end: 'now',
|
|
43
|
-
endInclusive: false,
|
|
44
|
-
state: 'idle',
|
|
45
|
-
numberOfResults: 40,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
indexScore: 0.2,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
facetId: 'objecttype',
|
|
52
|
-
field: 'objecttype',
|
|
53
|
-
moreValuesAvailable: false,
|
|
54
|
-
values: [{value: 'People', state: 'idle', numberOfResults: 50}],
|
|
55
|
-
indexScore: 0.1,
|
|
56
|
-
},
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
export default facetManagerData;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import {FacetManagerObject} from './pageObject';
|
|
2
|
-
import {facetBase} from '../../../../../../playwright/fixtures/baseFacetFixture';
|
|
3
|
-
import {
|
|
4
|
-
searchRequestRegex,
|
|
5
|
-
insightSearchRequestRegex,
|
|
6
|
-
} from '../../../../../../playwright/utils/requests';
|
|
7
|
-
import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
|
|
8
|
-
import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
|
|
9
|
-
import {BaseFacetObject} from '../../../../../../playwright/page-object/baseFacetObject';
|
|
10
|
-
import facetManagerData from './data';
|
|
11
|
-
|
|
12
|
-
const pageUrl = 's/quantic-facet-manager';
|
|
13
|
-
|
|
14
|
-
interface FacetManagerOptions {}
|
|
15
|
-
|
|
16
|
-
type QuanticFacetManagerE2ESearchFixtures = {
|
|
17
|
-
facetManager: FacetManagerObject;
|
|
18
|
-
options: Partial<FacetManagerOptions>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type QuanticFacetManagerE2EInsightFixtures =
|
|
22
|
-
QuanticFacetManagerE2ESearchFixtures & {
|
|
23
|
-
insightSetup: InsightSetupObject;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const testSearch =
|
|
27
|
-
facetBase.extend<QuanticFacetManagerE2ESearchFixtures>({
|
|
28
|
-
options: {},
|
|
29
|
-
facetResponses: {responses: [facetManagerData]},
|
|
30
|
-
baseFacet: async ({page}, use) => {
|
|
31
|
-
await use(new BaseFacetObject(page, searchRequestRegex));
|
|
32
|
-
},
|
|
33
|
-
facetManager: async (
|
|
34
|
-
{page, options, configuration, baseFacet, facetResponses},
|
|
35
|
-
use
|
|
36
|
-
) => {
|
|
37
|
-
await baseFacet.mockSearchWithFacetResponseSequence(
|
|
38
|
-
facetResponses?.responses
|
|
39
|
-
);
|
|
40
|
-
await page.goto(pageUrl);
|
|
41
|
-
configuration.configure(options);
|
|
42
|
-
await baseFacet.waitForSearchResponse();
|
|
43
|
-
|
|
44
|
-
await use(new FacetManagerObject(page));
|
|
45
|
-
},
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const testInsight =
|
|
49
|
-
facetBase.extend<QuanticFacetManagerE2EInsightFixtures>({
|
|
50
|
-
options: {},
|
|
51
|
-
facetResponses: {responses: [facetManagerData]},
|
|
52
|
-
baseFacet: async ({page}, use) => {
|
|
53
|
-
await use(new BaseFacetObject(page, insightSearchRequestRegex));
|
|
54
|
-
},
|
|
55
|
-
insightSetup: async ({page}, use) => {
|
|
56
|
-
await use(new InsightSetupObject(page));
|
|
57
|
-
},
|
|
58
|
-
facetManager: async (
|
|
59
|
-
{page, options, baseFacet, configuration, insightSetup, facetResponses},
|
|
60
|
-
use
|
|
61
|
-
) => {
|
|
62
|
-
await baseFacet.mockSearchWithFacetResponseSequence(
|
|
63
|
-
facetResponses?.responses
|
|
64
|
-
);
|
|
65
|
-
await page.goto(pageUrl);
|
|
66
|
-
configuration.configure({...options, useCase: useCaseEnum.insight});
|
|
67
|
-
await insightSetup.waitForInsightInterfaceInitialization();
|
|
68
|
-
const searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
69
|
-
await baseFacet.performSearch();
|
|
70
|
-
await searchResponsePromise;
|
|
71
|
-
await use(new FacetManagerObject(page));
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
export {expect} from '@playwright/test';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type {Locator, Page} from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
export class FacetManagerObject {
|
|
4
|
-
constructor(public page: Page) {
|
|
5
|
-
this.page = page;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
get facetManager(): Locator {
|
|
9
|
-
return this.page.locator('c-quantic-facet-manager');
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
get facetManagerItems(): Locator {
|
|
13
|
-
return this.facetManager.getByTestId('facet-manager__item');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get itemTemplateSlot(): Locator {
|
|
17
|
-
return this.facetManager.locator('slot[name="itemTemplate"]');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getFacetManagerItemByIndex(index: number): Locator {
|
|
21
|
-
return this.facetManagerItems.nth(index);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {testSearch, testInsight, expect} from './fixture';
|
|
2
|
-
import {useCaseTestCases} from '../../../../../../playwright/utils/useCase';
|
|
3
|
-
|
|
4
|
-
const fixtures = {
|
|
5
|
-
search: testSearch,
|
|
6
|
-
insight: testInsight,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const exampleFacetsOrder = ['objecttype', 'date', 'language'];
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Filters out any facetId which contains a filter input "_input" because they are not displayed in the facet manager.
|
|
13
|
-
*/
|
|
14
|
-
function filterInputFacets(facets: any): string[] {
|
|
15
|
-
return facets
|
|
16
|
-
.map((facet: any) => facet.facetId)
|
|
17
|
-
.filter((id: string) => !/_input$/.test(id));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
useCaseTestCases.forEach((useCase) => {
|
|
21
|
-
let test = fixtures[useCase.value];
|
|
22
|
-
|
|
23
|
-
test.describe(`quantic facet manager ${useCase.label}`, () => {
|
|
24
|
-
test('should load facets in the same order as in the initial search response', async ({
|
|
25
|
-
facetManager,
|
|
26
|
-
baseFacet,
|
|
27
|
-
}) => {
|
|
28
|
-
const searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
29
|
-
await baseFacet.performSearch();
|
|
30
|
-
|
|
31
|
-
const searchResponse = await searchResponsePromise;
|
|
32
|
-
const {facets} = await searchResponse.json();
|
|
33
|
-
expect(facets).not.toBeNull();
|
|
34
|
-
|
|
35
|
-
const filteredIds = filterInputFacets(facets);
|
|
36
|
-
|
|
37
|
-
filteredIds.forEach(async (facetId: any, index: number) => {
|
|
38
|
-
const facetManagerItem = facetManager.getFacetManagerItemByIndex(index);
|
|
39
|
-
expect(await facetManagerItem.getAttribute('data-facet-id')).toEqual(
|
|
40
|
-
facetId
|
|
41
|
-
);
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test.describe('when the facets are reordered', () => {
|
|
46
|
-
test('should load facets in the reordered order', async ({
|
|
47
|
-
facetManager,
|
|
48
|
-
baseFacet,
|
|
49
|
-
}) => {
|
|
50
|
-
await baseFacet.mockSearchFacetOrder(exampleFacetsOrder);
|
|
51
|
-
const searchResponsePromise = baseFacet.waitForSearchResponse();
|
|
52
|
-
await baseFacet.performSearch();
|
|
53
|
-
|
|
54
|
-
const searchResponse = await searchResponsePromise;
|
|
55
|
-
const {facets} = await searchResponse.json();
|
|
56
|
-
expect(facets).not.toBeNull();
|
|
57
|
-
|
|
58
|
-
exampleFacetsOrder.forEach(async (facetId: string, index: number) => {
|
|
59
|
-
const facetManagerItem =
|
|
60
|
-
facetManager.getFacetManagerItemByIndex(index);
|
|
61
|
-
expect(await facetManagerItem.getAttribute('data-facet-id')).toEqual(
|
|
62
|
-
facetId
|
|
63
|
-
);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test.describe('when an itemTemplate slot is provided', () => {
|
|
69
|
-
test('should customize the element that wraps each facet according to the itemTemplate slot', async ({
|
|
70
|
-
facetManager,
|
|
71
|
-
}) => {
|
|
72
|
-
const expectedClass = 'slds-m-around_xx-large';
|
|
73
|
-
expect(facetManager.itemTemplateSlot).not.toBeNull();
|
|
74
|
-
|
|
75
|
-
const facetManagerItems = await facetManager.facetManagerItems.all();
|
|
76
|
-
facetManagerItems.forEach(async (item: any) => {
|
|
77
|
-
expect(await item.getAttribute('class')).toContain(expectedClass);
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
});
|
|
@@ -1,403 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jest/no-focused-tests */
|
|
2
|
-
// @ts-ignore
|
|
3
|
-
import {createElement} from 'lwc';
|
|
4
|
-
import QuanticFeedback from '../quanticFeedback';
|
|
5
|
-
|
|
6
|
-
const functionsMocks = {
|
|
7
|
-
exampleHandleLike: jest.fn(),
|
|
8
|
-
exampleHandleDislike: jest.fn(),
|
|
9
|
-
exampleHandleExplainWhy: jest.fn(),
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const exampleQuestion = 'Example question';
|
|
13
|
-
const exampleSuccessMessage = 'Example success Message';
|
|
14
|
-
const defaultLikeIconName = 'utility:success';
|
|
15
|
-
const defaultLikeLabel = 'yes';
|
|
16
|
-
const defaultDislikeIconName = 'utility:clear';
|
|
17
|
-
const defaultDislikeLabel = 'no';
|
|
18
|
-
const defaultSize = 'xx-small';
|
|
19
|
-
|
|
20
|
-
jest.mock(
|
|
21
|
-
'@salesforce/label/c.quantic_Yes',
|
|
22
|
-
() => ({default: defaultLikeLabel}),
|
|
23
|
-
{
|
|
24
|
-
virtual: true,
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
jest.mock(
|
|
28
|
-
'@salesforce/label/c.quantic_No',
|
|
29
|
-
() => ({default: defaultDislikeLabel}),
|
|
30
|
-
{
|
|
31
|
-
virtual: true,
|
|
32
|
-
}
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const selectors = {
|
|
36
|
-
feedbackQuestion: '.feedback__question',
|
|
37
|
-
likeButton: 'c-quantic-stateful-button[data-testid="feedback__like-button"]',
|
|
38
|
-
dislikeButton:
|
|
39
|
-
'c-quantic-stateful-button[data-testid="feedback__dislike-button"]',
|
|
40
|
-
successMessage: '.feedback__success-message',
|
|
41
|
-
explainWhyButton: '.feedback__explain-why',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const defaultOptions = {
|
|
45
|
-
state: 'neutral',
|
|
46
|
-
question: exampleQuestion,
|
|
47
|
-
hideExplainWhyButton: false,
|
|
48
|
-
successMessage: exampleSuccessMessage,
|
|
49
|
-
likeLabel: defaultLikeLabel,
|
|
50
|
-
dislikeLabel: defaultDislikeLabel,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
function setupEventListeners(element) {
|
|
54
|
-
element.addEventListener('quantic__like', functionsMocks.exampleHandleLike);
|
|
55
|
-
element.addEventListener(
|
|
56
|
-
'quantic__dislike',
|
|
57
|
-
functionsMocks.exampleHandleDislike
|
|
58
|
-
);
|
|
59
|
-
element.addEventListener(
|
|
60
|
-
'quantic__pressexplainwhy',
|
|
61
|
-
functionsMocks.exampleHandleExplainWhy
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function createTestComponent(options = defaultOptions) {
|
|
66
|
-
const element = createElement('c-quantic-feedback', {
|
|
67
|
-
is: QuanticFeedback,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
for (const [key, value] of Object.entries(options)) {
|
|
71
|
-
element[key] = value;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
document.body.appendChild(element);
|
|
75
|
-
return element;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Helper function to wait until the microtask queue is empty.
|
|
79
|
-
function flushPromises() {
|
|
80
|
-
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
81
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
describe('c-quantic-feedback', () => {
|
|
85
|
-
function cleanup() {
|
|
86
|
-
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
87
|
-
while (document.body.firstChild) {
|
|
88
|
-
document.body.removeChild(document.body.firstChild);
|
|
89
|
-
}
|
|
90
|
-
jest.clearAllMocks();
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
afterEach(() => {
|
|
94
|
-
cleanup();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('should properly display the feedback question', async () => {
|
|
98
|
-
const element = createTestComponent();
|
|
99
|
-
await flushPromises();
|
|
100
|
-
|
|
101
|
-
const question = element.shadowRoot.querySelector(
|
|
102
|
-
selectors.feedbackQuestion
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
expect(question).not.toBeNull();
|
|
106
|
-
expect(question.textContent).toBe(exampleQuestion);
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('should not render the feedback question when question is empty', async () => {
|
|
110
|
-
const element = createTestComponent({...defaultOptions, question: ''});
|
|
111
|
-
await flushPromises();
|
|
112
|
-
|
|
113
|
-
const question = element.shadowRoot.querySelector(
|
|
114
|
-
selectors.feedbackQuestion
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
expect(question).toBeNull();
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
describe('when the component is in a neutral state', () => {
|
|
121
|
-
it('should display the feedback buttons in a neutral state', async () => {
|
|
122
|
-
const element = createTestComponent();
|
|
123
|
-
await flushPromises();
|
|
124
|
-
|
|
125
|
-
const likeButton = element.shadowRoot.querySelector(selectors.likeButton);
|
|
126
|
-
const dislikeButton = element.shadowRoot.querySelector(
|
|
127
|
-
selectors.dislikeButton
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
expect(likeButton.iconName).toBe(defaultLikeIconName);
|
|
131
|
-
expect(likeButton.selected).toBe(false);
|
|
132
|
-
expect(likeButton.label).toBe(defaultLikeLabel);
|
|
133
|
-
expect(likeButton.tooltip).toBe(defaultLikeLabel);
|
|
134
|
-
expect(likeButton.iconSize).toBe(defaultSize);
|
|
135
|
-
expect(likeButton.withoutBorders).toBe(true);
|
|
136
|
-
|
|
137
|
-
expect(dislikeButton.iconName).toBe(defaultDislikeIconName);
|
|
138
|
-
expect(dislikeButton.selected).toBe(false);
|
|
139
|
-
expect(dislikeButton.label).toBe(defaultDislikeLabel);
|
|
140
|
-
expect(dislikeButton.tooltip).toBe(defaultDislikeLabel);
|
|
141
|
-
expect(dislikeButton.iconSize).toBe(defaultSize);
|
|
142
|
-
expect(dislikeButton.withoutBorders).toBe(true);
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it('should not display the success message', async () => {
|
|
146
|
-
const element = createTestComponent();
|
|
147
|
-
await flushPromises();
|
|
148
|
-
|
|
149
|
-
const successMessage = element.shadowRoot.querySelector(
|
|
150
|
-
selectors.successMessage
|
|
151
|
-
);
|
|
152
|
-
|
|
153
|
-
expect(successMessage).toBeNull();
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
describe('when the like button is clicked', () => {
|
|
157
|
-
it('should dispatch the quantic__like" event', async () => {
|
|
158
|
-
const element = createTestComponent();
|
|
159
|
-
setupEventListeners(element);
|
|
160
|
-
await flushPromises();
|
|
161
|
-
|
|
162
|
-
const likeButton = element.shadowRoot.querySelector(
|
|
163
|
-
selectors.likeButton
|
|
164
|
-
);
|
|
165
|
-
likeButton.dispatchEvent(new CustomEvent('quantic__select'));
|
|
166
|
-
|
|
167
|
-
expect(likeButton).not.toBeNull();
|
|
168
|
-
expect(functionsMocks.exampleHandleLike).toHaveBeenCalledTimes(1);
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
describe('when the dislike button is clicked', () => {
|
|
173
|
-
it('should dispatch the "quantic__dislike" event', async () => {
|
|
174
|
-
const element = createTestComponent();
|
|
175
|
-
setupEventListeners(element);
|
|
176
|
-
await flushPromises();
|
|
177
|
-
|
|
178
|
-
const dislikeButton = element.shadowRoot.querySelector(
|
|
179
|
-
selectors.dislikeButton
|
|
180
|
-
);
|
|
181
|
-
dislikeButton.dispatchEvent(new CustomEvent('quantic__select'));
|
|
182
|
-
|
|
183
|
-
expect(dislikeButton).not.toBeNull();
|
|
184
|
-
expect(functionsMocks.exampleHandleDislike).toHaveBeenCalledTimes(1);
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
describe('when custom properties are passed', () => {
|
|
189
|
-
const customLikeIconName = 'utility:like';
|
|
190
|
-
const customLikeLabel = 'like';
|
|
191
|
-
const customDislikeIconName = 'utility:dislike';
|
|
192
|
-
const customDislikeLabel = 'dislike';
|
|
193
|
-
const customSize = 'large';
|
|
194
|
-
|
|
195
|
-
it('should display the feedback buttons properly', async () => {
|
|
196
|
-
const element = createTestComponent({
|
|
197
|
-
...defaultOptions,
|
|
198
|
-
likeIconName: customLikeIconName,
|
|
199
|
-
likeLabel: customLikeLabel,
|
|
200
|
-
dislikeIconName: customDislikeIconName,
|
|
201
|
-
dislikeLabel: customDislikeLabel,
|
|
202
|
-
size: customSize,
|
|
203
|
-
});
|
|
204
|
-
await flushPromises();
|
|
205
|
-
|
|
206
|
-
const likeButton = element.shadowRoot.querySelector(
|
|
207
|
-
selectors.likeButton
|
|
208
|
-
);
|
|
209
|
-
const dislikeButton = element.shadowRoot.querySelector(
|
|
210
|
-
selectors.dislikeButton
|
|
211
|
-
);
|
|
212
|
-
|
|
213
|
-
expect(likeButton.iconName).toBe(customLikeIconName);
|
|
214
|
-
expect(likeButton.selected).toBe(false);
|
|
215
|
-
expect(likeButton.label).toBe(customLikeLabel);
|
|
216
|
-
expect(likeButton.tooltip).toBe(customLikeLabel);
|
|
217
|
-
expect(likeButton.iconSize).toBe(customSize);
|
|
218
|
-
expect(likeButton.withoutBorders).toBe(true);
|
|
219
|
-
|
|
220
|
-
expect(dislikeButton.iconName).toBe(customDislikeIconName);
|
|
221
|
-
expect(dislikeButton.selected).toBe(false);
|
|
222
|
-
expect(dislikeButton.label).toBe(customDislikeLabel);
|
|
223
|
-
expect(dislikeButton.tooltip).toBe(customDislikeLabel);
|
|
224
|
-
expect(dislikeButton.iconSize).toBe(customSize);
|
|
225
|
-
expect(dislikeButton.withoutBorders).toBe(true);
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
describe('when the property hideLabels is set to true', () => {
|
|
230
|
-
it('should display the feedback buttons properly', async () => {
|
|
231
|
-
const element = createTestComponent({
|
|
232
|
-
...defaultOptions,
|
|
233
|
-
hideLabels: true,
|
|
234
|
-
});
|
|
235
|
-
await flushPromises();
|
|
236
|
-
|
|
237
|
-
const likeButton = element.shadowRoot.querySelector(
|
|
238
|
-
selectors.likeButton
|
|
239
|
-
);
|
|
240
|
-
const dislikeButton = element.shadowRoot.querySelector(
|
|
241
|
-
selectors.dislikeButton
|
|
242
|
-
);
|
|
243
|
-
|
|
244
|
-
expect(likeButton.label).toBe('');
|
|
245
|
-
expect(likeButton.tooltip).toBe(defaultLikeLabel);
|
|
246
|
-
expect(dislikeButton.label).toBe('');
|
|
247
|
-
expect(dislikeButton.tooltip).toBe(defaultDislikeLabel);
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
|
|
252
|
-
describe('when the component is in a liked state', () => {
|
|
253
|
-
it('should display the feedback buttons in a liked state', async () => {
|
|
254
|
-
const element = createTestComponent({...defaultOptions, state: 'liked'});
|
|
255
|
-
await flushPromises();
|
|
256
|
-
|
|
257
|
-
const likeButton = element.shadowRoot.querySelector(selectors.likeButton);
|
|
258
|
-
const dislikeButton = element.shadowRoot.querySelector(
|
|
259
|
-
selectors.dislikeButton
|
|
260
|
-
);
|
|
261
|
-
|
|
262
|
-
expect(likeButton.selected).toBe(true);
|
|
263
|
-
expect(likeButton.selectedStateColor).toBe('#2e844a');
|
|
264
|
-
expect(dislikeButton.selected).toBe(false);
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
it('should display the success message', async () => {
|
|
268
|
-
const element = createTestComponent({...defaultOptions, state: 'liked'});
|
|
269
|
-
await flushPromises();
|
|
270
|
-
|
|
271
|
-
const successMessage = element.shadowRoot.querySelector(
|
|
272
|
-
selectors.successMessage
|
|
273
|
-
);
|
|
274
|
-
const explainWhyButton = element.shadowRoot.querySelector(
|
|
275
|
-
selectors.explainWhyButton
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
expect(successMessage).not.toBeNull();
|
|
279
|
-
expect(successMessage.textContent).toBe(exampleSuccessMessage);
|
|
280
|
-
expect(explainWhyButton).not.toBeNull();
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
describe('when the explain why button is clicked', () => {
|
|
284
|
-
it('should dispatch the "quantic__pressexplainwhy" event', async () => {
|
|
285
|
-
const element = createTestComponent({
|
|
286
|
-
...defaultOptions,
|
|
287
|
-
state: 'liked',
|
|
288
|
-
});
|
|
289
|
-
setupEventListeners(element);
|
|
290
|
-
await flushPromises();
|
|
291
|
-
|
|
292
|
-
const explainWhyButton = element.shadowRoot.querySelector(
|
|
293
|
-
selectors.explainWhyButton
|
|
294
|
-
);
|
|
295
|
-
explainWhyButton.click();
|
|
296
|
-
|
|
297
|
-
expect(explainWhyButton).not.toBeNull();
|
|
298
|
-
expect(functionsMocks.exampleHandleExplainWhy).toHaveBeenCalledTimes(1);
|
|
299
|
-
});
|
|
300
|
-
});
|
|
301
|
-
|
|
302
|
-
describe('when the hideExplainWhy property is set to true', () => {
|
|
303
|
-
it('should display the success message without the explain why button', async () => {
|
|
304
|
-
const element = createTestComponent({
|
|
305
|
-
...defaultOptions,
|
|
306
|
-
state: 'liked',
|
|
307
|
-
hideExplainWhyButton: true,
|
|
308
|
-
});
|
|
309
|
-
await flushPromises();
|
|
310
|
-
|
|
311
|
-
const successMessage = element.shadowRoot.querySelector(
|
|
312
|
-
selectors.successMessage
|
|
313
|
-
);
|
|
314
|
-
const explainWhyButton = element.shadowRoot.querySelector(
|
|
315
|
-
selectors.explainWhyButton
|
|
316
|
-
);
|
|
317
|
-
|
|
318
|
-
expect(successMessage).not.toBeNull();
|
|
319
|
-
expect(successMessage.textContent).toBe(exampleSuccessMessage);
|
|
320
|
-
expect(explainWhyButton).toBeNull();
|
|
321
|
-
});
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
|
|
325
|
-
describe('when the component is in a disliked state', () => {
|
|
326
|
-
it('should display the feedback buttons in a disliked state', async () => {
|
|
327
|
-
const element = createTestComponent({
|
|
328
|
-
...defaultOptions,
|
|
329
|
-
state: 'disliked',
|
|
330
|
-
});
|
|
331
|
-
await flushPromises();
|
|
332
|
-
|
|
333
|
-
const likeButton = element.shadowRoot.querySelector(selectors.likeButton);
|
|
334
|
-
const dislikeButton = element.shadowRoot.querySelector(
|
|
335
|
-
selectors.dislikeButton
|
|
336
|
-
);
|
|
337
|
-
|
|
338
|
-
expect(likeButton.selected).toBe(false);
|
|
339
|
-
expect(dislikeButton.selected).toBe(true);
|
|
340
|
-
expect(dislikeButton.selectedStateColor).toBe('#ea001e');
|
|
341
|
-
});
|
|
342
|
-
|
|
343
|
-
it('should display the success message', async () => {
|
|
344
|
-
const element = createTestComponent({
|
|
345
|
-
...defaultOptions,
|
|
346
|
-
state: 'disliked',
|
|
347
|
-
});
|
|
348
|
-
await flushPromises();
|
|
349
|
-
|
|
350
|
-
const successMessage = element.shadowRoot.querySelector(
|
|
351
|
-
selectors.successMessage
|
|
352
|
-
);
|
|
353
|
-
const explainWhyButton = element.shadowRoot.querySelector(
|
|
354
|
-
selectors.explainWhyButton
|
|
355
|
-
);
|
|
356
|
-
|
|
357
|
-
expect(successMessage).not.toBeNull();
|
|
358
|
-
expect(successMessage.textContent).toBe(exampleSuccessMessage);
|
|
359
|
-
expect(explainWhyButton).not.toBeNull();
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
describe('when the explain why button is clicked', () => {
|
|
363
|
-
it('should dispatch the "quantic__pressexplainwhy" event', async () => {
|
|
364
|
-
const element = createTestComponent({
|
|
365
|
-
...defaultOptions,
|
|
366
|
-
state: 'disliked',
|
|
367
|
-
});
|
|
368
|
-
setupEventListeners(element);
|
|
369
|
-
await flushPromises();
|
|
370
|
-
|
|
371
|
-
const explainWhyButton = element.shadowRoot.querySelector(
|
|
372
|
-
selectors.explainWhyButton
|
|
373
|
-
);
|
|
374
|
-
explainWhyButton.click();
|
|
375
|
-
|
|
376
|
-
expect(explainWhyButton).not.toBeNull();
|
|
377
|
-
expect(functionsMocks.exampleHandleExplainWhy).toHaveBeenCalledTimes(1);
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
describe('when the hideExplainWhy property is set to true', () => {
|
|
382
|
-
it('should display the success message without the explain why button', async () => {
|
|
383
|
-
const element = createTestComponent({
|
|
384
|
-
...defaultOptions,
|
|
385
|
-
state: 'disliked',
|
|
386
|
-
hideExplainWhyButton: true,
|
|
387
|
-
});
|
|
388
|
-
await flushPromises();
|
|
389
|
-
|
|
390
|
-
const successMessage = element.shadowRoot.querySelector(
|
|
391
|
-
selectors.successMessage
|
|
392
|
-
);
|
|
393
|
-
const explainWhyButton = element.shadowRoot.querySelector(
|
|
394
|
-
selectors.explainWhyButton
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
expect(successMessage).not.toBeNull();
|
|
398
|
-
expect(successMessage.textContent).toBe(exampleSuccessMessage);
|
|
399
|
-
expect(explainWhyButton).toBeNull();
|
|
400
|
-
});
|
|
401
|
-
});
|
|
402
|
-
});
|
|
403
|
-
});
|