@internetarchive/collection-browser 4.1.0 → 4.1.1-alpha-webdev8185.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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/collection-browser.d.ts +9 -18
- package/dist/src/collection-browser.js +779 -838
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +2 -3
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +5 -3
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/models.d.ts +27 -2
- package/dist/src/models.js +36 -0
- package/dist/src/models.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +2 -2
- package/dist/src/sort-filter-bar/sort-filter-bar.js +280 -280
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/test/collection-browser.test.js +204 -206
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +22 -22
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/index.ts +5 -0
- package/package.json +1 -1
- package/src/collection-browser.ts +3001 -3070
- package/src/data-source/collection-browser-data-source.ts +1443 -1444
- package/src/data-source/collection-browser-query-state.ts +69 -60
- package/src/models.ts +53 -4
- package/src/sort-filter-bar/sort-filter-bar.ts +732 -733
- package/test/collection-browser.test.ts +2400 -2402
- package/test/sort-filter-bar/sort-filter-bar.test.ts +443 -443
- package/.claude/settings.local.json +0 -8
|
@@ -71,7 +71,7 @@ describe('Collection Browser', () => {
|
|
|
71
71
|
});
|
|
72
72
|
it('filterBy creator with analytics', async () => {
|
|
73
73
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
74
|
-
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
74
|
+
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
75
75
|
</collection-browser>`);
|
|
76
76
|
el.searchContext = 'betaSearchService';
|
|
77
77
|
el.selectedSort = 'creator';
|
|
@@ -90,7 +90,7 @@ describe('Collection Browser', () => {
|
|
|
90
90
|
});
|
|
91
91
|
it('filterBy title with analytics', async () => {
|
|
92
92
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
93
|
-
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
93
|
+
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
94
94
|
</collection-browser>`);
|
|
95
95
|
el.searchContext = 'beta-search-service';
|
|
96
96
|
el.selectedSort = 'title';
|
|
@@ -119,7 +119,7 @@ describe('Collection Browser', () => {
|
|
|
119
119
|
collection: {},
|
|
120
120
|
year: {},
|
|
121
121
|
};
|
|
122
|
-
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
122
|
+
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
123
123
|
</collection-browser>`);
|
|
124
124
|
el.searchContext = 'search-service';
|
|
125
125
|
el.selectedFacets = mockedSelectedFacets;
|
|
@@ -166,7 +166,7 @@ describe('Collection Browser', () => {
|
|
|
166
166
|
collection: {},
|
|
167
167
|
year: {},
|
|
168
168
|
};
|
|
169
|
-
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
169
|
+
const el = await fixture(html `<collection-browser .analyticsHandler=${mockAnalyticsHandler}>
|
|
170
170
|
</collection-browser>`);
|
|
171
171
|
el.searchContext = 'beta-search-service';
|
|
172
172
|
el.selectedFacets = mockedSelectedFacets;
|
|
@@ -203,7 +203,7 @@ describe('Collection Browser', () => {
|
|
|
203
203
|
});
|
|
204
204
|
it('should render with a sort bar, facets, and infinite scroller', async () => {
|
|
205
205
|
const searchService = new MockSearchService();
|
|
206
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
206
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
207
207
|
</collection-browser>`);
|
|
208
208
|
el.baseQuery = 'hello';
|
|
209
209
|
await el.updateComplete;
|
|
@@ -217,7 +217,7 @@ describe('Collection Browser', () => {
|
|
|
217
217
|
});
|
|
218
218
|
it('queries the search service when given a base query', async () => {
|
|
219
219
|
const searchService = new MockSearchService();
|
|
220
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
220
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
221
221
|
</collection-browser>`);
|
|
222
222
|
el.baseQuery = 'collection:foo';
|
|
223
223
|
await el.updateComplete;
|
|
@@ -227,7 +227,7 @@ describe('Collection Browser', () => {
|
|
|
227
227
|
});
|
|
228
228
|
it('queries the search service when given a list of identifiers and no query', async () => {
|
|
229
229
|
const searchService = new MockSearchService();
|
|
230
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
230
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
231
231
|
</collection-browser>`);
|
|
232
232
|
el.identifiers = ['foo', 'bar'];
|
|
233
233
|
await el.updateComplete;
|
|
@@ -240,7 +240,7 @@ describe('Collection Browser', () => {
|
|
|
240
240
|
});
|
|
241
241
|
it('queries the search service when given a list of identifiers with a query', async () => {
|
|
242
242
|
const searchService = new MockSearchService();
|
|
243
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
243
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
244
244
|
</collection-browser>`);
|
|
245
245
|
el.baseQuery = 'collection:foo';
|
|
246
246
|
el.identifiers = ['foo', 'bar'];
|
|
@@ -255,7 +255,7 @@ describe('Collection Browser', () => {
|
|
|
255
255
|
});
|
|
256
256
|
it('queries the search service with a metadata search', async () => {
|
|
257
257
|
const searchService = new MockSearchService();
|
|
258
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
258
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
259
259
|
</collection-browser>`);
|
|
260
260
|
el.searchType = SearchType.METADATA;
|
|
261
261
|
await el.updateComplete;
|
|
@@ -268,7 +268,7 @@ describe('Collection Browser', () => {
|
|
|
268
268
|
});
|
|
269
269
|
it('can change search type', async () => {
|
|
270
270
|
const searchService = new MockSearchService();
|
|
271
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
271
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
272
272
|
</collection-browser>`);
|
|
273
273
|
el.baseQuery = 'collection:foo';
|
|
274
274
|
await el.updateComplete;
|
|
@@ -279,7 +279,7 @@ describe('Collection Browser', () => {
|
|
|
279
279
|
});
|
|
280
280
|
it('queries the search service with a fulltext search', async () => {
|
|
281
281
|
const searchService = new MockSearchService();
|
|
282
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
282
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
283
283
|
</collection-browser>`);
|
|
284
284
|
el.searchType = SearchType.FULLTEXT;
|
|
285
285
|
await el.updateComplete;
|
|
@@ -292,7 +292,7 @@ describe('Collection Browser', () => {
|
|
|
292
292
|
});
|
|
293
293
|
it('queries the search service with a radio search', async () => {
|
|
294
294
|
const searchService = new MockSearchService();
|
|
295
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
295
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
296
296
|
</collection-browser>`);
|
|
297
297
|
el.searchType = SearchType.RADIO;
|
|
298
298
|
await el.updateComplete;
|
|
@@ -305,7 +305,7 @@ describe('Collection Browser', () => {
|
|
|
305
305
|
});
|
|
306
306
|
it('queries the search service with a TV search', async () => {
|
|
307
307
|
const searchService = new MockSearchService();
|
|
308
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
308
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
309
309
|
</collection-browser>`);
|
|
310
310
|
el.searchType = SearchType.TV;
|
|
311
311
|
await el.updateComplete;
|
|
@@ -344,7 +344,7 @@ describe('Collection Browser', () => {
|
|
|
344
344
|
collection: {},
|
|
345
345
|
year: {},
|
|
346
346
|
};
|
|
347
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
347
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
348
348
|
</collection-browser>`);
|
|
349
349
|
el.baseQuery = 'collection:foo';
|
|
350
350
|
el.selectedFacets = selectedFacets;
|
|
@@ -376,7 +376,7 @@ describe('Collection Browser', () => {
|
|
|
376
376
|
url.searchParams.append('sin', 'TXT');
|
|
377
377
|
window.history.replaceState({}, '', url);
|
|
378
378
|
const searchService = new MockSearchService();
|
|
379
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
379
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
380
380
|
</collection-browser>`);
|
|
381
381
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
382
382
|
});
|
|
@@ -386,10 +386,10 @@ describe('Collection Browser', () => {
|
|
|
386
386
|
url.searchParams.append('sin', 'TXT');
|
|
387
387
|
window.history.replaceState({}, '', url);
|
|
388
388
|
const searchService = new MockSearchService();
|
|
389
|
-
const el = await fixture(html `<collection-browser
|
|
390
|
-
.searchService=${searchService}
|
|
391
|
-
suppressURLSinParam
|
|
392
|
-
>
|
|
389
|
+
const el = await fixture(html `<collection-browser
|
|
390
|
+
.searchService=${searchService}
|
|
391
|
+
suppressURLSinParam
|
|
392
|
+
>
|
|
393
393
|
</collection-browser>`);
|
|
394
394
|
url = new URL(window.location.href);
|
|
395
395
|
expect(el.searchType).to.equal(SearchType.DEFAULT);
|
|
@@ -401,7 +401,7 @@ describe('Collection Browser', () => {
|
|
|
401
401
|
});
|
|
402
402
|
it('can construct tile models with many fields present', async () => {
|
|
403
403
|
const searchService = new MockSearchService();
|
|
404
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
404
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
405
405
|
</collection-browser>`);
|
|
406
406
|
el.baseQuery = 'many-fields';
|
|
407
407
|
await el.updateComplete;
|
|
@@ -414,10 +414,10 @@ describe('Collection Browser', () => {
|
|
|
414
414
|
it('emits empty results event when search fetches no results', async () => {
|
|
415
415
|
const searchService = new MockSearchService();
|
|
416
416
|
const emptyResultsSpy = sinon.spy();
|
|
417
|
-
const el = await fixture(html `<collection-browser
|
|
418
|
-
.searchService=${searchService}
|
|
419
|
-
@emptyResults=${emptyResultsSpy}
|
|
420
|
-
>
|
|
417
|
+
const el = await fixture(html `<collection-browser
|
|
418
|
+
.searchService=${searchService}
|
|
419
|
+
@emptyResults=${emptyResultsSpy}
|
|
420
|
+
>
|
|
421
421
|
</collection-browser>`);
|
|
422
422
|
el.baseQuery = 'no-results';
|
|
423
423
|
await el.updateComplete;
|
|
@@ -427,10 +427,10 @@ describe('Collection Browser', () => {
|
|
|
427
427
|
it('emits searchError event when search results in an error', async () => {
|
|
428
428
|
const searchService = new MockSearchService();
|
|
429
429
|
const searchErrorSpy = sinon.spy();
|
|
430
|
-
const el = await fixture(html `<collection-browser
|
|
431
|
-
.searchService=${searchService}
|
|
432
|
-
@searchError=${searchErrorSpy}
|
|
433
|
-
>
|
|
430
|
+
const el = await fixture(html `<collection-browser
|
|
431
|
+
.searchService=${searchService}
|
|
432
|
+
@searchError=${searchErrorSpy}
|
|
433
|
+
>
|
|
434
434
|
</collection-browser>`);
|
|
435
435
|
el.baseQuery = 'error';
|
|
436
436
|
await el.updateComplete;
|
|
@@ -439,7 +439,7 @@ describe('Collection Browser', () => {
|
|
|
439
439
|
});
|
|
440
440
|
it('applies loggedin flag to tile models if needed', async () => {
|
|
441
441
|
const searchService = new MockSearchService();
|
|
442
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
442
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
443
443
|
</collection-browser>`);
|
|
444
444
|
el.baseQuery = 'loggedin';
|
|
445
445
|
await el.updateComplete;
|
|
@@ -452,7 +452,7 @@ describe('Collection Browser', () => {
|
|
|
452
452
|
});
|
|
453
453
|
it('applies no-preview flag to tile models if needed', async () => {
|
|
454
454
|
const searchService = new MockSearchService();
|
|
455
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
455
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
456
456
|
</collection-browser>`);
|
|
457
457
|
el.baseQuery = 'no-preview';
|
|
458
458
|
await el.updateComplete;
|
|
@@ -465,7 +465,7 @@ describe('Collection Browser', () => {
|
|
|
465
465
|
});
|
|
466
466
|
it('both loggedin and no-preview flags can be set simultaneously', async () => {
|
|
467
467
|
const searchService = new MockSearchService();
|
|
468
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
468
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
469
469
|
</collection-browser>`);
|
|
470
470
|
el.baseQuery = 'loggedin-no-preview';
|
|
471
471
|
await el.updateComplete;
|
|
@@ -479,7 +479,7 @@ describe('Collection Browser', () => {
|
|
|
479
479
|
});
|
|
480
480
|
it('joins full description array into a single string with line breaks', async () => {
|
|
481
481
|
const searchService = new MockSearchService();
|
|
482
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
482
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
483
483
|
</collection-browser>`);
|
|
484
484
|
// This query receives an array description like ['line1', 'line2']
|
|
485
485
|
el.baseQuery = 'multi-line-description';
|
|
@@ -494,9 +494,9 @@ describe('Collection Browser', () => {
|
|
|
494
494
|
});
|
|
495
495
|
it('can change search type', async () => {
|
|
496
496
|
const searchService = new MockSearchService();
|
|
497
|
-
const el = await fixture(html `<collection-browser
|
|
498
|
-
.searchService=${searchService}
|
|
499
|
-
.searchType=${SearchType.METADATA}
|
|
497
|
+
const el = await fixture(html `<collection-browser
|
|
498
|
+
.searchService=${searchService}
|
|
499
|
+
.searchType=${SearchType.METADATA}
|
|
500
500
|
></collection-browser>`);
|
|
501
501
|
el.baseQuery = 'collection:foo';
|
|
502
502
|
el.searchType = SearchType.FULLTEXT;
|
|
@@ -507,8 +507,8 @@ describe('Collection Browser', () => {
|
|
|
507
507
|
});
|
|
508
508
|
it('trims queries of leading/trailing whitespace', async () => {
|
|
509
509
|
const searchService = new MockSearchService();
|
|
510
|
-
const el = await fixture(html `<collection-browser
|
|
511
|
-
.searchService=${searchService}
|
|
510
|
+
const el = await fixture(html `<collection-browser
|
|
511
|
+
.searchService=${searchService}
|
|
512
512
|
></collection-browser>`);
|
|
513
513
|
el.baseQuery = ' collection:foo ';
|
|
514
514
|
await el.updateComplete;
|
|
@@ -517,8 +517,8 @@ describe('Collection Browser', () => {
|
|
|
517
517
|
});
|
|
518
518
|
it('shows error message when error response received', async () => {
|
|
519
519
|
const searchService = new MockSearchService();
|
|
520
|
-
const el = await fixture(html `<collection-browser
|
|
521
|
-
.searchService=${searchService}
|
|
520
|
+
const el = await fixture(html `<collection-browser
|
|
521
|
+
.searchService=${searchService}
|
|
522
522
|
></collection-browser>`);
|
|
523
523
|
el.baseQuery = 'error';
|
|
524
524
|
await el.updateComplete;
|
|
@@ -530,8 +530,8 @@ describe('Collection Browser', () => {
|
|
|
530
530
|
});
|
|
531
531
|
it('shows error message when error response received for a collection', async () => {
|
|
532
532
|
const searchService = new MockSearchService();
|
|
533
|
-
const el = await fixture(html `<collection-browser
|
|
534
|
-
.searchService=${searchService}
|
|
533
|
+
const el = await fixture(html `<collection-browser
|
|
534
|
+
.searchService=${searchService}
|
|
535
535
|
></collection-browser>`);
|
|
536
536
|
el.withinCollection = 'error';
|
|
537
537
|
await el.updateComplete;
|
|
@@ -546,8 +546,8 @@ describe('Collection Browser', () => {
|
|
|
546
546
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
547
547
|
window.Sentry = { captureMessage: sentrySpy };
|
|
548
548
|
const searchService = new MockSearchService();
|
|
549
|
-
const el = await fixture(html `<collection-browser
|
|
550
|
-
.searchService=${searchService}
|
|
549
|
+
const el = await fixture(html `<collection-browser
|
|
550
|
+
.searchService=${searchService}
|
|
551
551
|
></collection-browser>`);
|
|
552
552
|
el.baseQuery = 'malformed';
|
|
553
553
|
await el.updateComplete;
|
|
@@ -556,7 +556,7 @@ describe('Collection Browser', () => {
|
|
|
556
556
|
});
|
|
557
557
|
it('adds collection names to cache when present on response', async () => {
|
|
558
558
|
const searchService = new MockSearchService();
|
|
559
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
559
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
560
560
|
</collection-browser>`);
|
|
561
561
|
el.baseQuery = 'collection-titles';
|
|
562
562
|
await el.updateComplete;
|
|
@@ -568,7 +568,7 @@ describe('Collection Browser', () => {
|
|
|
568
568
|
});
|
|
569
569
|
it('adds tv channel aliases to cache when present on response', async () => {
|
|
570
570
|
const searchService = new MockSearchService();
|
|
571
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
571
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
572
572
|
</collection-browser>`);
|
|
573
573
|
el.baseQuery = 'channel-aliases';
|
|
574
574
|
await el.updateComplete;
|
|
@@ -582,7 +582,7 @@ describe('Collection Browser', () => {
|
|
|
582
582
|
asyncResponse: true,
|
|
583
583
|
resultsSpy,
|
|
584
584
|
});
|
|
585
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
585
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
586
586
|
</collection-browser>`);
|
|
587
587
|
el.baseQuery = 'with-sort';
|
|
588
588
|
el.selectedSort = SortField.date;
|
|
@@ -599,7 +599,7 @@ describe('Collection Browser', () => {
|
|
|
599
599
|
asyncResponse: true,
|
|
600
600
|
resultsSpy,
|
|
601
601
|
});
|
|
602
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
602
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
603
603
|
</collection-browser>`);
|
|
604
604
|
el.baseQuery = 'with-sort';
|
|
605
605
|
el.selectedSort = SortField.date;
|
|
@@ -621,7 +621,7 @@ describe('Collection Browser', () => {
|
|
|
621
621
|
asyncResponse: true,
|
|
622
622
|
resultsSpy,
|
|
623
623
|
});
|
|
624
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
624
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
625
625
|
</collection-browser>`);
|
|
626
626
|
el.baseQuery = 'single-result';
|
|
627
627
|
await el.updateComplete;
|
|
@@ -642,7 +642,7 @@ describe('Collection Browser', () => {
|
|
|
642
642
|
asyncResponse: true,
|
|
643
643
|
resultsSpy,
|
|
644
644
|
});
|
|
645
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
645
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
646
646
|
</collection-browser>`);
|
|
647
647
|
el.baseQuery = 'with-sort';
|
|
648
648
|
el.selectedSort = SortField.date;
|
|
@@ -660,7 +660,7 @@ describe('Collection Browser', () => {
|
|
|
660
660
|
});
|
|
661
661
|
it('sets sort properties when user changes sort', async () => {
|
|
662
662
|
const searchService = new MockSearchService();
|
|
663
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
663
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
664
664
|
</collection-browser>`);
|
|
665
665
|
expect(el.selectedSort).to.equal(SortField.default);
|
|
666
666
|
el.baseQuery = 'foo';
|
|
@@ -681,7 +681,7 @@ describe('Collection Browser', () => {
|
|
|
681
681
|
});
|
|
682
682
|
it('sets sort filter properties when user selects title filter', async () => {
|
|
683
683
|
const searchService = new MockSearchService();
|
|
684
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
684
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
685
685
|
</collection-browser>`);
|
|
686
686
|
el.baseQuery = 'first-title';
|
|
687
687
|
el.selectedSort = 'title';
|
|
@@ -694,7 +694,7 @@ describe('Collection Browser', () => {
|
|
|
694
694
|
});
|
|
695
695
|
it('sets sort filter properties when user selects creator filter', async () => {
|
|
696
696
|
const searchService = new MockSearchService();
|
|
697
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
697
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
698
698
|
</collection-browser>`);
|
|
699
699
|
el.baseQuery = 'first-creator';
|
|
700
700
|
el.selectedSort = 'creator';
|
|
@@ -716,7 +716,7 @@ describe('Collection Browser', () => {
|
|
|
716
716
|
subject: {},
|
|
717
717
|
year: {},
|
|
718
718
|
};
|
|
719
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
719
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
720
720
|
</collection-browser>`);
|
|
721
721
|
el.baseQuery = 'first-creator';
|
|
722
722
|
el.selectedSort = 'creator';
|
|
@@ -743,7 +743,7 @@ describe('Collection Browser', () => {
|
|
|
743
743
|
});
|
|
744
744
|
it('applies correct TV search filter for commercials', async () => {
|
|
745
745
|
const searchService = new MockSearchService();
|
|
746
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
746
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
747
747
|
</collection-browser>`);
|
|
748
748
|
el.baseQuery = 'tv-fields';
|
|
749
749
|
el.searchType = SearchType.TV;
|
|
@@ -758,7 +758,7 @@ describe('Collection Browser', () => {
|
|
|
758
758
|
});
|
|
759
759
|
it('applies correct TV search filter for fact checks', async () => {
|
|
760
760
|
const searchService = new MockSearchService();
|
|
761
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
761
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
762
762
|
</collection-browser>`);
|
|
763
763
|
el.baseQuery = 'tv-fields';
|
|
764
764
|
el.searchType = SearchType.TV;
|
|
@@ -773,7 +773,7 @@ describe('Collection Browser', () => {
|
|
|
773
773
|
});
|
|
774
774
|
it('applies correct TV search filter for quotes', async () => {
|
|
775
775
|
const searchService = new MockSearchService();
|
|
776
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
776
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
777
777
|
</collection-browser>`);
|
|
778
778
|
el.baseQuery = 'tv-fields';
|
|
779
779
|
el.searchType = SearchType.TV;
|
|
@@ -786,7 +786,7 @@ describe('Collection Browser', () => {
|
|
|
786
786
|
});
|
|
787
787
|
it('resets letter filters when query changes', async () => {
|
|
788
788
|
const searchService = new MockSearchService();
|
|
789
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
789
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
790
790
|
</collection-browser>`);
|
|
791
791
|
el.baseQuery = 'first-creator';
|
|
792
792
|
el.selectedSort = 'creator';
|
|
@@ -806,11 +806,11 @@ describe('Collection Browser', () => {
|
|
|
806
806
|
it('sets date range query when date picker selection changed', async () => {
|
|
807
807
|
const searchService = new MockSearchService();
|
|
808
808
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
809
|
-
const el = await fixture(html `<collection-browser
|
|
810
|
-
.searchService=${searchService}
|
|
811
|
-
.analyticsHandler=${mockAnalyticsHandler}
|
|
812
|
-
.suppressPlaceholders=${true}
|
|
813
|
-
>
|
|
809
|
+
const el = await fixture(html `<collection-browser
|
|
810
|
+
.searchService=${searchService}
|
|
811
|
+
.analyticsHandler=${mockAnalyticsHandler}
|
|
812
|
+
.suppressPlaceholders=${true}
|
|
813
|
+
>
|
|
814
814
|
</collection-browser>`);
|
|
815
815
|
el.baseQuery = 'years'; // Includes year_histogram aggregation in response
|
|
816
816
|
el.showHistogramDatePicker = true;
|
|
@@ -838,10 +838,10 @@ describe('Collection Browser', () => {
|
|
|
838
838
|
});
|
|
839
839
|
it('sets date range query when monthly date picker selection changed', async () => {
|
|
840
840
|
const searchService = new MockSearchService();
|
|
841
|
-
const el = await fixture(html `<collection-browser
|
|
842
|
-
.searchService=${searchService}
|
|
843
|
-
.suppressPlaceholders=${true}
|
|
844
|
-
>
|
|
841
|
+
const el = await fixture(html `<collection-browser
|
|
842
|
+
.searchService=${searchService}
|
|
843
|
+
.suppressPlaceholders=${true}
|
|
844
|
+
>
|
|
845
845
|
</collection-browser>`);
|
|
846
846
|
el.baseQuery = 'months'; // Includes date_histogram aggregation in response
|
|
847
847
|
el.searchType = SearchType.TV;
|
|
@@ -871,9 +871,9 @@ describe('Collection Browser', () => {
|
|
|
871
871
|
it('emits event when results start and end loading', async () => {
|
|
872
872
|
const spy = sinon.spy();
|
|
873
873
|
const searchService = new MockSearchService();
|
|
874
|
-
const el = await fixture(html `<collection-browser
|
|
875
|
-
.searchService=${searchService}
|
|
876
|
-
@searchResultsLoadingChanged=${spy}
|
|
874
|
+
const el = await fixture(html `<collection-browser
|
|
875
|
+
.searchService=${searchService}
|
|
876
|
+
@searchResultsLoadingChanged=${spy}
|
|
877
877
|
></collection-browser>`);
|
|
878
878
|
spy.resetHistory();
|
|
879
879
|
el.baseQuery = 'collection:foo';
|
|
@@ -886,9 +886,9 @@ describe('Collection Browser', () => {
|
|
|
886
886
|
});
|
|
887
887
|
it('collapses extra set of quotes around href field', async () => {
|
|
888
888
|
const searchService = new MockSearchService();
|
|
889
|
-
const el = await fixture(html `<collection-browser
|
|
890
|
-
.searchService=${searchService}
|
|
891
|
-
.baseNavigationUrl=${''}
|
|
889
|
+
const el = await fixture(html `<collection-browser
|
|
890
|
+
.searchService=${searchService}
|
|
891
|
+
.baseNavigationUrl=${''}
|
|
892
892
|
></collection-browser>`);
|
|
893
893
|
el.baseQuery = 'extra-quoted-href';
|
|
894
894
|
await el.updateComplete;
|
|
@@ -898,17 +898,16 @@ describe('Collection Browser', () => {
|
|
|
898
898
|
// Original href q param starts/ends with %22%22, but should be collapsed to %22 before render
|
|
899
899
|
expect(el.dataSource.getTileModelAt(0)?.href).to.equal('/details/foo?q=%22quoted+query%22');
|
|
900
900
|
});
|
|
901
|
-
it('sets default sort from
|
|
901
|
+
it('sets default sort from externally-provided values', async () => {
|
|
902
902
|
const searchService = new MockSearchService();
|
|
903
|
-
const el = await fixture(html `<collection-browser
|
|
904
|
-
.searchService=${searchService}
|
|
905
|
-
.baseNavigationUrl=${''}
|
|
903
|
+
const el = await fixture(html `<collection-browser
|
|
904
|
+
.searchService=${searchService}
|
|
905
|
+
.baseNavigationUrl=${''}
|
|
906
|
+
.withinCollection=${'test-collection'}
|
|
907
|
+
.defaultSortField=${SortField.title}
|
|
908
|
+
.defaultSortDirection=${'asc'}
|
|
906
909
|
></collection-browser>`);
|
|
907
|
-
el.withinCollection = 'default-sort';
|
|
908
|
-
await el.updateComplete;
|
|
909
|
-
await el.initialSearchComplete;
|
|
910
910
|
await el.updateComplete;
|
|
911
|
-
await aTimeout(50);
|
|
912
911
|
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
913
912
|
expect(sortBar).to.exist;
|
|
914
913
|
expect(sortBar.defaultSortField).to.equal(SortField.title);
|
|
@@ -916,17 +915,16 @@ describe('Collection Browser', () => {
|
|
|
916
915
|
expect(sortBar.selectedSort).to.equal(SortField.default);
|
|
917
916
|
expect(sortBar.sortDirection).to.be.null;
|
|
918
917
|
});
|
|
919
|
-
it('
|
|
918
|
+
it('reflects updated default sort field/direction on sort bar', async () => {
|
|
920
919
|
const searchService = new MockSearchService();
|
|
921
|
-
const el = await fixture(html `<collection-browser
|
|
922
|
-
.searchService=${searchService}
|
|
923
|
-
.baseNavigationUrl=${''}
|
|
920
|
+
const el = await fixture(html `<collection-browser
|
|
921
|
+
.searchService=${searchService}
|
|
922
|
+
.baseNavigationUrl=${''}
|
|
923
|
+
.withinCollection=${'test-collection'}
|
|
924
|
+
.defaultSortField=${SortField.dateadded}
|
|
925
|
+
.defaultSortDirection=${'desc'}
|
|
924
926
|
></collection-browser>`);
|
|
925
|
-
el.withinCollection = 'default-sort-concise';
|
|
926
|
-
await el.updateComplete;
|
|
927
|
-
await el.initialSearchComplete;
|
|
928
927
|
await el.updateComplete;
|
|
929
|
-
await aTimeout(50);
|
|
930
928
|
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
931
929
|
expect(sortBar).to.exist;
|
|
932
930
|
expect(sortBar.defaultSortField).to.equal(SortField.dateadded);
|
|
@@ -934,11 +932,12 @@ describe('Collection Browser', () => {
|
|
|
934
932
|
expect(sortBar.selectedSort).to.equal(SortField.default);
|
|
935
933
|
expect(sortBar.sortDirection).to.be.null;
|
|
936
934
|
});
|
|
937
|
-
it('
|
|
938
|
-
const el = await fixture(html `<collection-browser
|
|
939
|
-
.withinProfile=${'@foobar'}
|
|
935
|
+
it('uses weekly views as default sort when set externally for profiles', async () => {
|
|
936
|
+
const el = await fixture(html `<collection-browser
|
|
937
|
+
.withinProfile=${'@foobar'}
|
|
938
|
+
.defaultSortField=${SortField.weeklyview}
|
|
939
|
+
.defaultSortDirection=${'desc'}
|
|
940
940
|
></collection-browser>`);
|
|
941
|
-
el.applyDefaultProfileSort();
|
|
942
941
|
expect(el.defaultSortParam).to.deep.equal({
|
|
943
942
|
field: 'week',
|
|
944
943
|
direction: 'desc',
|
|
@@ -946,9 +945,9 @@ describe('Collection Browser', () => {
|
|
|
946
945
|
});
|
|
947
946
|
it('uses relevance sort as default when a query is set', async () => {
|
|
948
947
|
const searchService = new MockSearchService();
|
|
949
|
-
const el = await fixture(html `<collection-browser
|
|
950
|
-
.searchService=${searchService}
|
|
951
|
-
.baseNavigationUrl=${''}
|
|
948
|
+
const el = await fixture(html `<collection-browser
|
|
949
|
+
.searchService=${searchService}
|
|
950
|
+
.baseNavigationUrl=${''}
|
|
952
951
|
></collection-browser>`);
|
|
953
952
|
el.withinCollection = 'default-sort';
|
|
954
953
|
el.baseQuery = 'default-sort';
|
|
@@ -963,17 +962,16 @@ describe('Collection Browser', () => {
|
|
|
963
962
|
expect(sortBar.selectedSort).to.equal(SortField.default);
|
|
964
963
|
expect(sortBar.sortDirection).to.be.null;
|
|
965
964
|
});
|
|
966
|
-
it('uses date favorited sort as default when
|
|
965
|
+
it('uses date favorited sort as default when set externally for fav- collection', async () => {
|
|
967
966
|
const searchService = new MockSearchService();
|
|
968
|
-
const el = await fixture(html `<collection-browser
|
|
969
|
-
.searchService=${searchService}
|
|
970
|
-
.baseNavigationUrl=${''}
|
|
967
|
+
const el = await fixture(html `<collection-browser
|
|
968
|
+
.searchService=${searchService}
|
|
969
|
+
.baseNavigationUrl=${''}
|
|
970
|
+
.withinCollection=${'fav-sort'}
|
|
971
|
+
.defaultSortField=${SortField.datefavorited}
|
|
972
|
+
.defaultSortDirection=${'desc'}
|
|
971
973
|
></collection-browser>`);
|
|
972
|
-
el.withinCollection = 'fav-sort';
|
|
973
974
|
await el.updateComplete;
|
|
974
|
-
await el.initialSearchComplete;
|
|
975
|
-
await el.updateComplete;
|
|
976
|
-
await aTimeout(50);
|
|
977
975
|
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
978
976
|
expect(sortBar).to.exist;
|
|
979
977
|
expect(sortBar.defaultSortField).to.equal(SortField.datefavorited);
|
|
@@ -983,7 +981,7 @@ describe('Collection Browser', () => {
|
|
|
983
981
|
});
|
|
984
982
|
it('scrolls to page', async () => {
|
|
985
983
|
const searchService = new MockSearchService();
|
|
986
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
984
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
987
985
|
</collection-browser>`);
|
|
988
986
|
// Infinite scroller won't exist unless there's a base query.
|
|
989
987
|
// First ensure that we don't throw errors when it doesn't exist.
|
|
@@ -1004,9 +1002,9 @@ describe('Collection Browser', () => {
|
|
|
1004
1002
|
});
|
|
1005
1003
|
it('shows mobile facets in mobile view', async () => {
|
|
1006
1004
|
const searchService = new MockSearchService();
|
|
1007
|
-
const el = await fixture(html `<collection-browser
|
|
1008
|
-
.searchService=${searchService}
|
|
1009
|
-
.mobileBreakpoint=${9999}
|
|
1005
|
+
const el = await fixture(html `<collection-browser
|
|
1006
|
+
.searchService=${searchService}
|
|
1007
|
+
.mobileBreakpoint=${9999}
|
|
1010
1008
|
></collection-browser>`);
|
|
1011
1009
|
el.baseQuery = 'collection:foo';
|
|
1012
1010
|
await el.updateComplete;
|
|
@@ -1025,11 +1023,11 @@ describe('Collection Browser', () => {
|
|
|
1025
1023
|
it('fires analytics when mobile facets toggled', async () => {
|
|
1026
1024
|
const searchService = new MockSearchService();
|
|
1027
1025
|
const analyticsHandler = new MockAnalyticsHandler();
|
|
1028
|
-
const el = await fixture(html `<collection-browser
|
|
1029
|
-
.searchService=${searchService}
|
|
1030
|
-
.analyticsHandler=${analyticsHandler}
|
|
1031
|
-
.searchContext=${'foobar-context'}
|
|
1032
|
-
.mobileBreakpoint=${9999}
|
|
1026
|
+
const el = await fixture(html `<collection-browser
|
|
1027
|
+
.searchService=${searchService}
|
|
1028
|
+
.analyticsHandler=${analyticsHandler}
|
|
1029
|
+
.searchContext=${'foobar-context'}
|
|
1030
|
+
.mobileBreakpoint=${9999}
|
|
1033
1031
|
></collection-browser>`);
|
|
1034
1032
|
el.baseQuery = 'collection:foo';
|
|
1035
1033
|
await el.updateComplete;
|
|
@@ -1069,9 +1067,9 @@ describe('Collection Browser', () => {
|
|
|
1069
1067
|
});
|
|
1070
1068
|
it('sets parent collections to prop when searching a collection', async () => {
|
|
1071
1069
|
const searchService = new MockSearchService();
|
|
1072
|
-
const el = await fixture(html `<collection-browser
|
|
1073
|
-
.searchService=${searchService}
|
|
1074
|
-
.withinCollection=${'fake'}
|
|
1070
|
+
const el = await fixture(html `<collection-browser
|
|
1071
|
+
.searchService=${searchService}
|
|
1072
|
+
.withinCollection=${'fake'}
|
|
1075
1073
|
></collection-browser>`);
|
|
1076
1074
|
el.baseQuery = 'parent-collections';
|
|
1077
1075
|
await el.updateComplete;
|
|
@@ -1081,9 +1079,9 @@ describe('Collection Browser', () => {
|
|
|
1081
1079
|
});
|
|
1082
1080
|
it('recognizes TV collections', async () => {
|
|
1083
1081
|
const searchService = new MockSearchService();
|
|
1084
|
-
const el = await fixture(html `<collection-browser
|
|
1085
|
-
.searchService=${searchService}
|
|
1086
|
-
.withinCollection=${'TV-FOO'}
|
|
1082
|
+
const el = await fixture(html `<collection-browser
|
|
1083
|
+
.searchService=${searchService}
|
|
1084
|
+
.withinCollection=${'TV-FOO'}
|
|
1087
1085
|
></collection-browser>`);
|
|
1088
1086
|
el.baseQuery = 'tv-collection';
|
|
1089
1087
|
await el.updateComplete;
|
|
@@ -1094,9 +1092,9 @@ describe('Collection Browser', () => {
|
|
|
1094
1092
|
it('refreshes when certain properties change - with some analytics event sampling', async () => {
|
|
1095
1093
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
1096
1094
|
const searchService = new MockSearchService();
|
|
1097
|
-
const el = await fixture(html `<collection-browser
|
|
1098
|
-
.analyticsHandler=${mockAnalyticsHandler}
|
|
1099
|
-
.searchService=${searchService}
|
|
1095
|
+
const el = await fixture(html `<collection-browser
|
|
1096
|
+
.analyticsHandler=${mockAnalyticsHandler}
|
|
1097
|
+
.searchService=${searchService}
|
|
1100
1098
|
></collection-browser>`);
|
|
1101
1099
|
const infiniteScrollerRefreshSpy = sinon.spy();
|
|
1102
1100
|
// Infinite scroller won't exist unless there's a base query
|
|
@@ -1141,7 +1139,7 @@ describe('Collection Browser', () => {
|
|
|
1141
1139
|
});
|
|
1142
1140
|
it('query the search service for single result', async () => {
|
|
1143
1141
|
const searchService = new MockSearchService();
|
|
1144
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1142
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1145
1143
|
</collection-browser>`);
|
|
1146
1144
|
el.baseQuery = 'single-result';
|
|
1147
1145
|
await el.updateComplete;
|
|
@@ -1169,7 +1167,7 @@ describe('Collection Browser', () => {
|
|
|
1169
1167
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1170
1168
|
window.history.replaceState({}, '', url);
|
|
1171
1169
|
const searchService = new MockSearchService();
|
|
1172
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1170
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1173
1171
|
</collection-browser>`);
|
|
1174
1172
|
await el.initialSearchComplete;
|
|
1175
1173
|
await el.updateComplete;
|
|
@@ -1194,10 +1192,10 @@ describe('Collection Browser', () => {
|
|
|
1194
1192
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1195
1193
|
window.history.replaceState({}, '', url);
|
|
1196
1194
|
const searchService = new MockSearchService();
|
|
1197
|
-
const el = await fixture(html `<collection-browser
|
|
1198
|
-
.searchService=${searchService}
|
|
1199
|
-
.withinCollection=${'foobar'}
|
|
1200
|
-
>
|
|
1195
|
+
const el = await fixture(html `<collection-browser
|
|
1196
|
+
.searchService=${searchService}
|
|
1197
|
+
.withinCollection=${'foobar'}
|
|
1198
|
+
>
|
|
1201
1199
|
</collection-browser>`);
|
|
1202
1200
|
await el.initialSearchComplete;
|
|
1203
1201
|
await el.updateComplete;
|
|
@@ -1221,11 +1219,11 @@ describe('Collection Browser', () => {
|
|
|
1221
1219
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1222
1220
|
window.history.replaceState({}, '', url);
|
|
1223
1221
|
const searchService = new MockSearchService();
|
|
1224
|
-
const el = await fixture(html `<collection-browser
|
|
1225
|
-
.searchService=${searchService}
|
|
1226
|
-
.withinProfile=${'@foobar'}
|
|
1227
|
-
.profileElement=${'uploads'}
|
|
1228
|
-
>
|
|
1222
|
+
const el = await fixture(html `<collection-browser
|
|
1223
|
+
.searchService=${searchService}
|
|
1224
|
+
.withinProfile=${'@foobar'}
|
|
1225
|
+
.profileElement=${'uploads'}
|
|
1226
|
+
>
|
|
1229
1227
|
</collection-browser>`);
|
|
1230
1228
|
await el.initialSearchComplete;
|
|
1231
1229
|
await el.updateComplete;
|
|
@@ -1251,7 +1249,7 @@ describe('Collection Browser', () => {
|
|
|
1251
1249
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1252
1250
|
window.history.replaceState({}, '', url);
|
|
1253
1251
|
const searchService = new MockSearchService();
|
|
1254
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1252
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1255
1253
|
</collection-browser>`);
|
|
1256
1254
|
await el.initialSearchComplete;
|
|
1257
1255
|
await el.updateComplete;
|
|
@@ -1278,10 +1276,10 @@ describe('Collection Browser', () => {
|
|
|
1278
1276
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1279
1277
|
window.history.replaceState({}, '', url);
|
|
1280
1278
|
const searchService = new MockSearchService();
|
|
1281
|
-
const el = await fixture(html `<collection-browser
|
|
1282
|
-
.searchService=${searchService}
|
|
1283
|
-
.withinCollection=${'foobar'}
|
|
1284
|
-
>
|
|
1279
|
+
const el = await fixture(html `<collection-browser
|
|
1280
|
+
.searchService=${searchService}
|
|
1281
|
+
.withinCollection=${'foobar'}
|
|
1282
|
+
>
|
|
1285
1283
|
</collection-browser>`);
|
|
1286
1284
|
el.baseQuery = 'bar';
|
|
1287
1285
|
await el.updateComplete;
|
|
@@ -1307,10 +1305,10 @@ describe('Collection Browser', () => {
|
|
|
1307
1305
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1308
1306
|
window.history.replaceState({}, '', url);
|
|
1309
1307
|
const searchService = new MockSearchService();
|
|
1310
|
-
const el = await fixture(html `<collection-browser
|
|
1311
|
-
.searchService=${searchService}
|
|
1312
|
-
.withinCollection=${'foobar'}
|
|
1313
|
-
>
|
|
1308
|
+
const el = await fixture(html `<collection-browser
|
|
1309
|
+
.searchService=${searchService}
|
|
1310
|
+
.withinCollection=${'foobar'}
|
|
1311
|
+
>
|
|
1314
1312
|
</collection-browser>`);
|
|
1315
1313
|
el.withinCollection = 'bar';
|
|
1316
1314
|
await el.updateComplete;
|
|
@@ -1326,11 +1324,11 @@ describe('Collection Browser', () => {
|
|
|
1326
1324
|
});
|
|
1327
1325
|
it('correctly retrieves web archive hits', async () => {
|
|
1328
1326
|
const searchService = new MockSearchService();
|
|
1329
|
-
const el = await fixture(html `<collection-browser
|
|
1330
|
-
.searchService=${searchService}
|
|
1331
|
-
.withinProfile=${'@foo'}
|
|
1332
|
-
.profileElement=${'web_archives'}
|
|
1333
|
-
>
|
|
1327
|
+
const el = await fixture(html `<collection-browser
|
|
1328
|
+
.searchService=${searchService}
|
|
1329
|
+
.withinProfile=${'@foo'}
|
|
1330
|
+
.profileElement=${'web_archives'}
|
|
1331
|
+
>
|
|
1334
1332
|
</collection-browser>`);
|
|
1335
1333
|
el.baseQuery = 'web-archive';
|
|
1336
1334
|
await el.updateComplete;
|
|
@@ -1343,10 +1341,10 @@ describe('Collection Browser', () => {
|
|
|
1343
1341
|
});
|
|
1344
1342
|
it('shows dropdown accordion in facet sidebar when opt-in strategy is specified', async () => {
|
|
1345
1343
|
const searchService = new MockSearchService();
|
|
1346
|
-
const el = await fixture(html `<collection-browser
|
|
1347
|
-
.searchService=${searchService}
|
|
1348
|
-
facetLoadStrategy=${'opt-in'}
|
|
1349
|
-
>
|
|
1344
|
+
const el = await fixture(html `<collection-browser
|
|
1345
|
+
.searchService=${searchService}
|
|
1346
|
+
facetLoadStrategy=${'opt-in'}
|
|
1347
|
+
>
|
|
1350
1348
|
</collection-browser>`);
|
|
1351
1349
|
el.baseQuery = 'foo';
|
|
1352
1350
|
await el.updateComplete;
|
|
@@ -1356,10 +1354,10 @@ describe('Collection Browser', () => {
|
|
|
1356
1354
|
});
|
|
1357
1355
|
it('shows temporarily unavailable message when facets suppressed', async () => {
|
|
1358
1356
|
const searchService = new MockSearchService();
|
|
1359
|
-
const el = await fixture(html `<collection-browser
|
|
1360
|
-
.searchService=${searchService}
|
|
1361
|
-
facetLoadStrategy=${'off'}
|
|
1362
|
-
>
|
|
1357
|
+
const el = await fixture(html `<collection-browser
|
|
1358
|
+
.searchService=${searchService}
|
|
1359
|
+
facetLoadStrategy=${'off'}
|
|
1360
|
+
>
|
|
1363
1361
|
</collection-browser>`);
|
|
1364
1362
|
el.baseQuery = 'foo';
|
|
1365
1363
|
await el.updateComplete;
|
|
@@ -1370,7 +1368,7 @@ describe('Collection Browser', () => {
|
|
|
1370
1368
|
});
|
|
1371
1369
|
it('shows manage bar interface instead of sort bar when in manage view', async () => {
|
|
1372
1370
|
const searchService = new MockSearchService();
|
|
1373
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1371
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1374
1372
|
</collection-browser>`);
|
|
1375
1373
|
el.baseQuery = 'foo';
|
|
1376
1374
|
await el.updateComplete;
|
|
@@ -1386,11 +1384,11 @@ describe('Collection Browser', () => {
|
|
|
1386
1384
|
});
|
|
1387
1385
|
it('switches to grid display mode when manage view activated', async () => {
|
|
1388
1386
|
const searchService = new MockSearchService();
|
|
1389
|
-
const el = await fixture(html `<collection-browser
|
|
1390
|
-
.searchService=${searchService}
|
|
1391
|
-
.baseQuery=${'foo'}
|
|
1392
|
-
.displayMode=${'list-detail'}
|
|
1393
|
-
>
|
|
1387
|
+
const el = await fixture(html `<collection-browser
|
|
1388
|
+
.searchService=${searchService}
|
|
1389
|
+
.baseQuery=${'foo'}
|
|
1390
|
+
.displayMode=${'list-detail'}
|
|
1391
|
+
>
|
|
1394
1392
|
</collection-browser>`);
|
|
1395
1393
|
el.isManageView = true;
|
|
1396
1394
|
await el.updateComplete;
|
|
@@ -1398,10 +1396,10 @@ describe('Collection Browser', () => {
|
|
|
1398
1396
|
});
|
|
1399
1397
|
it('can remove all checked tiles', async () => {
|
|
1400
1398
|
const searchService = new MockSearchService();
|
|
1401
|
-
const el = await fixture(html `<collection-browser
|
|
1402
|
-
.searchService=${searchService}
|
|
1403
|
-
.baseNavigationUrl=${''}
|
|
1404
|
-
>
|
|
1399
|
+
const el = await fixture(html `<collection-browser
|
|
1400
|
+
.searchService=${searchService}
|
|
1401
|
+
.baseNavigationUrl=${''}
|
|
1402
|
+
>
|
|
1405
1403
|
</collection-browser>`);
|
|
1406
1404
|
el.baseQuery = 'foo';
|
|
1407
1405
|
el.pageSize = 1; // To hit the edge case of a page break while offsetting tiles
|
|
@@ -1439,10 +1437,10 @@ describe('Collection Browser', () => {
|
|
|
1439
1437
|
});
|
|
1440
1438
|
it('can check/uncheck all tiles', async () => {
|
|
1441
1439
|
const searchService = new MockSearchService();
|
|
1442
|
-
const el = await fixture(html `<collection-browser
|
|
1443
|
-
.searchService=${searchService}
|
|
1444
|
-
.baseNavigationUrl=${''}
|
|
1445
|
-
>
|
|
1440
|
+
const el = await fixture(html `<collection-browser
|
|
1441
|
+
.searchService=${searchService}
|
|
1442
|
+
.baseNavigationUrl=${''}
|
|
1443
|
+
>
|
|
1446
1444
|
</collection-browser>`);
|
|
1447
1445
|
el.baseQuery = 'foo';
|
|
1448
1446
|
await el.updateComplete;
|
|
@@ -1461,10 +1459,10 @@ describe('Collection Browser', () => {
|
|
|
1461
1459
|
it('emits event when manage view state changes', async () => {
|
|
1462
1460
|
const spy = sinon.spy();
|
|
1463
1461
|
const searchService = new MockSearchService();
|
|
1464
|
-
const el = await fixture(html `<collection-browser
|
|
1465
|
-
.searchService=${searchService}
|
|
1466
|
-
.baseNavigationUrl=${''}
|
|
1467
|
-
@manageModeChanged=${spy}
|
|
1462
|
+
const el = await fixture(html `<collection-browser
|
|
1463
|
+
.searchService=${searchService}
|
|
1464
|
+
.baseNavigationUrl=${''}
|
|
1465
|
+
@manageModeChanged=${spy}
|
|
1468
1466
|
></collection-browser>`);
|
|
1469
1467
|
el.isManageView = true;
|
|
1470
1468
|
await el.updateComplete;
|
|
@@ -1478,11 +1476,11 @@ describe('Collection Browser', () => {
|
|
|
1478
1476
|
it('emits event when item removal requested', async () => {
|
|
1479
1477
|
const spy = sinon.spy();
|
|
1480
1478
|
const searchService = new MockSearchService();
|
|
1481
|
-
const el = await fixture(html `<collection-browser
|
|
1482
|
-
.searchService=${searchService}
|
|
1483
|
-
.baseNavigationUrl=${''}
|
|
1484
|
-
@itemRemovalRequested=${spy}
|
|
1485
|
-
>
|
|
1479
|
+
const el = await fixture(html `<collection-browser
|
|
1480
|
+
.searchService=${searchService}
|
|
1481
|
+
.baseNavigationUrl=${''}
|
|
1482
|
+
@itemRemovalRequested=${spy}
|
|
1483
|
+
>
|
|
1486
1484
|
</collection-browser>`);
|
|
1487
1485
|
el.baseQuery = 'foo';
|
|
1488
1486
|
await el.updateComplete;
|
|
@@ -1511,10 +1509,10 @@ describe('Collection Browser', () => {
|
|
|
1511
1509
|
});
|
|
1512
1510
|
it('disables manage view when manage bar cancelled', async () => {
|
|
1513
1511
|
const searchService = new MockSearchService();
|
|
1514
|
-
const el = await fixture(html `<collection-browser
|
|
1515
|
-
.searchService=${searchService}
|
|
1516
|
-
.baseNavigationUrl=${''}
|
|
1517
|
-
>
|
|
1512
|
+
const el = await fixture(html `<collection-browser
|
|
1513
|
+
.searchService=${searchService}
|
|
1514
|
+
.baseNavigationUrl=${''}
|
|
1515
|
+
>
|
|
1518
1516
|
</collection-browser>`);
|
|
1519
1517
|
el.baseQuery = 'foo';
|
|
1520
1518
|
await el.updateComplete;
|
|
@@ -1530,7 +1528,7 @@ describe('Collection Browser', () => {
|
|
|
1530
1528
|
});
|
|
1531
1529
|
it('enable/disable manage view delete button when you selectAll/unselectAll', async () => {
|
|
1532
1530
|
const searchService = new MockSearchService();
|
|
1533
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1531
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1534
1532
|
</collection-browser>`);
|
|
1535
1533
|
el.baseQuery = 'foo';
|
|
1536
1534
|
await el.updateComplete;
|
|
@@ -1557,10 +1555,10 @@ describe('Collection Browser', () => {
|
|
|
1557
1555
|
});
|
|
1558
1556
|
it('shows Blurring checkbox for admin users', async () => {
|
|
1559
1557
|
const searchService = new MockSearchService();
|
|
1560
|
-
const el = await fixture(html `<collection-browser
|
|
1561
|
-
.baseNavigationUrl=${''}
|
|
1562
|
-
.searchService=${searchService}
|
|
1563
|
-
>
|
|
1558
|
+
const el = await fixture(html `<collection-browser
|
|
1559
|
+
.baseNavigationUrl=${''}
|
|
1560
|
+
.searchService=${searchService}
|
|
1561
|
+
>
|
|
1564
1562
|
</collection-browser>`);
|
|
1565
1563
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1566
1564
|
await el.updateComplete;
|
|
@@ -1571,10 +1569,10 @@ describe('Collection Browser', () => {
|
|
|
1571
1569
|
});
|
|
1572
1570
|
it('unchecks Blurring checkbox for admin users with blurring preference off', async () => {
|
|
1573
1571
|
const searchService = new MockSearchService();
|
|
1574
|
-
const el = await fixture(html `<collection-browser
|
|
1575
|
-
.baseNavigationUrl=${''}
|
|
1576
|
-
.searchService=${searchService}
|
|
1577
|
-
>
|
|
1572
|
+
const el = await fixture(html `<collection-browser
|
|
1573
|
+
.baseNavigationUrl=${''}
|
|
1574
|
+
.searchService=${searchService}
|
|
1575
|
+
>
|
|
1578
1576
|
</collection-browser>`);
|
|
1579
1577
|
el.baseQuery = 'archive-org-user-loggedin-noblur';
|
|
1580
1578
|
await el.updateComplete;
|
|
@@ -1585,10 +1583,10 @@ describe('Collection Browser', () => {
|
|
|
1585
1583
|
});
|
|
1586
1584
|
it('toggles blur state when Blurring checkbox is toggled', async () => {
|
|
1587
1585
|
const searchService = new MockSearchService();
|
|
1588
|
-
const el = await fixture(html `<collection-browser
|
|
1589
|
-
.baseNavigationUrl=${''}
|
|
1590
|
-
.searchService=${searchService}
|
|
1591
|
-
>
|
|
1586
|
+
const el = await fixture(html `<collection-browser
|
|
1587
|
+
.baseNavigationUrl=${''}
|
|
1588
|
+
.searchService=${searchService}
|
|
1589
|
+
>
|
|
1592
1590
|
</collection-browser>`);
|
|
1593
1591
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1594
1592
|
await el.updateComplete;
|
|
@@ -1603,11 +1601,11 @@ describe('Collection Browser', () => {
|
|
|
1603
1601
|
});
|
|
1604
1602
|
it('applies loans tab properties to sort bar', async () => {
|
|
1605
1603
|
const searchService = new MockSearchService();
|
|
1606
|
-
const el = await fixture(html `<collection-browser
|
|
1607
|
-
.baseNavigationUrl=${''}
|
|
1608
|
-
.searchService=${searchService}
|
|
1609
|
-
.enableSortOptionsSlot=${true}
|
|
1610
|
-
>
|
|
1604
|
+
const el = await fixture(html `<collection-browser
|
|
1605
|
+
.baseNavigationUrl=${''}
|
|
1606
|
+
.searchService=${searchService}
|
|
1607
|
+
.enableSortOptionsSlot=${true}
|
|
1608
|
+
>
|
|
1611
1609
|
</collection-browser>`);
|
|
1612
1610
|
el.baseQuery = 'collection:foo';
|
|
1613
1611
|
await el.updateComplete;
|
|
@@ -1621,9 +1619,9 @@ describe('Collection Browser', () => {
|
|
|
1621
1619
|
});
|
|
1622
1620
|
it('can suppress presence of result count', async () => {
|
|
1623
1621
|
const searchService = new MockSearchService();
|
|
1624
|
-
const el = await fixture(html `<collection-browser
|
|
1625
|
-
.searchService=${searchService}
|
|
1626
|
-
suppressResultCount
|
|
1622
|
+
const el = await fixture(html `<collection-browser
|
|
1623
|
+
.searchService=${searchService}
|
|
1624
|
+
suppressResultCount
|
|
1627
1625
|
></collection-browser>`);
|
|
1628
1626
|
el.baseQuery = 'collection:foo';
|
|
1629
1627
|
await el.updateComplete;
|
|
@@ -1633,9 +1631,9 @@ describe('Collection Browser', () => {
|
|
|
1633
1631
|
});
|
|
1634
1632
|
it('can suppress presence of result tiles', async () => {
|
|
1635
1633
|
const searchService = new MockSearchService();
|
|
1636
|
-
const el = await fixture(html `<collection-browser
|
|
1637
|
-
.searchService=${searchService}
|
|
1638
|
-
suppressResultTiles
|
|
1634
|
+
const el = await fixture(html `<collection-browser
|
|
1635
|
+
.searchService=${searchService}
|
|
1636
|
+
suppressResultTiles
|
|
1639
1637
|
></collection-browser>`);
|
|
1640
1638
|
el.baseQuery = 'collection:foo';
|
|
1641
1639
|
await el.updateComplete;
|
|
@@ -1648,7 +1646,7 @@ describe('Collection Browser', () => {
|
|
|
1648
1646
|
asyncResponse: true,
|
|
1649
1647
|
resultsSpy,
|
|
1650
1648
|
});
|
|
1651
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1649
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1652
1650
|
</collection-browser>`);
|
|
1653
1651
|
const numberOfPages = 15;
|
|
1654
1652
|
el.baseQuery = 'jack';
|