@internetarchive/collection-browser 3.5.2-alpha-webdev8164.0 → 3.5.2-webdev-8162.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.
Files changed (45) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.prettierignore +1 -1
  7. package/LICENSE +661 -661
  8. package/README.md +83 -83
  9. package/dist/src/app-root.js +606 -606
  10. package/dist/src/app-root.js.map +1 -1
  11. package/dist/src/collection-facets/facets-template.js +23 -28
  12. package/dist/src/collection-facets/facets-template.js.map +1 -1
  13. package/dist/src/collection-facets/more-facets-content.d.ts +8 -34
  14. package/dist/src/collection-facets/more-facets-content.js +159 -358
  15. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  16. package/dist/src/tiles/grid/collection-tile.js +77 -77
  17. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  18. package/dist/src/tiles/grid/item-tile.js +137 -137
  19. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  20. package/dist/src/tiles/models.js.map +1 -1
  21. package/dist/src/tiles/tile-dispatcher.js +215 -215
  22. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  23. package/dist/test/collection-browser.test.js +1 -1
  24. package/dist/test/collection-browser.test.js.map +1 -1
  25. package/dist/test/collection-facets/more-facets-content.test.js +31 -137
  26. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  27. package/eslint.config.mjs +53 -53
  28. package/index.html +24 -24
  29. package/local.archive.org.cert +86 -86
  30. package/local.archive.org.key +27 -27
  31. package/package.json +121 -119
  32. package/renovate.json +6 -6
  33. package/src/app-root.ts +1140 -1140
  34. package/src/collection-facets/facets-template.ts +83 -88
  35. package/src/collection-facets/more-facets-content.ts +642 -856
  36. package/src/tiles/grid/collection-tile.ts +163 -163
  37. package/src/tiles/grid/item-tile.ts +340 -340
  38. package/src/tiles/models.ts +1 -1
  39. package/src/tiles/tile-dispatcher.ts +517 -517
  40. package/test/collection-browser.test.ts +1 -1
  41. package/test/collection-facets/more-facets-content.test.ts +231 -378
  42. package/tsconfig.json +25 -25
  43. package/web-dev-server.config.mjs +30 -30
  44. package/web-test-runner.config.mjs +52 -41
  45. package/.husky/pre-commit +0 -4
