@coveo/quantic 3.33.0 → 3.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -15
- package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +106 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +752 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +76 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +282 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +167 -0
- package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +262 -0
- package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +819 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +23 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +51 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +152 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +269 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +1183 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +27 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +75 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +199 -0
- package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +371 -0
- package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +212 -0
- package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +688 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +24 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +68 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +27 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +145 -0
- package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +348 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +48 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +80 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +173 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +219 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +404 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +38 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +52 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +102 -0
- package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +1105 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +21 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +73 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +67 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +208 -0
- package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +28 -0
- package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +178 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +64 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +23 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +82 -0
- package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +392 -0
- package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +448 -0
- package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +298 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +323 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +70 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +81 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +69 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +1158 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +56 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +185 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +451 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +337 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +151 -0
- package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +71 -0
- package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +651 -0
- package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +194 -0
- package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +230 -0
- package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +205 -0
- package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +309 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +58 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +47 -0
- package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +953 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +28 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +71 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +59 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +164 -0
- package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +430 -0
- package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +65 -0
- package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +69 -0
- package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +106 -0
- package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +47 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +13 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +14 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +82 -0
- package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +273 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +448 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +42 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +93 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +516 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +42 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +61 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +48 -0
- package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +491 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +35 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +52 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +53 -0
- package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +747 -0
- package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +542 -0
- package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +262 -0
- package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +141 -0
- package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +340 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +300 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +46 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +49 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +40 -0
- package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +144 -0
- package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +120 -0
- package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +209 -0
- package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +261 -0
- package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +342 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +66 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +81 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +69 -0
- package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +235 -0
- package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +144 -0
- package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +324 -0
- package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +301 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +81 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +38 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +66 -0
- package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +90 -0
- package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +155 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +464 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +74 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +85 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +97 -0
- package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +487 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +84 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +45 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +159 -0
- package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +743 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +571 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +110 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +113 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +299 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +341 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +21 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +91 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +196 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +192 -0
- package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +126 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +290 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +329 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +31 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +93 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +160 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +127 -0
- package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +416 -0
- package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +61 -0
- package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +89 -0
- package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +91 -0
- package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +136 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +387 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +53 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +54 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +72 -0
- package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +222 -0
- package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +244 -0
- package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +333 -0
- package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +56 -0
- package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +68 -0
- package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +72 -0
- package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +331 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +61 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +80 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +171 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +1037 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +58 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +43 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +160 -0
- package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +107 -0
- package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +427 -0
- package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +269 -0
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +89 -0
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +511 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +229 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +71 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +39 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +84 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +92 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +71 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +223 -0
- package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +131 -0
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/case-assist-engine/case-assist-engine.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-engine/commerce-engine.d.ts +16 -16
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/common-reducers.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/insight-engine/insight-engine.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/recommendation-engine/recommendation-engine.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/store.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/headless-core-commerce-facet.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/headless-core-range-facet.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/actions-history/ipx-actions-history-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/advanced-search-queries/advanced-search-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/attached-results/attached-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-assist-configuration/case-assist-configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-context/case-context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-input/case-input-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/configuration/configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/did-you-mean/did-you-mean-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/commerce-facet-search-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-set/facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/field-suggestions-order/field-suggestions-order-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/manual-numeric-facet-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/instant-products/instant-products-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/parameters/parameters-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product/product-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query/query-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recent-queries/recent-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/sort/sort-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/triggers/triggers-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/debug-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/version-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/automatic-facet-set/automatic-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-order/facet-order-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/category/category-facet-search-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/generic/generic-facet-search-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/specific/specific-facet-search-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/insight-folding-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-actions.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-slice.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-configuration/insight-configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/legacy/insight-search-actions.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-results/instant-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/pagination/pagination-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/pipeline/pipeline-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-set/query-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/question-answering/question-answering-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-queries/recent-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-results/recent-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-actions.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +6 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-hub/search-hub-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/triggers/triggers-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +6 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/access-token-manager.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +4 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-ssr-controller-definitions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
- package/package.json +46 -44
|
@@ -0,0 +1,819 @@
|
|
|
1
|
+
/* eslint-disable no-import-assign */
|
|
2
|
+
// @ts-ignore
|
|
3
|
+
import QuanticCaseClassification from 'c/quanticCaseClassification';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import {createElement} from 'lwc';
|
|
6
|
+
import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
|
|
7
|
+
import {getPicklistValuesByRecordType} from 'lightning/uiObjectInfoApi';
|
|
8
|
+
|
|
9
|
+
jest.mock('c/quanticHeadlessLoader');
|
|
10
|
+
|
|
11
|
+
const exampleDefaultLabel = 'default label';
|
|
12
|
+
const incorrectSfFieldNameError = `The Salesforce field API name is not found.`;
|
|
13
|
+
const invalidMaxSuggestionsError =
|
|
14
|
+
'The maximum number of suggestions must be an integer greater than 0.';
|
|
15
|
+
const missingCoveoFieldNameError =
|
|
16
|
+
'The "coveoFieldName" property is required, please set its value.';
|
|
17
|
+
const exampleMoreTopicsLabel = 'example more topics label';
|
|
18
|
+
const exampleSelectOptionLabel = 'example select option label';
|
|
19
|
+
const exampleField = 'example field';
|
|
20
|
+
const exampleLabel = 'example label';
|
|
21
|
+
|
|
22
|
+
const exampleCaseClassificationSuggestions = [
|
|
23
|
+
{
|
|
24
|
+
id: '1',
|
|
25
|
+
value: 'classification 2',
|
|
26
|
+
confidence: 1,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: '2',
|
|
30
|
+
value: 'classification 3',
|
|
31
|
+
confidence: 1,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const exampleCaseClassificationAllOptions = [
|
|
36
|
+
{value: 'classification 1'},
|
|
37
|
+
{value: 'classification 2'},
|
|
38
|
+
{value: 'classification 3'},
|
|
39
|
+
{value: 'classification 4'},
|
|
40
|
+
];
|
|
41
|
+
|
|
42
|
+
jest.mock(
|
|
43
|
+
'@salesforce/label/c.quantic_CaseClassificationTitle',
|
|
44
|
+
() => ({default: exampleDefaultLabel}),
|
|
45
|
+
{
|
|
46
|
+
virtual: true,
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
jest.mock(
|
|
50
|
+
'@salesforce/label/c.quantic_InvalidMaxNumberOfSuggestions',
|
|
51
|
+
() => ({default: invalidMaxSuggestionsError}),
|
|
52
|
+
{
|
|
53
|
+
virtual: true,
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
jest.mock(
|
|
57
|
+
'@salesforce/label/c.quantic_InvalidMaxNumberOfSuggestions',
|
|
58
|
+
() => ({default: invalidMaxSuggestionsError}),
|
|
59
|
+
{
|
|
60
|
+
virtual: true,
|
|
61
|
+
}
|
|
62
|
+
);
|
|
63
|
+
jest.mock(
|
|
64
|
+
'@salesforce/label/c.quantic_PropertyIsRequired',
|
|
65
|
+
() => ({default: missingCoveoFieldNameError}),
|
|
66
|
+
{
|
|
67
|
+
virtual: true,
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
jest.mock(
|
|
71
|
+
'@salesforce/label/c.quantic_MoreTopics',
|
|
72
|
+
() => ({default: exampleMoreTopicsLabel}),
|
|
73
|
+
{
|
|
74
|
+
virtual: true,
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
jest.mock(
|
|
78
|
+
'@salesforce/label/c.quantic_SelectOption',
|
|
79
|
+
() => ({default: exampleSelectOptionLabel}),
|
|
80
|
+
{
|
|
81
|
+
virtual: true,
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
jest.mock(
|
|
85
|
+
'@salesforce/label/c.quantic_SalesforceFieldNotFound',
|
|
86
|
+
() => ({default: incorrectSfFieldNameError}),
|
|
87
|
+
{
|
|
88
|
+
virtual: true,
|
|
89
|
+
}
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
let isInitialized = false;
|
|
93
|
+
|
|
94
|
+
const initialCaseClassificationState = {
|
|
95
|
+
suggestions: exampleCaseClassificationSuggestions,
|
|
96
|
+
};
|
|
97
|
+
let caseClassificationState = initialCaseClassificationState;
|
|
98
|
+
|
|
99
|
+
const functionsMocks = {
|
|
100
|
+
buildCaseField: jest.fn(() => ({
|
|
101
|
+
state: caseClassificationState,
|
|
102
|
+
subscribe: functionsMocks.subscribe,
|
|
103
|
+
update: functionsMocks.update,
|
|
104
|
+
})),
|
|
105
|
+
subscribe: jest.fn((cb) => {
|
|
106
|
+
cb();
|
|
107
|
+
return functionsMocks.unsubscribe;
|
|
108
|
+
}),
|
|
109
|
+
unsubscribe: jest.fn(() => {}),
|
|
110
|
+
loadCaseAssistAnalyticsActions: jest.fn(() => ({
|
|
111
|
+
fetchCaseClassifications: functionsMocks.fetchCaseClassifications,
|
|
112
|
+
})),
|
|
113
|
+
loadCaseFieldActions: jest.fn(() => {}),
|
|
114
|
+
update: jest.fn(() => {}),
|
|
115
|
+
fetchCaseClassifications: jest.fn(() => {}),
|
|
116
|
+
dispatch: jest.fn(() => {}),
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const exampleEngine = {
|
|
120
|
+
id: 'exampleEngineId',
|
|
121
|
+
dispatch: functionsMocks.dispatch,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const defaultOptions = {
|
|
125
|
+
engineId: exampleEngine.id,
|
|
126
|
+
sfFieldApiName: exampleField,
|
|
127
|
+
coveoFieldName: exampleField,
|
|
128
|
+
maxSuggestions: 3,
|
|
129
|
+
label: exampleLabel,
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const selectors = {
|
|
133
|
+
initializationError: 'c-quantic-component-error',
|
|
134
|
+
loadingSpinner: 'lightning-spinner',
|
|
135
|
+
label: '[data-testid="case-classification-label"]',
|
|
136
|
+
caseClassificationSuggestion:
|
|
137
|
+
'[data-testid="case-classification-suggestion"]',
|
|
138
|
+
caseClassificationOption: '[data-testid="case-classification-option"]',
|
|
139
|
+
caseClassificationSuggestionInput:
|
|
140
|
+
'[data-testid="case-classification-suggestion"] input',
|
|
141
|
+
caseClassificationOptionInput:
|
|
142
|
+
'[data-testid="case-classification-option"] input',
|
|
143
|
+
showSelectInputButton: '[data-testid="show-select-input-button"]',
|
|
144
|
+
allOptionsSelectInput:
|
|
145
|
+
'[data-testid="case-classification-all-options-combobox"]',
|
|
146
|
+
classificationErrorMessage:
|
|
147
|
+
'[data-testid="case-classification-error-message"]',
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
function mockGetPicklistValuesByRecordTypeWire() {
|
|
151
|
+
// @ts-ignore
|
|
152
|
+
// eslint-disable-next-line @lwc/lwc/no-unexpected-wire-adapter-usages
|
|
153
|
+
getPicklistValuesByRecordType.emit({
|
|
154
|
+
picklistFieldValues: {
|
|
155
|
+
[exampleField]: {
|
|
156
|
+
values: exampleCaseClassificationAllOptions,
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function createTestComponent(options = defaultOptions) {
|
|
163
|
+
prepareHeadlessState();
|
|
164
|
+
|
|
165
|
+
const element = createElement('c-quantic-case-classification', {
|
|
166
|
+
is: QuanticCaseClassification,
|
|
167
|
+
});
|
|
168
|
+
for (const [key, value] of Object.entries(options)) {
|
|
169
|
+
element[key] = value;
|
|
170
|
+
}
|
|
171
|
+
document.body.appendChild(element);
|
|
172
|
+
return element;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function prepareHeadlessState() {
|
|
176
|
+
// @ts-ignore
|
|
177
|
+
global.CoveoHeadlessCaseAssist = {
|
|
178
|
+
buildCaseField: functionsMocks.buildCaseField,
|
|
179
|
+
loadCaseAssistAnalyticsActions:
|
|
180
|
+
functionsMocks.loadCaseAssistAnalyticsActions,
|
|
181
|
+
loadCaseFieldActions: functionsMocks.loadCaseFieldActions,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Helper function to wait until the microtask queue is empty.
|
|
186
|
+
function flushPromises() {
|
|
187
|
+
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
188
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function mockSuccessfulHeadlessInitialization() {
|
|
192
|
+
// @ts-ignore
|
|
193
|
+
mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
|
|
194
|
+
if (element instanceof QuanticCaseClassification && !isInitialized) {
|
|
195
|
+
isInitialized = true;
|
|
196
|
+
initialize(exampleEngine);
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function mockErroneousHeadlessInitialization() {
|
|
202
|
+
// @ts-ignore
|
|
203
|
+
mockHeadlessLoader.initializeWithHeadless = (element) => {
|
|
204
|
+
if (element instanceof QuanticCaseClassification) {
|
|
205
|
+
element.setInitializationError();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function cleanup() {
|
|
211
|
+
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
212
|
+
while (document.body.firstChild) {
|
|
213
|
+
document.body.removeChild(document.body.firstChild);
|
|
214
|
+
}
|
|
215
|
+
jest.clearAllMocks();
|
|
216
|
+
isInitialized = false;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
describe('c-quantic-case-classification', () => {
|
|
220
|
+
beforeEach(() => {
|
|
221
|
+
mockSuccessfulHeadlessInitialization();
|
|
222
|
+
caseClassificationState = initialCaseClassificationState;
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
afterEach(() => {
|
|
226
|
+
cleanup();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
describe('when an initialization error occurs', () => {
|
|
230
|
+
beforeEach(() => {
|
|
231
|
+
mockErroneousHeadlessInitialization();
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('should display the initialization error component', async () => {
|
|
235
|
+
const element = createTestComponent();
|
|
236
|
+
await flushPromises();
|
|
237
|
+
|
|
238
|
+
const initializationError = element.shadowRoot.querySelector(
|
|
239
|
+
selectors.initializationError
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
expect(initializationError).not.toBeNull();
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
describe('controller initialization', () => {
|
|
247
|
+
it('should build the case field controller with the proper parameters', async () => {
|
|
248
|
+
createTestComponent();
|
|
249
|
+
await flushPromises();
|
|
250
|
+
|
|
251
|
+
expect(functionsMocks.buildCaseField).toHaveBeenCalledTimes(1);
|
|
252
|
+
expect(functionsMocks.buildCaseField).toHaveBeenCalledWith(
|
|
253
|
+
exampleEngine,
|
|
254
|
+
{
|
|
255
|
+
options: {
|
|
256
|
+
field: exampleField,
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('should subscribe to the headless case field state changes', async () => {
|
|
263
|
+
createTestComponent();
|
|
264
|
+
await flushPromises();
|
|
265
|
+
|
|
266
|
+
expect(functionsMocks.subscribe).toHaveBeenCalledTimes(1);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
describe('the fetchOnInit property', () => {
|
|
270
|
+
it('should fetch case classifications when the fetchOnInit property is set to true', async () => {
|
|
271
|
+
createTestComponent({...defaultOptions, fetchOnInit: true});
|
|
272
|
+
await flushPromises();
|
|
273
|
+
|
|
274
|
+
expect(functionsMocks.fetchCaseClassifications).toHaveBeenCalledTimes(
|
|
275
|
+
1
|
|
276
|
+
);
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
it('should not fetch case classifications when the fetchOnInit property is set to false', async () => {
|
|
280
|
+
createTestComponent({...defaultOptions, fetchOnInit: false});
|
|
281
|
+
await flushPromises();
|
|
282
|
+
|
|
283
|
+
expect(functionsMocks.fetchCaseClassifications).toHaveBeenCalledTimes(
|
|
284
|
+
0
|
|
285
|
+
);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
describe('when the component is loading', () => {
|
|
291
|
+
beforeEach(() => {
|
|
292
|
+
caseClassificationState = {
|
|
293
|
+
...initialCaseClassificationState,
|
|
294
|
+
loading: true,
|
|
295
|
+
};
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('should display the loading spinner', async () => {
|
|
299
|
+
const element = createTestComponent();
|
|
300
|
+
await flushPromises();
|
|
301
|
+
|
|
302
|
+
const loadingSpinner = element.shadowRoot.querySelector(
|
|
303
|
+
selectors.loadingSpinner
|
|
304
|
+
);
|
|
305
|
+
const label = element.shadowRoot.querySelector(selectors.label);
|
|
306
|
+
|
|
307
|
+
expect(loadingSpinner).not.toBeNull();
|
|
308
|
+
expect(label).not.toBeNull();
|
|
309
|
+
expect(label.textContent).toBe(exampleLabel);
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
describe('property validation', () => {
|
|
314
|
+
describe('when the value of the property maxSuggestions is inferior to 0', () => {
|
|
315
|
+
it('should display the initialization error component', async () => {
|
|
316
|
+
const element = createTestComponent({
|
|
317
|
+
...defaultOptions,
|
|
318
|
+
maxSuggestions: -1,
|
|
319
|
+
});
|
|
320
|
+
await flushPromises();
|
|
321
|
+
|
|
322
|
+
const initializationError = element.shadowRoot.querySelector(
|
|
323
|
+
selectors.initializationError
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
expect(initializationError).not.toBeNull();
|
|
327
|
+
expect(initializationError.message).toBe(invalidMaxSuggestionsError);
|
|
328
|
+
});
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
describe('when the value of the property coveoFieldName is not defined', () => {
|
|
332
|
+
it('should display the initialization error component', async () => {
|
|
333
|
+
const element = createTestComponent({
|
|
334
|
+
...defaultOptions,
|
|
335
|
+
coveoFieldName: undefined,
|
|
336
|
+
});
|
|
337
|
+
await flushPromises();
|
|
338
|
+
|
|
339
|
+
const initializationError = element.shadowRoot.querySelector(
|
|
340
|
+
selectors.initializationError
|
|
341
|
+
);
|
|
342
|
+
|
|
343
|
+
expect(initializationError).not.toBeNull();
|
|
344
|
+
expect(initializationError.message).toBe(missingCoveoFieldNameError);
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
describe('when the value of the property sfFieldApiName does not exist on the case object', () => {
|
|
349
|
+
it('should display the initialization error component', async () => {
|
|
350
|
+
const exampleInvalidSfField = 'example invalid field';
|
|
351
|
+
const element = createTestComponent({
|
|
352
|
+
...defaultOptions,
|
|
353
|
+
sfFieldApiName: exampleInvalidSfField,
|
|
354
|
+
});
|
|
355
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
356
|
+
await flushPromises();
|
|
357
|
+
|
|
358
|
+
const initializationError = element.shadowRoot.querySelector(
|
|
359
|
+
selectors.initializationError
|
|
360
|
+
);
|
|
361
|
+
|
|
362
|
+
expect(initializationError).not.toBeNull();
|
|
363
|
+
expect(initializationError.message).toBe(incorrectSfFieldNameError);
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
describe('the behaviour of the case classifications inputs', () => {
|
|
369
|
+
describe('when the max suggestions value is inferior to the count of all the classification options', () => {
|
|
370
|
+
const exampleMaxSuggestions = 2;
|
|
371
|
+
|
|
372
|
+
describe('the case classification suggestions', () => {
|
|
373
|
+
it('should display the case classification suggestions as inline options', async () => {
|
|
374
|
+
const element = createTestComponent({
|
|
375
|
+
...defaultOptions,
|
|
376
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
377
|
+
});
|
|
378
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
379
|
+
|
|
380
|
+
await flushPromises();
|
|
381
|
+
|
|
382
|
+
const suggestions = element.shadowRoot.querySelectorAll(
|
|
383
|
+
selectors.caseClassificationSuggestion
|
|
384
|
+
);
|
|
385
|
+
|
|
386
|
+
expect(suggestions.length).toBe(exampleMaxSuggestions);
|
|
387
|
+
for (let index = 0; index < exampleMaxSuggestions; index++) {
|
|
388
|
+
expect(suggestions[index].textContent).toBe(
|
|
389
|
+
exampleCaseClassificationSuggestions[index].value
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
it('should automatically select the first case classification suggestion', async () => {
|
|
395
|
+
const element = createTestComponent({
|
|
396
|
+
...defaultOptions,
|
|
397
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
398
|
+
});
|
|
399
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
400
|
+
|
|
401
|
+
await flushPromises();
|
|
402
|
+
|
|
403
|
+
const suggestionInputs = element.shadowRoot.querySelectorAll(
|
|
404
|
+
selectors.caseClassificationSuggestionInput
|
|
405
|
+
);
|
|
406
|
+
|
|
407
|
+
expect(functionsMocks.update).toHaveBeenCalledTimes(1);
|
|
408
|
+
expect(functionsMocks.update).toHaveBeenCalledWith(
|
|
409
|
+
exampleCaseClassificationSuggestions[0].value,
|
|
410
|
+
{caseClassifications: false, documentSuggestions: false},
|
|
411
|
+
true
|
|
412
|
+
);
|
|
413
|
+
expect(suggestionInputs[0].checked).toBe(true);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
describe('when a case classification suggestion is clicked', () => {
|
|
417
|
+
it('should call the update method of the case field controller with the right parameter', async () => {
|
|
418
|
+
const automaticallySelectedSuggestionIndex = 0;
|
|
419
|
+
const exampleSelectedSuggestionIndex = 1;
|
|
420
|
+
const element = createTestComponent({
|
|
421
|
+
...defaultOptions,
|
|
422
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
423
|
+
});
|
|
424
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
425
|
+
|
|
426
|
+
await flushPromises();
|
|
427
|
+
|
|
428
|
+
expect(functionsMocks.update).toHaveBeenCalledTimes(1);
|
|
429
|
+
expect(functionsMocks.update).toHaveBeenCalledWith(
|
|
430
|
+
exampleCaseClassificationSuggestions[
|
|
431
|
+
automaticallySelectedSuggestionIndex
|
|
432
|
+
].value,
|
|
433
|
+
{caseClassifications: false, documentSuggestions: false},
|
|
434
|
+
true
|
|
435
|
+
);
|
|
436
|
+
|
|
437
|
+
const suggestionInputs = element.shadowRoot.querySelectorAll(
|
|
438
|
+
selectors.caseClassificationSuggestionInput
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
suggestionInputs[exampleSelectedSuggestionIndex].click();
|
|
442
|
+
await flushPromises();
|
|
443
|
+
|
|
444
|
+
expect(functionsMocks.update).toHaveBeenCalledTimes(2);
|
|
445
|
+
expect(functionsMocks.update).toHaveBeenCalledWith(
|
|
446
|
+
exampleCaseClassificationSuggestions[
|
|
447
|
+
exampleSelectedSuggestionIndex
|
|
448
|
+
].value,
|
|
449
|
+
{caseClassifications: false, documentSuggestions: false},
|
|
450
|
+
undefined
|
|
451
|
+
);
|
|
452
|
+
});
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
describe('the case classification all options', () => {
|
|
457
|
+
it('should display the show select input button', async () => {
|
|
458
|
+
const element = createTestComponent({
|
|
459
|
+
...defaultOptions,
|
|
460
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
461
|
+
});
|
|
462
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
463
|
+
|
|
464
|
+
await flushPromises();
|
|
465
|
+
|
|
466
|
+
const showSelectInputButton = element.shadowRoot.querySelector(
|
|
467
|
+
selectors.showSelectInputButton
|
|
468
|
+
);
|
|
469
|
+
|
|
470
|
+
expect(showSelectInputButton).not.toBeNull();
|
|
471
|
+
expect(showSelectInputButton.title).toBe(exampleMoreTopicsLabel);
|
|
472
|
+
expect(showSelectInputButton.label).toBe(exampleMoreTopicsLabel);
|
|
473
|
+
});
|
|
474
|
+
|
|
475
|
+
describe('when clicking the show select input button', () => {
|
|
476
|
+
it('should display the all options select input', async () => {
|
|
477
|
+
const element = createTestComponent({
|
|
478
|
+
...defaultOptions,
|
|
479
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
480
|
+
});
|
|
481
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
482
|
+
|
|
483
|
+
await flushPromises();
|
|
484
|
+
|
|
485
|
+
const showSelectInputButton = element.shadowRoot.querySelector(
|
|
486
|
+
selectors.showSelectInputButton
|
|
487
|
+
);
|
|
488
|
+
showSelectInputButton.click();
|
|
489
|
+
await flushPromises();
|
|
490
|
+
|
|
491
|
+
const allOptionsSelectInput = element.shadowRoot.querySelector(
|
|
492
|
+
selectors.allOptionsSelectInput
|
|
493
|
+
);
|
|
494
|
+
|
|
495
|
+
expect(allOptionsSelectInput).not.toBeNull();
|
|
496
|
+
expect(allOptionsSelectInput.options).toStrictEqual(
|
|
497
|
+
exampleCaseClassificationAllOptions
|
|
498
|
+
);
|
|
499
|
+
expect(allOptionsSelectInput.value).toBe(
|
|
500
|
+
exampleCaseClassificationSuggestions[0].value
|
|
501
|
+
);
|
|
502
|
+
expect(allOptionsSelectInput.placeholder).toBe(
|
|
503
|
+
exampleMoreTopicsLabel
|
|
504
|
+
);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it('should select an option correctly from the all options select input', async () => {
|
|
508
|
+
const exampleSelectedOptionIndex = 3;
|
|
509
|
+
|
|
510
|
+
const element = createTestComponent({
|
|
511
|
+
...defaultOptions,
|
|
512
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
513
|
+
});
|
|
514
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
515
|
+
|
|
516
|
+
await flushPromises();
|
|
517
|
+
|
|
518
|
+
const showSelectInputButton = element.shadowRoot.querySelector(
|
|
519
|
+
selectors.showSelectInputButton
|
|
520
|
+
);
|
|
521
|
+
showSelectInputButton.click();
|
|
522
|
+
await flushPromises();
|
|
523
|
+
|
|
524
|
+
const allOptionsSelectInput = element.shadowRoot.querySelector(
|
|
525
|
+
selectors.allOptionsSelectInput
|
|
526
|
+
);
|
|
527
|
+
|
|
528
|
+
expect(allOptionsSelectInput).not.toBeNull();
|
|
529
|
+
allOptionsSelectInput.value =
|
|
530
|
+
exampleCaseClassificationAllOptions[
|
|
531
|
+
exampleSelectedOptionIndex
|
|
532
|
+
].value;
|
|
533
|
+
allOptionsSelectInput.dispatchEvent(new CustomEvent('change'));
|
|
534
|
+
|
|
535
|
+
expect(functionsMocks.update).toHaveBeenCalledTimes(2);
|
|
536
|
+
expect(functionsMocks.update).toHaveBeenCalledWith(
|
|
537
|
+
exampleCaseClassificationAllOptions[exampleSelectedOptionIndex]
|
|
538
|
+
.value,
|
|
539
|
+
{caseClassifications: false, documentSuggestions: false},
|
|
540
|
+
undefined
|
|
541
|
+
);
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
describe('when the max suggestions value is superior to the count of all the classification options', () => {
|
|
548
|
+
const exampleMaxSuggestions = 6;
|
|
549
|
+
|
|
550
|
+
describe('the case classification suggestions', () => {
|
|
551
|
+
it('should display the case classification suggestions as inline options', async () => {
|
|
552
|
+
const element = createTestComponent({
|
|
553
|
+
...defaultOptions,
|
|
554
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
555
|
+
});
|
|
556
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
557
|
+
|
|
558
|
+
await flushPromises();
|
|
559
|
+
|
|
560
|
+
const suggestions = element.shadowRoot.querySelectorAll(
|
|
561
|
+
selectors.caseClassificationSuggestion
|
|
562
|
+
);
|
|
563
|
+
|
|
564
|
+
expect(suggestions.length).toBe(
|
|
565
|
+
exampleCaseClassificationSuggestions.length
|
|
566
|
+
);
|
|
567
|
+
|
|
568
|
+
exampleCaseClassificationSuggestions.forEach(
|
|
569
|
+
({value: expectedValue}, index) =>
|
|
570
|
+
expect(suggestions[index].textContent).toBe(expectedValue)
|
|
571
|
+
);
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
it('should automatically select the first case classification suggestion', async () => {
|
|
575
|
+
const element = createTestComponent({
|
|
576
|
+
...defaultOptions,
|
|
577
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
578
|
+
});
|
|
579
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
580
|
+
|
|
581
|
+
await flushPromises();
|
|
582
|
+
|
|
583
|
+
const suggestionInputs = element.shadowRoot.querySelectorAll(
|
|
584
|
+
selectors.caseClassificationSuggestionInput
|
|
585
|
+
);
|
|
586
|
+
|
|
587
|
+
expect(functionsMocks.update).toHaveBeenCalledTimes(1);
|
|
588
|
+
expect(functionsMocks.update).toHaveBeenCalledWith(
|
|
589
|
+
exampleCaseClassificationSuggestions[0].value,
|
|
590
|
+
{caseClassifications: false, documentSuggestions: false},
|
|
591
|
+
true
|
|
592
|
+
);
|
|
593
|
+
expect(suggestionInputs[0].checked).toBe(true);
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
|
|
597
|
+
describe('the case classification remaining options', () => {
|
|
598
|
+
const remainingOptions = exampleCaseClassificationAllOptions.filter(
|
|
599
|
+
(option) =>
|
|
600
|
+
!exampleCaseClassificationSuggestions.some(
|
|
601
|
+
(suggestion) => suggestion.value === option.value
|
|
602
|
+
)
|
|
603
|
+
);
|
|
604
|
+
|
|
605
|
+
beforeEach(() => {
|
|
606
|
+
caseClassificationState = {
|
|
607
|
+
...initialCaseClassificationState,
|
|
608
|
+
suggestions: exampleCaseClassificationSuggestions,
|
|
609
|
+
};
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
it('should not display the all options select input', async () => {
|
|
613
|
+
const element = createTestComponent({
|
|
614
|
+
...defaultOptions,
|
|
615
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
616
|
+
});
|
|
617
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
618
|
+
|
|
619
|
+
await flushPromises();
|
|
620
|
+
|
|
621
|
+
const showSelectInputButton = element.shadowRoot.querySelector(
|
|
622
|
+
selectors.showSelectInputButton
|
|
623
|
+
);
|
|
624
|
+
const allOptionsSelectInput = element.shadowRoot.querySelector(
|
|
625
|
+
selectors.allOptionsSelectInput
|
|
626
|
+
);
|
|
627
|
+
|
|
628
|
+
expect(showSelectInputButton).toBeNull();
|
|
629
|
+
expect(allOptionsSelectInput).toBeNull();
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
it('should display the case classification remaining options as inline options', async () => {
|
|
633
|
+
const element = createTestComponent({
|
|
634
|
+
...defaultOptions,
|
|
635
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
636
|
+
});
|
|
637
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
638
|
+
|
|
639
|
+
await flushPromises();
|
|
640
|
+
|
|
641
|
+
const options = element.shadowRoot.querySelectorAll(
|
|
642
|
+
selectors.caseClassificationOption
|
|
643
|
+
);
|
|
644
|
+
const expectedOptionsCount =
|
|
645
|
+
exampleCaseClassificationAllOptions.length -
|
|
646
|
+
exampleCaseClassificationSuggestions.length;
|
|
647
|
+
|
|
648
|
+
expect(options.length).toBe(expectedOptionsCount);
|
|
649
|
+
remainingOptions.forEach(({value: expectedValue}, index) =>
|
|
650
|
+
expect(options[index].textContent).toBe(expectedValue)
|
|
651
|
+
);
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
describe('when a case classification remaining options is clicked', () => {
|
|
655
|
+
it('should call the update method of the case field controller with the right parameter', async () => {
|
|
656
|
+
const automaticallySelectedSuggestionIndex = 0;
|
|
657
|
+
const exampleSelectedSuggestionIndex = 1;
|
|
658
|
+
const element = createTestComponent({
|
|
659
|
+
...defaultOptions,
|
|
660
|
+
maxSuggestions: exampleMaxSuggestions,
|
|
661
|
+
});
|
|
662
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
663
|
+
|
|
664
|
+
await flushPromises();
|
|
665
|
+
|
|
666
|
+
expect(functionsMocks.update).toHaveBeenCalledTimes(1);
|
|
667
|
+
expect(functionsMocks.update).toHaveBeenCalledWith(
|
|
668
|
+
exampleCaseClassificationSuggestions[
|
|
669
|
+
automaticallySelectedSuggestionIndex
|
|
670
|
+
].value,
|
|
671
|
+
{caseClassifications: false, documentSuggestions: false},
|
|
672
|
+
true
|
|
673
|
+
);
|
|
674
|
+
|
|
675
|
+
const optionInputs = element.shadowRoot.querySelectorAll(
|
|
676
|
+
selectors.caseClassificationOptionInput
|
|
677
|
+
);
|
|
678
|
+
|
|
679
|
+
optionInputs[exampleSelectedSuggestionIndex].click();
|
|
680
|
+
await flushPromises();
|
|
681
|
+
|
|
682
|
+
expect(functionsMocks.update).toHaveBeenCalledTimes(2);
|
|
683
|
+
expect(functionsMocks.update).toHaveBeenCalledWith(
|
|
684
|
+
remainingOptions[exampleSelectedSuggestionIndex].value,
|
|
685
|
+
{caseClassifications: false, documentSuggestions: false},
|
|
686
|
+
undefined
|
|
687
|
+
);
|
|
688
|
+
});
|
|
689
|
+
});
|
|
690
|
+
});
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
describe('when no case classification suggestions are found', () => {
|
|
694
|
+
beforeEach(() => {
|
|
695
|
+
caseClassificationState = {
|
|
696
|
+
...initialCaseClassificationState,
|
|
697
|
+
suggestions: [],
|
|
698
|
+
};
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
it('should not display any case classification suggestions, but still display the options select input', async () => {
|
|
702
|
+
const element = createTestComponent();
|
|
703
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
704
|
+
|
|
705
|
+
await flushPromises();
|
|
706
|
+
|
|
707
|
+
const suggestions = element.shadowRoot.querySelectorAll(
|
|
708
|
+
selectors.caseClassificationSuggestion
|
|
709
|
+
);
|
|
710
|
+
expect(suggestions.length).toBe(0);
|
|
711
|
+
|
|
712
|
+
const showSelectInputButton = element.shadowRoot.querySelector(
|
|
713
|
+
selectors.showSelectInputButton
|
|
714
|
+
);
|
|
715
|
+
expect(showSelectInputButton).toBeNull();
|
|
716
|
+
|
|
717
|
+
const allOptionsSelectInput = element.shadowRoot.querySelector(
|
|
718
|
+
selectors.allOptionsSelectInput
|
|
719
|
+
);
|
|
720
|
+
|
|
721
|
+
expect(allOptionsSelectInput).not.toBeNull();
|
|
722
|
+
expect(allOptionsSelectInput.options).toStrictEqual(
|
|
723
|
+
exampleCaseClassificationAllOptions
|
|
724
|
+
);
|
|
725
|
+
expect(allOptionsSelectInput.value).not.toBeDefined();
|
|
726
|
+
expect(allOptionsSelectInput.placeholder).toBe(exampleMoreTopicsLabel);
|
|
727
|
+
});
|
|
728
|
+
});
|
|
729
|
+
});
|
|
730
|
+
|
|
731
|
+
describe('the reportValidity public method', () => {
|
|
732
|
+
describe('when the property required is set to true', () => {
|
|
733
|
+
it('should display a validity error when reportValidity is called and no value is selected', async () => {
|
|
734
|
+
caseClassificationState = {
|
|
735
|
+
...initialCaseClassificationState,
|
|
736
|
+
suggestions: [],
|
|
737
|
+
};
|
|
738
|
+
const element = createTestComponent({
|
|
739
|
+
...defaultOptions,
|
|
740
|
+
required: true,
|
|
741
|
+
});
|
|
742
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
743
|
+
await flushPromises();
|
|
744
|
+
|
|
745
|
+
element.reportValidity();
|
|
746
|
+
await flushPromises();
|
|
747
|
+
|
|
748
|
+
const classificationErrorMessage = element.shadowRoot.querySelector(
|
|
749
|
+
selectors.classificationErrorMessage
|
|
750
|
+
);
|
|
751
|
+
|
|
752
|
+
expect(classificationErrorMessage).not.toBeNull();
|
|
753
|
+
expect(classificationErrorMessage.textContent).toBe(
|
|
754
|
+
exampleSelectOptionLabel
|
|
755
|
+
);
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
it('should not display a validity error when reportValidity is called and a value is selected', async () => {
|
|
759
|
+
const element = createTestComponent({
|
|
760
|
+
...defaultOptions,
|
|
761
|
+
required: true,
|
|
762
|
+
});
|
|
763
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
764
|
+
await flushPromises();
|
|
765
|
+
|
|
766
|
+
element.reportValidity();
|
|
767
|
+
await flushPromises();
|
|
768
|
+
|
|
769
|
+
const classificationErrorMessage = element.shadowRoot.querySelector(
|
|
770
|
+
selectors.classificationErrorMessage
|
|
771
|
+
);
|
|
772
|
+
|
|
773
|
+
expect(classificationErrorMessage).toBeNull();
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
describe('when the property required is set to false', () => {
|
|
778
|
+
it('should not display a validity error when reportValidity is called and no value is selected', async () => {
|
|
779
|
+
caseClassificationState = {
|
|
780
|
+
...initialCaseClassificationState,
|
|
781
|
+
suggestions: [],
|
|
782
|
+
};
|
|
783
|
+
const element = createTestComponent({
|
|
784
|
+
...defaultOptions,
|
|
785
|
+
required: false,
|
|
786
|
+
});
|
|
787
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
788
|
+
await flushPromises();
|
|
789
|
+
|
|
790
|
+
element.reportValidity();
|
|
791
|
+
await flushPromises();
|
|
792
|
+
|
|
793
|
+
const classificationErrorMessage = element.shadowRoot.querySelector(
|
|
794
|
+
selectors.classificationErrorMessage
|
|
795
|
+
);
|
|
796
|
+
|
|
797
|
+
expect(classificationErrorMessage).toBeNull();
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
it('should not display a validity error when reportValidity is called and a value is selected', async () => {
|
|
801
|
+
const element = createTestComponent({
|
|
802
|
+
...defaultOptions,
|
|
803
|
+
required: false,
|
|
804
|
+
});
|
|
805
|
+
mockGetPicklistValuesByRecordTypeWire();
|
|
806
|
+
await flushPromises();
|
|
807
|
+
|
|
808
|
+
element.reportValidity();
|
|
809
|
+
await flushPromises();
|
|
810
|
+
|
|
811
|
+
const classificationErrorMessage = element.shadowRoot.querySelector(
|
|
812
|
+
selectors.classificationErrorMessage
|
|
813
|
+
);
|
|
814
|
+
|
|
815
|
+
expect(classificationErrorMessage).toBeNull();
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
});
|
|
819
|
+
});
|