@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,501 +0,0 @@
1
- /* eslint-disable no-import-assign */
2
- // @ts-ignore
3
- import {createElement} from 'lwc';
4
- import QuanticRefineModalContent from 'c/quanticRefineModalContent';
5
- import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
6
-
7
- jest.mock('c/quanticHeadlessLoader');
8
-
9
- /** @type {{disableDynamicNavigation: boolean}} */
10
- const defaultOptions = {
11
- disableDynamicNavigation: false,
12
- };
13
-
14
- function createTestComponent(options = defaultOptions) {
15
- const element = createElement('c-quantic-refine-modal-content', {
16
- is: QuanticRefineModalContent,
17
- });
18
- for (const [key, value] of Object.entries(options)) {
19
- element[key] = value;
20
- }
21
-
22
- document.body.appendChild(element);
23
- return element;
24
- }
25
-
26
- const selectors = {
27
- quanticFacet: 'c-quantic-facet',
28
- quanticCategoryFacet: 'c-quantic-category-facet',
29
- quanticFacetCaption: 'c-quantic-facet-caption',
30
- };
31
-
32
- const initialSearchStatusState = {
33
- hasError: false,
34
- };
35
- let searchStatusState = initialSearchStatusState;
36
-
37
- const initialBreadcrumbManagerState = {};
38
- let breadcrumbManagerState = initialBreadcrumbManagerState;
39
-
40
- const functionsMocks = {
41
- buildBreadcrumbManager: jest.fn(() => ({
42
- state: breadcrumbManagerState,
43
- subscribe: functionsMocks.breadcrumbManagerStateSubscriber,
44
- })),
45
- buildSearchStatus: jest.fn(() => ({
46
- state: searchStatusState,
47
- subscribe: functionsMocks.searchStatusStateSubscriber,
48
- })),
49
- breadcrumbManagerStateSubscriber: jest.fn((cb) => {
50
- cb();
51
- return functionsMocks.breadcrumbManagerStateUnsubscriber;
52
- }),
53
- searchStatusStateSubscriber: jest.fn((cb) => {
54
- cb();
55
- return functionsMocks.searchStatusStateUnsubscriber;
56
- }),
57
- breadcrumbManagerStateUnsubscriber: jest.fn(),
58
- searchStatusStateUnsubscriber: jest.fn(),
59
- retry: jest.fn(),
60
- };
61
-
62
- // Helper function to wait until the microtask queue is empty.
63
- function flushPromises() {
64
- // eslint-disable-next-line @lwc/lwc/no-async-operation
65
- return new Promise((resolve) => setTimeout(resolve, 0));
66
- }
67
-
68
- const exampleEngine = {
69
- id: 'dummy engine',
70
- };
71
- let isInitialized = false;
72
-
73
- function prepareHeadlessState() {
74
- // @ts-ignore
75
- mockHeadlessLoader.getHeadlessBundle = () => {
76
- return {
77
- buildBreadcrumbManager: functionsMocks.buildBreadcrumbManager,
78
- buildSearchStatus: functionsMocks.buildSearchStatus,
79
- };
80
- };
81
- }
82
-
83
- function prepareQuanticStore(facetData) {
84
- // @ts-ignore
85
- mockHeadlessLoader.getAllFacetsFromStore = () => {
86
- return facetData;
87
- };
88
- }
89
-
90
- function mockSuccessfulHeadlessInitialization() {
91
- // @ts-ignore
92
- mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
93
- if (element instanceof QuanticRefineModalContent && !isInitialized) {
94
- isInitialized = true;
95
- initialize(exampleEngine);
96
- }
97
- };
98
- }
99
-
100
- function cleanup() {
101
- // The jsdom instance is shared across test cases in a single file so reset the DOM
102
- while (document.body.firstChild) {
103
- document.body.removeChild(document.body.firstChild);
104
- }
105
- jest.clearAllMocks();
106
- isInitialized = false;
107
- }
108
-
109
- describe('c-quantic-refine-modal-content', () => {
110
- afterEach(() => {
111
- cleanup();
112
- });
113
-
114
- describe('when the dynamic navigation feature is enabled', () => {
115
- describe('standard facet', () => {
116
- const exampleFacetAttributes = {
117
- facetId: 'filetype',
118
- field: 'filetype',
119
- label: 'File Type',
120
- numberOfValues: '8',
121
- sortCriteria: 'occurrences',
122
- noSearch: 'true',
123
- displayValuesAs: 'link',
124
- noFilterFacetCount: 'false',
125
- injectionDepth: '1000',
126
- customSort: 'YouTubeVideo,PDF,HTML',
127
- dependsOn: '',
128
- };
129
-
130
- beforeEach(() => {
131
- mockSuccessfulHeadlessInitialization();
132
- prepareHeadlessState();
133
- prepareQuanticStore({
134
- filetype: {
135
- label: 'File Type',
136
- facetId: 'filetype',
137
- element: {
138
- localName: 'c-quantic-facet',
139
- ...exampleFacetAttributes,
140
- },
141
- },
142
- });
143
- });
144
-
145
- it('should display the quantic facet with its attributes and without custom captions', async () => {
146
- const element = createTestComponent();
147
- await flushPromises();
148
-
149
- const quanticFacet = element.shadowRoot.querySelector(
150
- selectors.quanticFacet
151
- );
152
- expect(quanticFacet).not.toBeNull();
153
-
154
- Object.entries(exampleFacetAttributes).forEach(([key, value]) => {
155
- expect(quanticFacet[key]).toBe(value);
156
- });
157
-
158
- const quanticFacetCaption = element.shadowRoot.querySelector(
159
- selectors.quanticFacetCaption
160
- );
161
- expect(quanticFacetCaption).toBeNull();
162
- });
163
-
164
- describe('when a standard facet is registered in the store with custom captions', () => {
165
- const exampleCaption = {
166
- value: 'YouTubeVideo',
167
- caption: 'YouTube Video',
168
- };
169
-
170
- beforeEach(() => {
171
- mockSuccessfulHeadlessInitialization();
172
- prepareHeadlessState();
173
- prepareQuanticStore({
174
- filetype: {
175
- label: 'File Type',
176
- facetId: 'filetype',
177
- element: {
178
- localName: 'c-quantic-facet',
179
- ...exampleFacetAttributes,
180
- },
181
- metadata: {
182
- customCaptions: [exampleCaption],
183
- },
184
- },
185
- });
186
- });
187
-
188
- it('should display the quantic facet with its custom captions and attributes', async () => {
189
- const element = createTestComponent();
190
- await flushPromises();
191
-
192
- const quanticFacet = element.shadowRoot.querySelector(
193
- selectors.quanticFacet
194
- );
195
- expect(quanticFacet).not.toBeNull();
196
-
197
- const quanticFacetCaption = element.shadowRoot.querySelector(
198
- selectors.quanticFacetCaption
199
- );
200
- expect(quanticFacetCaption).not.toBeNull();
201
- expect(quanticFacetCaption.value).toBe(exampleCaption.value);
202
- expect(quanticFacetCaption.caption).toBe(exampleCaption.caption);
203
- });
204
- });
205
- });
206
-
207
- describe('category facet', () => {
208
- const exampleCategoryFacetAttributes = {
209
- facetId: 'country',
210
- field: 'country',
211
- label: 'Country',
212
- basePath: 'North America',
213
- noFilterByBasePath: 'false',
214
- noFilterFacetCount: 'false',
215
- delimitingCharacter: '>',
216
- numberOfValues: '10',
217
- sortCriteria: 'alphanumeric',
218
- withSearch: 'true',
219
- dependsOn: '',
220
- };
221
-
222
- beforeEach(() => {
223
- mockSuccessfulHeadlessInitialization();
224
- prepareHeadlessState();
225
- prepareQuanticStore({
226
- country: {
227
- label: 'Country',
228
- facetId: 'country',
229
- element: {
230
- localName: 'c-quantic-category-facet',
231
- ...exampleCategoryFacetAttributes,
232
- },
233
- },
234
- });
235
- });
236
-
237
- it('should display the quantic category facet with its attributes and without custom captions', async () => {
238
- const element = createTestComponent();
239
- await flushPromises();
240
-
241
- const quanticCategoryFacet = element.shadowRoot.querySelector(
242
- selectors.quanticCategoryFacet
243
- );
244
- expect(quanticCategoryFacet).not.toBeNull();
245
-
246
- Object.entries(exampleCategoryFacetAttributes).forEach(
247
- ([key, value]) => {
248
- expect(quanticCategoryFacet[key]).toBe(value);
249
- }
250
- );
251
-
252
- const quanticFacetCaption = element.shadowRoot.querySelector(
253
- selectors.quanticFacetCaption
254
- );
255
- expect(quanticFacetCaption).toBeNull();
256
- });
257
-
258
- describe('when a category facet is registered in the store with custom captions', () => {
259
- const exampleCaption = {
260
- value: 'Ca',
261
- caption: 'Canada',
262
- };
263
-
264
- beforeEach(() => {
265
- mockSuccessfulHeadlessInitialization();
266
- prepareHeadlessState();
267
- prepareQuanticStore({
268
- country: {
269
- label: 'Country',
270
- facetId: 'country',
271
- element: {
272
- localName: 'c-quantic-category-facet',
273
- ...exampleCategoryFacetAttributes,
274
- },
275
- metadata: {
276
- customCaptions: [exampleCaption],
277
- },
278
- },
279
- });
280
- });
281
-
282
- it('should display the quantic category facet with its custom captions', async () => {
283
- const element = createTestComponent();
284
- await flushPromises();
285
-
286
- const quanticCategoryFacet = element.shadowRoot.querySelector(
287
- selectors.quanticCategoryFacet
288
- );
289
- expect(quanticCategoryFacet).not.toBeNull();
290
-
291
- const quanticFacetCaption = element.shadowRoot.querySelector(
292
- selectors.quanticFacetCaption
293
- );
294
- expect(quanticFacetCaption).not.toBeNull();
295
- expect(quanticFacetCaption.value).toBe(exampleCaption.value);
296
- expect(quanticFacetCaption.caption).toBe(exampleCaption.caption);
297
- });
298
- });
299
- });
300
- });
301
-
302
- describe('when the dynamic navigation feature is disabled', () => {
303
- describe('standard facet', () => {
304
- const exampleFacetAttributes = {
305
- facetId: 'filetype',
306
- field: 'filetype',
307
- label: 'File Type',
308
- numberOfValues: '8',
309
- sortCriteria: 'occurrences',
310
- noSearch: 'true',
311
- displayValuesAs: 'link',
312
- noFilterFacetCount: 'false',
313
- injectionDepth: '1000',
314
- customSort: 'YouTubeVideo,PDF,HTML',
315
- dependsOn: '',
316
- };
317
-
318
- beforeEach(() => {
319
- mockSuccessfulHeadlessInitialization();
320
- prepareHeadlessState();
321
- prepareQuanticStore({
322
- filetype: {
323
- label: 'File Type',
324
- facetId: 'filetype',
325
- element: {
326
- localName: 'c-quantic-facet',
327
- ...exampleFacetAttributes,
328
- },
329
- },
330
- });
331
- });
332
-
333
- it('should display the quantic facet with its attributes and without custom captions', async () => {
334
- const element = createTestComponent({
335
- ...defaultOptions,
336
- disableDynamicNavigation: true,
337
- });
338
- await flushPromises();
339
-
340
- const quanticFacet = element.shadowRoot.querySelector(
341
- selectors.quanticFacet
342
- );
343
- expect(quanticFacet).not.toBeNull();
344
-
345
- Object.entries(exampleFacetAttributes).forEach(([key, value]) => {
346
- expect(quanticFacet[key]).toBe(value);
347
- });
348
-
349
- const quanticFacetCaption = element.shadowRoot.querySelector(
350
- selectors.quanticFacetCaption
351
- );
352
- expect(quanticFacetCaption).toBeNull();
353
- });
354
-
355
- describe('when a standard facet is registered in the store with custom captions', () => {
356
- const exampleCaption = {
357
- value: 'YouTubeVideo',
358
- caption: 'YouTube Video',
359
- };
360
-
361
- beforeEach(() => {
362
- mockSuccessfulHeadlessInitialization();
363
- prepareHeadlessState();
364
- prepareQuanticStore({
365
- filetype: {
366
- label: 'File Type',
367
- facetId: 'filetype',
368
- element: {
369
- localName: 'c-quantic-facet',
370
- ...exampleFacetAttributes,
371
- },
372
- metadata: {
373
- customCaptions: [exampleCaption],
374
- },
375
- },
376
- });
377
- });
378
-
379
- it('should display the quantic facet with its custom captions and attributes', async () => {
380
- const element = createTestComponent({
381
- ...defaultOptions,
382
- disableDynamicNavigation: true,
383
- });
384
- await flushPromises();
385
-
386
- const quanticFacet = element.shadowRoot.querySelector(
387
- selectors.quanticFacet
388
- );
389
- expect(quanticFacet).not.toBeNull();
390
-
391
- const quanticFacetCaption = element.shadowRoot.querySelector(
392
- selectors.quanticFacetCaption
393
- );
394
- expect(quanticFacetCaption).not.toBeNull();
395
- expect(quanticFacetCaption.value).toBe(exampleCaption.value);
396
- expect(quanticFacetCaption.caption).toBe(exampleCaption.caption);
397
- });
398
- });
399
- });
400
-
401
- describe('category facet', () => {
402
- const exampleCategoryFacetAttributes = {
403
- facetId: 'country',
404
- field: 'country',
405
- label: 'Country',
406
- basePath: 'North America',
407
- noFilterByBasePath: 'false',
408
- noFilterFacetCount: 'false',
409
- delimitingCharacter: '>',
410
- numberOfValues: '10',
411
- sortCriteria: 'alphanumeric',
412
- withSearch: 'true',
413
- dependsOn: '',
414
- };
415
-
416
- beforeEach(() => {
417
- mockSuccessfulHeadlessInitialization();
418
- prepareHeadlessState();
419
- prepareQuanticStore({
420
- country: {
421
- label: 'Country',
422
- facetId: 'country',
423
- element: {
424
- localName: 'c-quantic-category-facet',
425
- ...exampleCategoryFacetAttributes,
426
- },
427
- },
428
- });
429
- });
430
-
431
- it('should display the quantic category facet with its attributes and without custom captions', async () => {
432
- const element = createTestComponent({
433
- ...defaultOptions,
434
- disableDynamicNavigation: true,
435
- });
436
- await flushPromises();
437
-
438
- const quanticCategoryFacet = element.shadowRoot.querySelector(
439
- selectors.quanticCategoryFacet
440
- );
441
- expect(quanticCategoryFacet).not.toBeNull();
442
-
443
- Object.entries(exampleCategoryFacetAttributes).forEach(
444
- ([key, value]) => {
445
- expect(quanticCategoryFacet[key]).toBe(value);
446
- }
447
- );
448
-
449
- const quanticFacetCaption = element.shadowRoot.querySelector(
450
- selectors.quanticFacetCaption
451
- );
452
- expect(quanticFacetCaption).toBeNull();
453
- });
454
-
455
- describe('when a category facet is registered in the store with custom captions', () => {
456
- const exampleCaption = {
457
- value: 'Ca',
458
- caption: 'Canada',
459
- };
460
-
461
- beforeEach(() => {
462
- mockSuccessfulHeadlessInitialization();
463
- prepareHeadlessState();
464
- prepareQuanticStore({
465
- country: {
466
- label: 'Country',
467
- facetId: 'country',
468
- element: {
469
- localName: 'c-quantic-category-facet',
470
- ...exampleCategoryFacetAttributes,
471
- },
472
- metadata: {
473
- customCaptions: [exampleCaption],
474
- },
475
- },
476
- });
477
- });
478
-
479
- it('should display the quantic category facet with its custom captions', async () => {
480
- const element = createTestComponent({
481
- ...defaultOptions,
482
- disableDynamicNavigation: true,
483
- });
484
- await flushPromises();
485
-
486
- const quanticCategoryFacet = element.shadowRoot.querySelector(
487
- selectors.quanticCategoryFacet
488
- );
489
- expect(quanticCategoryFacet).not.toBeNull();
490
-
491
- const quanticFacetCaption = element.shadowRoot.querySelector(
492
- selectors.quanticFacetCaption
493
- );
494
- expect(quanticFacetCaption).not.toBeNull();
495
- expect(quanticFacetCaption.value).toBe(exampleCaption.value);
496
- expect(quanticFacetCaption.caption).toBe(exampleCaption.caption);
497
- });
498
- });
499
- });
500
- });
501
- });