@coveo/quantic 3.16.0 → 3.16.1-pre.1a6fc4649f

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.
Files changed (116) hide show
  1. package/docs/out/quantic-docs.json +2 -2
  2. package/force-app/main/default/lwc/quanticNumberButton/quanticNumberButton.html +1 -1
  3. package/force-app/main/default/lwc/quanticResultsPerPage/quanticResultsPerPage.js +27 -17
  4. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +6 -6
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/search-parameter-manager/headless-core-search-parameter-manager.d.ts +0 -1
  7. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
  8. package/force-app/main/default/staticresources/coveoheadless/definitions/features/parameter-manager/parameter-manager-selectors.d.ts +5 -0
  9. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-parameters/search-parameter-actions-loader.d.ts +36 -0
  10. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-parameters/search-parameter-actions.d.ts +6 -0
  11. package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
  12. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +9 -9
  13. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +5 -5
  14. package/package.json +6 -4
  15. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -604
  16. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -76
  17. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  18. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -167
  19. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  20. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  21. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  22. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  23. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  24. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  25. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -327
  26. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -269
  27. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  28. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -321
  29. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -199
  30. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -341
  31. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  32. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  33. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -63
  34. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  35. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  36. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -392
  37. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  38. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  39. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -814
  40. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  41. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -87
  42. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -283
  43. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -199
  44. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -151
  45. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  46. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  47. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -335
  48. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -343
  49. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -63
  50. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  51. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -101
  52. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  53. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  54. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  55. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  56. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -501
  57. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  58. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  59. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  60. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  61. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  62. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  63. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -261
  64. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  65. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  66. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  67. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -171
  68. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  69. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -404
  70. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -74
  71. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  72. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  73. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -168
  74. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -823
  75. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  76. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  77. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -91
  78. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  79. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  80. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  81. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  82. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  83. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  84. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -93
  85. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  86. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  87. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  88. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -61
  89. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -89
  90. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -91
  91. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -123
  92. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -186
  93. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  94. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -287
  95. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -62
  96. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -67
  97. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -77
  98. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  99. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -61
  100. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  101. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -173
  102. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -339
  103. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  104. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  105. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  106. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  107. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  108. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  109. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  110. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  111. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  112. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  113. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  114. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -71
  115. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -223
  116. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,178 +0,0 @@