@@ -970,7 +970,7 @@ describe('Collection Browser', () => {
970
970
  </collection-browser>`,
971
971
  );
972
972
 
973
- expect(el.selectedSort).to.equal(SortField.default);
973
+ expect(el.selectedSort).to.equal(SortField.relevance);
974
974
 
975
975
  el.baseQuery = 'foo';
976
976
  await el.updateComplete;
@@ -1,378 +1,231 @@
1
- import { aTimeout, expect, fixture } from '@open-wc/testing';
2
- import { html } from 'lit';
3
- import type { MoreFacetsContent } from '../../src/collection-facets/more-facets-content';
4
- import '../../src/collection-facets/more-facets-content';
5
- import { MockSearchService } from '../mocks/mock-search-service';
6
- import { MockAnalyticsHandler } from '../mocks/mock-analytics-handler';
7
- import type { FacetsTemplate } from '../../src/collection-facets/facets-template';
8
- import type { SelectedFacets } from '../../src/models';
9
- import { Aggregation, type Bucket } from '@internetarchive/search-service';
10
-
11
- const selectedFacetsGroup = {
12
- title: 'Media Type',
13
- key: 'mediatype',
14
- buckets: [
15
- { displayText: 'audio', key: 'audio', count: 1001, state: 'none' },
16
- { displayText: 'movies', key: 'movies', count: 901, state: 'none' },
17
- { displayText: 'texts', key: 'texts', count: 2101, state: 'none' },
18
- { displayText: 'data', key: 'data', count: 230, state: 'none' },
19
- { displayText: 'web', key: 'web', count: 453, state: 'none' },
20
- ],
21
- };
22
-
23
- const yearSelectedFacets: SelectedFacets = {
24
- mediatype: {},
25
- lending: {},
26
- year: {
27
- '2000': { key: '2000', count: 5, state: 'selected' },
28
- },
29
- subject: {},
30
- collection: {},
31
- creator: {},
32
- language: {},
33
- };
34
-
35
- describe('More facets content', () => {
36
- it('should render more facets template', async () => {
37
- const el = await fixture<MoreFacetsContent>(
38
- html`<more-facets-content></more-facets-content>`,
39
- );
40
-
41
- el.facetsLoading = false;
42
- await el.updateComplete;
43
-
44
- expect(el.shadowRoot?.querySelector('.facets-content')).to.exist;
45
- });
46
-
47
- it('should render more facets loader template', async () => {
48
- const el = await fixture<MoreFacetsContent>(
49
- html`<more-facets-content></more-facets-content>`,
50
- );
51
-
52
- el.facetsLoading = true;
53
- await el.updateComplete;
54
-
55
- expect(el.shadowRoot?.querySelector('.facets-loader')).to.exist;
56
- });
57
-
58
- it('should NOT render pagination when facet count < 1000', async () => {
59
- const searchService = new MockSearchService();
60
-
61
- const el = await fixture<MoreFacetsContent>(
62
- html`<more-facets-content
63
- .searchService=${searchService}
64
- ></more-facets-content>`,
65
- );
66
-
67
- el.facetKey = 'year';
68
- el.query = 'more-facets'; // Produces a response with 45 aggregations (< 1000)
69
- await el.updateComplete;
70
- await aTimeout(50); // Give it a moment to perform the (mock) search query after the initial update
71
-
72
- // Verify pagination component is NOT present (horizontal scroll mode)
73
- expect(el.shadowRoot?.querySelector('more-facets-pagination')).to.not.exist;
74
-
75
- // Verify horizontal scroll mode CSS class is applied
76
- expect(
77
- el.shadowRoot?.querySelector('.facets-content.horizontal-scroll-mode'),
78
- ).to.exist;
79
-
80
- // Verify footer still exists with buttons
81
- expect(el.shadowRoot?.querySelector('.footer')).to.exist;
82
- expect(el.shadowRoot?.querySelector('.btn-cancel')).to.exist;
83
- expect(el.shadowRoot?.querySelector('.btn-submit')).to.exist;
84
- });
85
-
86
- it('query for more facets content using search service', async () => {
87
- const searchService = new MockSearchService();
88
-
89
- const el = await fixture<MoreFacetsContent>(
90
- html`<more-facets-content
91
- .searchService=${searchService}
92
- ></more-facets-content>`,
93
- );
94
-
95
- el.facetKey = 'collection';
96
- el.query = 'collection-aggregations';
97
- await el.updateComplete;
98
-
99
- expect(searchService.searchParams?.query).to.equal(
100
- 'collection-aggregations',
101
- );
102
- });
103
-
104
- it('queries for more facets using search service within a collection (no query)', async () => {
105
- const searchService = new MockSearchService();
106
-
107
- const el = await fixture<MoreFacetsContent>(
108
- html`<more-facets-content
109
- .searchService=${searchService}
110
- .pageSpecifierParams=${{
111
- pageType: 'collection_details',
112
- pageTarget: 'foobar',
113
- }}
114
- ></more-facets-content>`,
115
- );
116
-
117
- el.facetKey = 'subject';
118
- await el.updateComplete;
119
-
120
- expect(searchService.searchParams?.query).to.be.empty;
121
- expect(searchService.searchParams?.pageTarget).to.equal('foobar');
122
- });
123
-
124
- it('queries for more facets using search service within a collection (with query)', async () => {
125
- const searchService = new MockSearchService();
126
-
127
- const el = await fixture<MoreFacetsContent>(
128
- html`<more-facets-content
129
- .searchService=${searchService}
130
- .pageSpecifierParams=${{
131
- pageType: 'collection_details',
132
- pageTarget: 'foobar',
133
- }}
134
- ></more-facets-content>`,
135
- );
136
-
137
- el.facetKey = 'subject';
138
- el.query = 'title:hello';
139
- await el.updateComplete;
140
-
141
- expect(searchService.searchParams?.query).to.equal('title:hello');
142
- expect(searchService.searchParams?.pageTarget).to.equal('foobar');
143
- });
144
-
145
- it('filter raw selectedFacets object', async () => {
146
- const searchService = new MockSearchService();
147
-
148
- const el = await fixture<MoreFacetsContent>(
149
- html`<more-facets-content
150
- .searchService=${searchService}
151
- .selectedFacets=${selectedFacetsGroup}
152
- ></more-facets-content>`,
153
- );
154
-
155
- el.facetKey = 'collection';
156
- el.query = 'title:hello';
157
- await el.updateComplete;
158
-
159
- expect(searchService.searchParams?.query).to.equal('title:hello');
160
- });
161
-
162
- it('combines selectedFacets and aggregationFacets and renders on modal', async () => {
163
- const searchService = new MockSearchService();
164
-
165
- const el = await fixture<MoreFacetsContent>(
166
- html`<more-facets-content
167
- .facetKey=${'year'}
168
- .query=${'more-facets'}
169
- .searchService=${searchService}
170
- .selectedFacets=${yearSelectedFacets}
171
- ></more-facets-content>`,
172
- );
173
-
174
- const facetsTemplate = el.shadowRoot?.querySelector(
175
- 'facets-template',
176
- ) as FacetsTemplate;
177
- expect(facetsTemplate).to.exist;
178
-
179
- const { facetGroup } = facetsTemplate;
180
- expect(facetGroup?.key).to.equal('year');
181
- expect(facetGroup?.title).to.equal('Year');
182
-
183
- // First bucket is the one that was included in the selected facets
184
- const firstBucket = facetGroup?.buckets[0];
185
- expect(firstBucket?.key).to.equal('2000');
186
- expect(firstBucket?.count).to.equal(5);
187
-
188
- // Second bucket is the most recent year, since year facets default to descending order of year
189
- const secondBucket = facetGroup?.buckets[1];
190
- expect(secondBucket?.key).to.equal('2024');
191
- expect(secondBucket?.count).to.equal(5);
192
- });
193
-
194
- it('cancel button clicked event', async () => {
195
- const searchService = new MockSearchService();
196
- const mockAnalyticsHandler = new MockAnalyticsHandler();
197
-
198
- const el = await fixture<MoreFacetsContent>(
199
- html`<more-facets-content
200
- .facetKey=${'collection'}
201
- .query=${'collection-aggregations'}
202
- .searchService=${searchService}
203
- .analyticsHandler=${mockAnalyticsHandler}
204
- ></more-facets-content>`,
205
- );
206
-
207
- // select cancel button
208
- const cancelButton = el.shadowRoot?.querySelector(
209
- '.footer > .btn-cancel',
210
- ) as HTMLButtonElement;
211
- expect(cancelButton).to.exist;
212
- cancelButton?.click();
213
-
214
- expect(mockAnalyticsHandler.callCategory).to.equal('collection-browser');
215
- expect(mockAnalyticsHandler.callAction).to.equal('closeMoreFacetsModal');
216
- expect(mockAnalyticsHandler.callLabel).to.equal('collection');
217
- });
218
-
219
- it('facet apply button clicked event', async () => {
220
- const searchService = new MockSearchService();
221
- const mockAnalyticsHandler = new MockAnalyticsHandler();
222
-
223
- const el = await fixture<MoreFacetsContent>(
224
- html`<more-facets-content
225
- .facetKey=${'collection'}
226
- .query=${'collection-aggregations'}
227
- .searchService=${searchService}
228
- .analyticsHandler=${mockAnalyticsHandler}
229
- ></more-facets-content>`,
230
- );
231
-
232
- // select submit button
233
- const submitButton = el.shadowRoot?.querySelector(
234
- '.footer > .btn-submit',
235
- ) as HTMLButtonElement;
236
- expect(submitButton).to.exist;
237
- submitButton?.click();
238
-
239
- expect(mockAnalyticsHandler.callCategory).to.equal('collection-browser');
240
- expect(mockAnalyticsHandler.callAction).to.equal('applyMoreFacetsModal');
241
- expect(mockAnalyticsHandler.callLabel).to.equal('collection');
242
- });
243
-
244
- it('should have horizontal scrolling enabled', async () => {
245
- const searchService = new MockSearchService();
246
-
247
- const el = await fixture<MoreFacetsContent>(
248
- html`<more-facets-content
249
- .searchService=${searchService}
250
- ></more-facets-content>`,
251
- );
252
-
253
- el.facetKey = 'year';
254
- el.query = 'more-facets';
255
- await el.updateComplete;
256
- await aTimeout(50);
257
-
258
- const facetsContent = el.shadowRoot?.querySelector(
259
- '.facets-content',
260
- ) as HTMLElement;
261
- const styles = window.getComputedStyle(facetsContent);
262
-
263
- expect(styles.overflowX).to.equal('auto');
264
- expect(styles.overflowY).to.equal('hidden');
265
- });
266
-
267
- it('should have horizontal container wrapper', async () => {
268
- const searchService = new MockSearchService();
269
-
270
- const el = await fixture<MoreFacetsContent>(
271
- html`<more-facets-content
272
- .searchService=${searchService}
273
- ></more-facets-content>`,
274
- );
275
-
276
- el.facetKey = 'year';
277
- el.query = 'more-facets';
278
- await el.updateComplete;
279
- await aTimeout(50);
280
-
281
- const container = el.shadowRoot?.querySelector(
282
- '.facets-horizontal-container',
283
- );
284
- expect(container).to.exist;
285
-
286
- const facetsTemplate = container?.querySelector('facets-template');
287
- expect(facetsTemplate).to.exist;
288
- });
289
-
290
- it('should render pagination when facet count >= 1000', async () => {
291
- // Manually create aggregations with 1000+ facets
292
- const buckets: Bucket[] = [];
293
- for (let i = 0; i < 1000; i++) {
294
- buckets.push({ key: `value-${i}`, doc_count: i + 1 });
295
- }
296
-
297
- const el = await fixture<MoreFacetsContent>(
298
- html`<more-facets-content
299
- .facetKey=${'subject'}
300
- .selectedFacets=${{
301
- mediatype: {},
302
- lending: {},
303
- year: {},
304
- subject: {},
305
- collection: {},
306
- creator: {},
307
- language: {},
308
- }}
309
- ></more-facets-content>`,
310
- );
311
-
312
- // @ts-expect-error - accessing private property for testing
313
- el.aggregations = {
314
- subject: new Aggregation({ buckets }),
315
- };
316
- el.facetsLoading = false;
317
- await el.updateComplete;
318
-
319
- // Verify pagination component IS present
320
- expect(el.shadowRoot?.querySelector('more-facets-pagination')).to.exist;
321
-
322
- // Verify pagination mode CSS class is applied
323
- expect(el.shadowRoot?.querySelector('.facets-content.pagination-mode')).to
324
- .exist;
325
-
326
- // Verify horizontal container wrapper does NOT exist in pagination mode
327
- expect(el.shadowRoot?.querySelector('.facets-horizontal-container')).to.not
328
- .exist;
329
- });
330
-
331
- it('pagination page change should send analytics event', async () => {
332
- const mockAnalyticsHandler = new MockAnalyticsHandler();
333
-
334
- // Manually create aggregations with 1000+ facets
335
- const buckets: Bucket[] = [];
336
- for (let i = 0; i < 1000; i++) {
337
- buckets.push({ key: `value-${i}`, doc_count: i + 1 });
338
- }
339
-
340
- const el = await fixture<MoreFacetsContent>(
341
- html`<more-facets-content
342
- .facetKey=${'subject'}
343
- .selectedFacets=${{
344
- mediatype: {},
345
- lending: {},
346
- year: {},
347
- subject: {},
348
- collection: {},
349
- creator: {},
350
- language: {},
351
- }}
352
- .analyticsHandler=${mockAnalyticsHandler}
353
- ></more-facets-content>`,
354
- );
355
-
356
- // @ts-expect-error - accessing private property for testing
357
- el.aggregations = {
358
- subject: new Aggregation({ buckets }),
359
- };
360
- el.facetsLoading = false;
361
- await el.updateComplete;
362
-
363
- // Get the pagination component
364
- const pagination = el.shadowRoot?.querySelector(
365
- 'more-facets-pagination',
366
- ) as any;
367
- expect(pagination).to.exist;
368
-
369
- // Simulate clicking page 2
370
- pagination.currentPage = 2;
371
- await pagination.updateComplete;
372
-
373
- // Verify analytics event was sent
374
- expect(mockAnalyticsHandler.callCategory).to.equal('collection-browser');
375
- expect(mockAnalyticsHandler.callAction).to.equal('moreFacetsPageChange');
376
- expect(mockAnalyticsHandler.callLabel).to.equal('2');
377
- });
378
- });
1
+ import { aTimeout, expect, fixture } from '@open-wc/testing';
2
+ import { html } from 'lit';
3
+ import type { MoreFacetsContent } from '../../src/collection-facets/more-facets-content';
4
+ import '../../src/collection-facets/more-facets-content';
5
+ import { MockSearchService } from '../mocks/mock-search-service';
6
+ import { MockAnalyticsHandler } from '../mocks/mock-analytics-handler';
7
+ import type { FacetsTemplate } from '../../src/collection-facets/facets-template';
8
+ import type { SelectedFacets } from '../../src/models';
9
+
10
+ const selectedFacetsGroup = {
11
+ title: 'Media Type',
12
+ key: 'mediatype',
13
+ buckets: [
14
+ { displayText: 'audio', key: 'audio', count: 1001, state: 'none' },
15
+ { displayText: 'movies', key: 'movies', count: 901, state: 'none' },
16
+ { displayText: 'texts', key: 'texts', count: 2101, state: 'none' },
17
+ { displayText: 'data', key: 'data', count: 230, state: 'none' },
18
+ { displayText: 'web', key: 'web', count: 453, state: 'none' },
19
+ ],
20
+ };
21
+
22
+ const yearSelectedFacets: SelectedFacets = {
23
+ mediatype: {},
24
+ lending: {},
25
+ year: {
26
+ '2000': { key: '2000', count: 5, state: 'selected' },
27
+ },
28
+ subject: {},
29
+ collection: {},
30
+ creator: {},
31
+ language: {},
32
+ };
33
+
34
+ describe('More facets content', () => {
35
+ it('should render more facets template', async () => {
36
+ const el = await fixture<MoreFacetsContent>(
37
+ html`<more-facets-content></more-facets-content>`,
38
+ );
39
+
40
+ el.facetsLoading = false;
41
+ await el.updateComplete;
42
+
43
+ expect(el.shadowRoot?.querySelector('.facets-content')).to.exist;
44
+ });
45
+
46
+ it('should render more facets loader template', async () => {
47
+ const el = await fixture<MoreFacetsContent>(
48
+ html`<more-facets-content></more-facets-content>`,
49
+ );
50
+
51
+ el.facetsLoading = true;
52
+ await el.updateComplete;
53
+
54
+ expect(el.shadowRoot?.querySelector('.facets-loader')).to.exist;
55
+ });
56
+
57
+ it('should render pagination for more facets', async () => {
58
+ const searchService = new MockSearchService();
59
+
60
+ const el = await fixture<MoreFacetsContent>(
61
+ html`<more-facets-content
62
+ .searchService=${searchService}
63
+ ></more-facets-content>`,
64
+ );
65
+
66
+ el.facetKey = 'year';
67
+ el.query = 'more-facets'; // Produces a response with 40+ aggregations for multiple pages
68
+ await el.updateComplete;
69
+ await aTimeout(50); // Give it a moment to perform the (mock) search query after the initial update
70
+
71
+ expect(el.shadowRoot?.querySelectorAll('more-facets-pagination')).to.exist;
72
+ });
73
+
74
+ it('query for more facets content using search service', async () => {
75
+ const searchService = new MockSearchService();
76
+
77
+ const el = await fixture<MoreFacetsContent>(
78
+ html`<more-facets-content
79
+ .searchService=${searchService}
80
+ ></more-facets-content>`,
81
+ );
82
+
83
+ el.facetKey = 'collection';
84
+ el.query = 'collection-aggregations';
85
+ await el.updateComplete;
86
+
87
+ expect(searchService.searchParams?.query).to.equal(
88
+ 'collection-aggregations',
89
+ );
90
+ });
91
+
92
+ it('queries for more facets using search service within a collection (no query)', async () => {
93
+ const searchService = new MockSearchService();
94
+
95
+ const el = await fixture<MoreFacetsContent>(
96
+ html`<more-facets-content
97
+ .searchService=${searchService}
98
+ .pageSpecifierParams=${{
99
+ pageType: 'collection_details',
100
+ pageTarget: 'foobar',
101
+ }}
102
+ ></more-facets-content>`,
103
+ );
104
+
105
+ el.facetKey = 'subject';
106
+ await el.updateComplete;
107
+
108
+ expect(searchService.searchParams?.query).to.be.empty;
109
+ expect(searchService.searchParams?.pageTarget).to.equal('foobar');
110
+ });
111
+
112
+ it('queries for more facets using search service within a collection (with query)', async () => {
113
+ const searchService = new MockSearchService();
114
+
115
+ const el = await fixture<MoreFacetsContent>(
116
+ html`<more-facets-content
117
+ .searchService=${searchService}
118
+ .pageSpecifierParams=${{
119
+ pageType: 'collection_details',
120
+ pageTarget: 'foobar',
121
+ }}
122
+ ></more-facets-content>`,
123
+ );
124
+
125
+ el.facetKey = 'subject';
126
+ el.query = 'title:hello';
127
+ await el.updateComplete;
128
+
129
+ expect(searchService.searchParams?.query).to.equal('title:hello');
130
+ expect(searchService.searchParams?.pageTarget).to.equal('foobar');
131
+ });
132
+
133
+ it('filter raw selectedFacets object', async () => {
134
+ const searchService = new MockSearchService();
135
+
136
+ const el = await fixture<MoreFacetsContent>(
137
+ html`<more-facets-content
138
+ .searchService=${searchService}
139
+ .selectedFacets=${selectedFacetsGroup}
140
+ ></more-facets-content>`,
141
+ );
142
+
143
+ el.facetKey = 'collection';
144
+ el.query = 'title:hello';
145
+ await el.updateComplete;
146
+
147
+ expect(searchService.searchParams?.query).to.equal('title:hello');
148
+ });
149
+
150
+ it('combines selectedFacets and aggregationFacets and renders on modal', async () => {
151
+ const searchService = new MockSearchService();
152
+
153
+ const el = await fixture<MoreFacetsContent>(
154
+ html`<more-facets-content
155
+ .facetKey=${'year'}
156
+ .query=${'more-facets'}
157
+ .searchService=${searchService}
158
+ .selectedFacets=${yearSelectedFacets}
159
+ ></more-facets-content>`,
160
+ );
161
+
162
+ const facetsTemplate = el.shadowRoot?.querySelector(
163
+ 'facets-template',
164
+ ) as FacetsTemplate;
165
+ expect(facetsTemplate).to.exist;
166
+
167
+ const { facetGroup } = facetsTemplate;
168
+ expect(facetGroup?.key).to.equal('year');
169
+ expect(facetGroup?.title).to.equal('Year');
170
+
171
+ // First bucket is the one that was included in the selected facets
172
+ const firstBucket = facetGroup?.buckets[0];
173
+ expect(firstBucket?.key).to.equal('2000');
174
+ expect(firstBucket?.count).to.equal(5);
175
+
176
+ // Second bucket is the most recent year, since year facets default to descending order of year
177
+ const secondBucket = facetGroup?.buckets[1];
178
+ expect(secondBucket?.key).to.equal('2024');
179
+ expect(secondBucket?.count).to.equal(5);
180
+ });
181
+
182
+ it('cancel button clicked event', async () => {
183
+ const searchService = new MockSearchService();
184
+ const mockAnalyticsHandler = new MockAnalyticsHandler();
185
+
186
+ const el = await fixture<MoreFacetsContent>(
187
+ html`<more-facets-content
188
+ .facetKey=${'collection'}
189
+ .query=${'collection-aggregations'}
190
+ .searchService=${searchService}
191
+ .analyticsHandler=${mockAnalyticsHandler}
192
+ ></more-facets-content>`,
193
+ );
194
+
195
+ // select cancel button
196
+ const cancelButton = el.shadowRoot?.querySelector(
197
+ '.footer > .btn-cancel',
198
+ ) as HTMLButtonElement;
199
+ expect(cancelButton).to.exist;
200
+ cancelButton?.click();
201
+
202
+ expect(mockAnalyticsHandler.callCategory).to.equal('collection-browser');
203
+ expect(mockAnalyticsHandler.callAction).to.equal('closeMoreFacetsModal');
204
+ expect(mockAnalyticsHandler.callLabel).to.equal('collection');
205
+ });
206
+
207
+ it('facet apply button clicked event', async () => {
208
+ const searchService = new MockSearchService();
209
+ const mockAnalyticsHandler = new MockAnalyticsHandler();
210
+
211
+ const el = await fixture<MoreFacetsContent>(
212
+ html`<more-facets-content
213
+ .facetKey=${'collection'}
214
+ .query=${'collection-aggregations'}
215
+ .searchService=${searchService}
216
+ .analyticsHandler=${mockAnalyticsHandler}
217
+ ></more-facets-content>`,
218
+ );
219
+
220
+ // select submit button
221
+ const submitButton = el.shadowRoot?.querySelector(
222
+ '.footer > .btn-submit',
223
+ ) as HTMLButtonElement;
224
+ expect(submitButton).to.exist;
225
+ submitButton?.click();
226
+
227
+ expect(mockAnalyticsHandler.callCategory).to.equal('collection-browser');
228
+ expect(mockAnalyticsHandler.callAction).to.equal('applyMoreFacetsModal');
229
+ expect(mockAnalyticsHandler.callLabel).to.equal('collection');
230
+ });
231
+ });