1
- /* eslint-disable no-import-assign */
2
- import QuanticFacetManager from '../quanticFacetManager';
3
- // @ts-ignore
4
- import {createElement} from 'lwc';
5
- import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
6
-
7
- jest.mock('c/quanticHeadlessLoader');
8
-
9
- let isInitialized = false;
10
-
11
- const exampleEngine = {
12
- id: 'exampleEngineId',
13
- };
14
-
15
- const defaultSearchStatusState = {
16
- hasResults: true,
17
- firstSearchExecuted: true,
18
- };
19
-
20
- let searchStatusState = defaultSearchStatusState;
21
-
22
- const defaultOptions = {
23
- engineId: exampleEngine.id,
24
- };
25
-
26
- const selectors = {
27
- initializationError: 'c-quantic-component-error',
28
- facetManagerHost: '.facet-manager__host',
29
- };
30
-
31
- const functionsMocks = {
32
- buildFacetManager: jest.fn(() => ({
33
- state: {},
34
- subscribe: functionsMocks.facetManagerStateSubscriber,
35
- })),
36
- buildSearchStatus: jest.fn(() => ({
37
- state: searchStatusState,
38
- subscribe: functionsMocks.searchStatusStateSubscriber,
39
- })),
40
- facetManagerStateSubscriber: jest.fn((cb) => {
41
- cb();
42
- return functionsMocks.facetManagerStateUnsubscriber;
43
- }),
44
- searchStatusStateSubscriber: jest.fn((cb) => {
45
- cb();
46
- return functionsMocks.searchStatusStateUnsubscriber;
47
- }),
48
- facetManagerStateUnsubscriber: jest.fn(),
49
- searchStatusStateUnsubscriber: jest.fn(),
50
- };
51
-
52
- function createTestComponent(options = defaultOptions) {
53
- const element = createElement('c-quantic-facet-manager', {
54
- is: QuanticFacetManager,
55
- });
56
- for (const [key, value] of Object.entries(options)) {
57
- element[key] = value;
58
- }
59
- document.body.appendChild(element);
60
- return element;
61
- }
62
-
63
- // Helper function to wait until the microtask queue is empty.
64
- function flushPromises() {
65
- return new Promise((resolve) => setTimeout(resolve, 0));
66
- }
67
-
68
- function prepareHeadlessState() {
69
- // @ts-ignore
70
- mockHeadlessLoader.getHeadlessBundle = () => {
71
- return {
72
- buildFacetManager: functionsMocks.buildFacetManager,
73
- buildSearchStatus: functionsMocks.buildSearchStatus,
74
- };
75
- };
76
- }
77
-
78
- function mockSuccessfulHeadlessInitialization() {
79
- // @ts-ignore
80
- mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
81
- if (element instanceof QuanticFacetManager && !isInitialized) {
82
- isInitialized = true;
83
- initialize(exampleEngine);
84
- }
85
- };
86
- }
87
-
88
- function mockErroneousHeadlessInitialization() {
89
- // @ts-ignore
90
- mockHeadlessLoader.initializeWithHeadless = (element) => {
91
- if (element instanceof QuanticFacetManager) {
92
- element.setInitializationError();
93
- }
94
- };
95
- }
96
-
97
- function cleanup() {
98
- // The jsdom instance is shared across test cases in a single file so reset the DOM
99
- while (document.body.firstChild) {
100
- document.body.removeChild(document.body.firstChild);
101
- }
102
- jest.clearAllMocks();
103
- isInitialized = false;
104
- }
105
-
106
- describe('c-quantic-facet-manager', () => {
107
- afterEach(() => {
108
- cleanup();
109
- });
110
-
111
- describe('controller initialization', () => {
112
- beforeEach(() => {
113
- mockSuccessfulHeadlessInitialization();
114
- prepareHeadlessState();
115
- });
116
-
117
- it('should build the facet manager controller with the proper parameters and subscribe to its state', async () => {
118
- createTestComponent();
119
- await flushPromises();
120
-
121
- expect(functionsMocks.buildFacetManager).toHaveBeenCalledTimes(1);
122
- expect(functionsMocks.buildFacetManager).toHaveBeenCalledWith(
123
- exampleEngine
124
- );
125
- expect(functionsMocks.facetManagerStateSubscriber).toHaveBeenCalledTimes(
126
- 1
127
- );
128
- });
129
-
130
- it('should build the search status controller with the proper parameters and subscribe to its state', async () => {
131
- createTestComponent();
132
- await flushPromises();
133
-
134
- expect(functionsMocks.buildSearchStatus).toHaveBeenCalledTimes(1);
135
- expect(functionsMocks.buildSearchStatus).toHaveBeenCalledWith(
136
- exampleEngine
137
- );
138
- expect(functionsMocks.searchStatusStateSubscriber).toHaveBeenCalledTimes(
139
- 1
140
- );
141
- });
142
- });
143
-
144
- describe('when an initialization error occurs', () => {
145
- beforeEach(() => {
146
- mockErroneousHeadlessInitialization();
147
- });
148
-
149
- it('should display the initialization error component', async () => {
150
- const element = createTestComponent();
151
- await flushPromises();
152
-
153
- const initializationError = element.shadowRoot.querySelector(
154
- selectors.initializationError
155
- );
156
-
157
- expect(initializationError).not.toBeNull();
158
- });
159
- });
160
-
161
- describe('when the component is initialized', () => {
162
- beforeEach(() => {
163
- mockSuccessfulHeadlessInitialization();
164
- prepareHeadlessState();
165
- });
166
-
167
- it('should properly render the facet manager component', async () => {
168
- const element = createTestComponent();
169
- await flushPromises();
170
-
171
- const facetManager = element.shadowRoot.querySelector(
172
- selectors.facetManagerHost
173
- );
174
-
175
- expect(facetManager).not.toBeNull();
176
- });
177
- });
178
- });
@@ -1,63 +0,0 @@
1
- import {FacetManagerObject} from './pageObject';
2
- import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
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 {SearchObject} from '../../../../../../playwright/page-object/searchObject';
10
-
11
- const pageUrl = 's/quantic-facet-manager';
12
-
13
- interface FacetManagerOptions {}
14
-
15
- type QuanticFacetManagerE2ESearchFixtures = {
16
- facetManager: FacetManagerObject;
17
- search: SearchObject;
18
- options: Partial<FacetManagerOptions>;
19
- };
20
-
21
- type QuanticFacetManagerE2EInsightFixtures =
22
- QuanticFacetManagerE2ESearchFixtures & {
23
- insightSetup: InsightSetupObject;
24
- };
25
-
26
- export const testSearch =
27
- quanticBase.extend<QuanticFacetManagerE2ESearchFixtures>({
28
- options: {},
29
- search: async ({page}, use) => {
30
- await use(new SearchObject(page, searchRequestRegex));
31
- },
32
- facetManager: async ({page, options, configuration, search}, use) => {
33
- await page.goto(pageUrl);
34
- configuration.configure(options);
35
- await search.waitForSearchResponse();
36
-
37
- await use(new FacetManagerObject(page));
38
- },
39
- });
40
-
41
- export const testInsight =
42
- quanticBase.extend<QuanticFacetManagerE2EInsightFixtures>({
43
- options: {},
44
- search: async ({page}, use) => {
45
- await use(new SearchObject(page, insightSearchRequestRegex));
46
- },
47
- insightSetup: async ({page}, use) => {
48
- await use(new InsightSetupObject(page));
49
- },
50
- facetManager: async (
51
- {page, options, search, configuration, insightSetup},
52
- use
53
- ) => {
54
- await page.goto(pageUrl);
55
- configuration.configure({...options, useCase: useCaseEnum.insight});
56
- await insightSetup.waitForInsightInterfaceInitialization();
57
- await search.performSearch();
58
- await search.waitForSearchResponse();
59
- await use(new FacetManagerObject(page));
60
- },
61
- });
62
-
63
- 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
- search,
27
- }) => {
28
- const searchResponsePromise = search.waitForSearchResponse();
29
- await search.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
- search,
49
- }) => {
50
- await search.mockSearchFacetOrder(exampleFacetsOrder);
51
- const searchResponsePromise = search.waitForSearchResponse();
52
- await search.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
- });