@internetarchive/collection-browser 4.1.0-alpha-webdev8186.4 → 4.1.0
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/.claude/settings.local.json +2 -1
- package/.husky/pre-commit +0 -3
- package/dist/src/collection-browser.js +761 -761
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +7 -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 +1 -0
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +0 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +280 -288
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/test/collection-browser.test.js +189 -189
- 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/package.json +2 -3
- package/src/collection-browser.ts +3070 -3071
- package/src/data-source/collection-browser-data-source.ts +1444 -1440
- package/src/data-source/collection-browser-query-state.ts +60 -59
- package/src/sort-filter-bar/sort-filter-bar.ts +733 -742
- package/test/collection-browser.test.ts +2402 -2402
- package/test/sort-filter-bar/sort-filter-bar.test.ts +443 -443
|
@@ -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;
|
|
@@ -900,9 +900,9 @@ describe('Collection Browser', () => {
|
|
|
900
900
|
});
|
|
901
901
|
it('sets default sort from collection metadata', 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
906
|
></collection-browser>`);
|
|
907
907
|
el.withinCollection = 'default-sort';
|
|
908
908
|
await el.updateComplete;
|
|
@@ -918,9 +918,9 @@ describe('Collection Browser', () => {
|
|
|
918
918
|
});
|
|
919
919
|
it('sets default sort from collection metadata in "-field" format', async () => {
|
|
920
920
|
const searchService = new MockSearchService();
|
|
921
|
-
const el = await fixture(html `<collection-browser
|
|
922
|
-
.searchService=${searchService}
|
|
923
|
-
.baseNavigationUrl=${''}
|
|
921
|
+
const el = await fixture(html `<collection-browser
|
|
922
|
+
.searchService=${searchService}
|
|
923
|
+
.baseNavigationUrl=${''}
|
|
924
924
|
></collection-browser>`);
|
|
925
925
|
el.withinCollection = 'default-sort-concise';
|
|
926
926
|
await el.updateComplete;
|
|
@@ -935,8 +935,8 @@ describe('Collection Browser', () => {
|
|
|
935
935
|
expect(sortBar.sortDirection).to.be.null;
|
|
936
936
|
});
|
|
937
937
|
it('falls back to weekly views default sorting on profiles when tab not set', async () => {
|
|
938
|
-
const el = await fixture(html `<collection-browser
|
|
939
|
-
.withinProfile=${'@foobar'}
|
|
938
|
+
const el = await fixture(html `<collection-browser
|
|
939
|
+
.withinProfile=${'@foobar'}
|
|
940
940
|
></collection-browser>`);
|
|
941
941
|
el.applyDefaultProfileSort();
|
|
942
942
|
expect(el.defaultSortParam).to.deep.equal({
|
|
@@ -946,9 +946,9 @@ describe('Collection Browser', () => {
|
|
|
946
946
|
});
|
|
947
947
|
it('uses relevance sort as default when a query is set', async () => {
|
|
948
948
|
const searchService = new MockSearchService();
|
|
949
|
-
const el = await fixture(html `<collection-browser
|
|
950
|
-
.searchService=${searchService}
|
|
951
|
-
.baseNavigationUrl=${''}
|
|
949
|
+
const el = await fixture(html `<collection-browser
|
|
950
|
+
.searchService=${searchService}
|
|
951
|
+
.baseNavigationUrl=${''}
|
|
952
952
|
></collection-browser>`);
|
|
953
953
|
el.withinCollection = 'default-sort';
|
|
954
954
|
el.baseQuery = 'default-sort';
|
|
@@ -965,9 +965,9 @@ describe('Collection Browser', () => {
|
|
|
965
965
|
});
|
|
966
966
|
it('uses date favorited sort as default when targeting fav- collection', async () => {
|
|
967
967
|
const searchService = new MockSearchService();
|
|
968
|
-
const el = await fixture(html `<collection-browser
|
|
969
|
-
.searchService=${searchService}
|
|
970
|
-
.baseNavigationUrl=${''}
|
|
968
|
+
const el = await fixture(html `<collection-browser
|
|
969
|
+
.searchService=${searchService}
|
|
970
|
+
.baseNavigationUrl=${''}
|
|
971
971
|
></collection-browser>`);
|
|
972
972
|
el.withinCollection = 'fav-sort';
|
|
973
973
|
await el.updateComplete;
|
|
@@ -983,7 +983,7 @@ describe('Collection Browser', () => {
|
|
|
983
983
|
});
|
|
984
984
|
it('scrolls to page', async () => {
|
|
985
985
|
const searchService = new MockSearchService();
|
|
986
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
986
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
987
987
|
</collection-browser>`);
|
|
988
988
|
// Infinite scroller won't exist unless there's a base query.
|
|
989
989
|
// First ensure that we don't throw errors when it doesn't exist.
|
|
@@ -1004,9 +1004,9 @@ describe('Collection Browser', () => {
|
|
|
1004
1004
|
});
|
|
1005
1005
|
it('shows mobile facets in mobile view', async () => {
|
|
1006
1006
|
const searchService = new MockSearchService();
|
|
1007
|
-
const el = await fixture(html `<collection-browser
|
|
1008
|
-
.searchService=${searchService}
|
|
1009
|
-
.mobileBreakpoint=${9999}
|
|
1007
|
+
const el = await fixture(html `<collection-browser
|
|
1008
|
+
.searchService=${searchService}
|
|
1009
|
+
.mobileBreakpoint=${9999}
|
|
1010
1010
|
></collection-browser>`);
|
|
1011
1011
|
el.baseQuery = 'collection:foo';
|
|
1012
1012
|
await el.updateComplete;
|
|
@@ -1025,11 +1025,11 @@ describe('Collection Browser', () => {
|
|
|
1025
1025
|
it('fires analytics when mobile facets toggled', async () => {
|
|
1026
1026
|
const searchService = new MockSearchService();
|
|
1027
1027
|
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}
|
|
1028
|
+
const el = await fixture(html `<collection-browser
|
|
1029
|
+
.searchService=${searchService}
|
|
1030
|
+
.analyticsHandler=${analyticsHandler}
|
|
1031
|
+
.searchContext=${'foobar-context'}
|
|
1032
|
+
.mobileBreakpoint=${9999}
|
|
1033
1033
|
></collection-browser>`);
|
|
1034
1034
|
el.baseQuery = 'collection:foo';
|
|
1035
1035
|
await el.updateComplete;
|
|
@@ -1069,9 +1069,9 @@ describe('Collection Browser', () => {
|
|
|
1069
1069
|
});
|
|
1070
1070
|
it('sets parent collections to prop when searching a collection', async () => {
|
|
1071
1071
|
const searchService = new MockSearchService();
|
|
1072
|
-
const el = await fixture(html `<collection-browser
|
|
1073
|
-
.searchService=${searchService}
|
|
1074
|
-
.withinCollection=${'fake'}
|
|
1072
|
+
const el = await fixture(html `<collection-browser
|
|
1073
|
+
.searchService=${searchService}
|
|
1074
|
+
.withinCollection=${'fake'}
|
|
1075
1075
|
></collection-browser>`);
|
|
1076
1076
|
el.baseQuery = 'parent-collections';
|
|
1077
1077
|
await el.updateComplete;
|
|
@@ -1081,9 +1081,9 @@ describe('Collection Browser', () => {
|
|
|
1081
1081
|
});
|
|
1082
1082
|
it('recognizes TV collections', async () => {
|
|
1083
1083
|
const searchService = new MockSearchService();
|
|
1084
|
-
const el = await fixture(html `<collection-browser
|
|
1085
|
-
.searchService=${searchService}
|
|
1086
|
-
.withinCollection=${'TV-FOO'}
|
|
1084
|
+
const el = await fixture(html `<collection-browser
|
|
1085
|
+
.searchService=${searchService}
|
|
1086
|
+
.withinCollection=${'TV-FOO'}
|
|
1087
1087
|
></collection-browser>`);
|
|
1088
1088
|
el.baseQuery = 'tv-collection';
|
|
1089
1089
|
await el.updateComplete;
|
|
@@ -1094,9 +1094,9 @@ describe('Collection Browser', () => {
|
|
|
1094
1094
|
it('refreshes when certain properties change - with some analytics event sampling', async () => {
|
|
1095
1095
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
1096
1096
|
const searchService = new MockSearchService();
|
|
1097
|
-
const el = await fixture(html `<collection-browser
|
|
1098
|
-
.analyticsHandler=${mockAnalyticsHandler}
|
|
1099
|
-
.searchService=${searchService}
|
|
1097
|
+
const el = await fixture(html `<collection-browser
|
|
1098
|
+
.analyticsHandler=${mockAnalyticsHandler}
|
|
1099
|
+
.searchService=${searchService}
|
|
1100
1100
|
></collection-browser>`);
|
|
1101
1101
|
const infiniteScrollerRefreshSpy = sinon.spy();
|
|
1102
1102
|
// Infinite scroller won't exist unless there's a base query
|
|
@@ -1141,7 +1141,7 @@ describe('Collection Browser', () => {
|
|
|
1141
1141
|
});
|
|
1142
1142
|
it('query the search service for single result', async () => {
|
|
1143
1143
|
const searchService = new MockSearchService();
|
|
1144
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1144
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1145
1145
|
</collection-browser>`);
|
|
1146
1146
|
el.baseQuery = 'single-result';
|
|
1147
1147
|
await el.updateComplete;
|
|
@@ -1169,7 +1169,7 @@ describe('Collection Browser', () => {
|
|
|
1169
1169
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1170
1170
|
window.history.replaceState({}, '', url);
|
|
1171
1171
|
const searchService = new MockSearchService();
|
|
1172
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1172
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1173
1173
|
</collection-browser>`);
|
|
1174
1174
|
await el.initialSearchComplete;
|
|
1175
1175
|
await el.updateComplete;
|
|
@@ -1194,10 +1194,10 @@ describe('Collection Browser', () => {
|
|
|
1194
1194
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1195
1195
|
window.history.replaceState({}, '', url);
|
|
1196
1196
|
const searchService = new MockSearchService();
|
|
1197
|
-
const el = await fixture(html `<collection-browser
|
|
1198
|
-
.searchService=${searchService}
|
|
1199
|
-
.withinCollection=${'foobar'}
|
|
1200
|
-
>
|
|
1197
|
+
const el = await fixture(html `<collection-browser
|
|
1198
|
+
.searchService=${searchService}
|
|
1199
|
+
.withinCollection=${'foobar'}
|
|
1200
|
+
>
|
|
1201
1201
|
</collection-browser>`);
|
|
1202
1202
|
await el.initialSearchComplete;
|
|
1203
1203
|
await el.updateComplete;
|
|
@@ -1221,11 +1221,11 @@ describe('Collection Browser', () => {
|
|
|
1221
1221
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1222
1222
|
window.history.replaceState({}, '', url);
|
|
1223
1223
|
const searchService = new MockSearchService();
|
|
1224
|
-
const el = await fixture(html `<collection-browser
|
|
1225
|
-
.searchService=${searchService}
|
|
1226
|
-
.withinProfile=${'@foobar'}
|
|
1227
|
-
.profileElement=${'uploads'}
|
|
1228
|
-
>
|
|
1224
|
+
const el = await fixture(html `<collection-browser
|
|
1225
|
+
.searchService=${searchService}
|
|
1226
|
+
.withinProfile=${'@foobar'}
|
|
1227
|
+
.profileElement=${'uploads'}
|
|
1228
|
+
>
|
|
1229
1229
|
</collection-browser>`);
|
|
1230
1230
|
await el.initialSearchComplete;
|
|
1231
1231
|
await el.updateComplete;
|
|
@@ -1251,7 +1251,7 @@ describe('Collection Browser', () => {
|
|
|
1251
1251
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1252
1252
|
window.history.replaceState({}, '', url);
|
|
1253
1253
|
const searchService = new MockSearchService();
|
|
1254
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1254
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1255
1255
|
</collection-browser>`);
|
|
1256
1256
|
await el.initialSearchComplete;
|
|
1257
1257
|
await el.updateComplete;
|
|
@@ -1278,10 +1278,10 @@ describe('Collection Browser', () => {
|
|
|
1278
1278
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1279
1279
|
window.history.replaceState({}, '', url);
|
|
1280
1280
|
const searchService = new MockSearchService();
|
|
1281
|
-
const el = await fixture(html `<collection-browser
|
|
1282
|
-
.searchService=${searchService}
|
|
1283
|
-
.withinCollection=${'foobar'}
|
|
1284
|
-
>
|
|
1281
|
+
const el = await fixture(html `<collection-browser
|
|
1282
|
+
.searchService=${searchService}
|
|
1283
|
+
.withinCollection=${'foobar'}
|
|
1284
|
+
>
|
|
1285
1285
|
</collection-browser>`);
|
|
1286
1286
|
el.baseQuery = 'bar';
|
|
1287
1287
|
await el.updateComplete;
|
|
@@ -1307,10 +1307,10 @@ describe('Collection Browser', () => {
|
|
|
1307
1307
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1308
1308
|
window.history.replaceState({}, '', url);
|
|
1309
1309
|
const searchService = new MockSearchService();
|
|
1310
|
-
const el = await fixture(html `<collection-browser
|
|
1311
|
-
.searchService=${searchService}
|
|
1312
|
-
.withinCollection=${'foobar'}
|
|
1313
|
-
>
|
|
1310
|
+
const el = await fixture(html `<collection-browser
|
|
1311
|
+
.searchService=${searchService}
|
|
1312
|
+
.withinCollection=${'foobar'}
|
|
1313
|
+
>
|
|
1314
1314
|
</collection-browser>`);
|
|
1315
1315
|
el.withinCollection = 'bar';
|
|
1316
1316
|
await el.updateComplete;
|
|
@@ -1326,11 +1326,11 @@ describe('Collection Browser', () => {
|
|
|
1326
1326
|
});
|
|
1327
1327
|
it('correctly retrieves web archive hits', async () => {
|
|
1328
1328
|
const searchService = new MockSearchService();
|
|
1329
|
-
const el = await fixture(html `<collection-browser
|
|
1330
|
-
.searchService=${searchService}
|
|
1331
|
-
.withinProfile=${'@foo'}
|
|
1332
|
-
.profileElement=${'web_archives'}
|
|
1333
|
-
>
|
|
1329
|
+
const el = await fixture(html `<collection-browser
|
|
1330
|
+
.searchService=${searchService}
|
|
1331
|
+
.withinProfile=${'@foo'}
|
|
1332
|
+
.profileElement=${'web_archives'}
|
|
1333
|
+
>
|
|
1334
1334
|
</collection-browser>`);
|
|
1335
1335
|
el.baseQuery = 'web-archive';
|
|
1336
1336
|
await el.updateComplete;
|
|
@@ -1343,10 +1343,10 @@ describe('Collection Browser', () => {
|
|
|
1343
1343
|
});
|
|
1344
1344
|
it('shows dropdown accordion in facet sidebar when opt-in strategy is specified', async () => {
|
|
1345
1345
|
const searchService = new MockSearchService();
|
|
1346
|
-
const el = await fixture(html `<collection-browser
|
|
1347
|
-
.searchService=${searchService}
|
|
1348
|
-
facetLoadStrategy=${'opt-in'}
|
|
1349
|
-
>
|
|
1346
|
+
const el = await fixture(html `<collection-browser
|
|
1347
|
+
.searchService=${searchService}
|
|
1348
|
+
facetLoadStrategy=${'opt-in'}
|
|
1349
|
+
>
|
|
1350
1350
|
</collection-browser>`);
|
|
1351
1351
|
el.baseQuery = 'foo';
|
|
1352
1352
|
await el.updateComplete;
|
|
@@ -1356,10 +1356,10 @@ describe('Collection Browser', () => {
|
|
|
1356
1356
|
});
|
|
1357
1357
|
it('shows temporarily unavailable message when facets suppressed', async () => {
|
|
1358
1358
|
const searchService = new MockSearchService();
|
|
1359
|
-
const el = await fixture(html `<collection-browser
|
|
1360
|
-
.searchService=${searchService}
|
|
1361
|
-
facetLoadStrategy=${'off'}
|
|
1362
|
-
>
|
|
1359
|
+
const el = await fixture(html `<collection-browser
|
|
1360
|
+
.searchService=${searchService}
|
|
1361
|
+
facetLoadStrategy=${'off'}
|
|
1362
|
+
>
|
|
1363
1363
|
</collection-browser>`);
|
|
1364
1364
|
el.baseQuery = 'foo';
|
|
1365
1365
|
await el.updateComplete;
|
|
@@ -1370,7 +1370,7 @@ describe('Collection Browser', () => {
|
|
|
1370
1370
|
});
|
|
1371
1371
|
it('shows manage bar interface instead of sort bar when in manage view', async () => {
|
|
1372
1372
|
const searchService = new MockSearchService();
|
|
1373
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1373
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1374
1374
|
</collection-browser>`);
|
|
1375
1375
|
el.baseQuery = 'foo';
|
|
1376
1376
|
await el.updateComplete;
|
|
@@ -1386,11 +1386,11 @@ describe('Collection Browser', () => {
|
|
|
1386
1386
|
});
|
|
1387
1387
|
it('switches to grid display mode when manage view activated', async () => {
|
|
1388
1388
|
const searchService = new MockSearchService();
|
|
1389
|
-
const el = await fixture(html `<collection-browser
|
|
1390
|
-
.searchService=${searchService}
|
|
1391
|
-
.baseQuery=${'foo'}
|
|
1392
|
-
.displayMode=${'list-detail'}
|
|
1393
|
-
>
|
|
1389
|
+
const el = await fixture(html `<collection-browser
|
|
1390
|
+
.searchService=${searchService}
|
|
1391
|
+
.baseQuery=${'foo'}
|
|
1392
|
+
.displayMode=${'list-detail'}
|
|
1393
|
+
>
|
|
1394
1394
|
</collection-browser>`);
|
|
1395
1395
|
el.isManageView = true;
|
|
1396
1396
|
await el.updateComplete;
|
|
@@ -1398,10 +1398,10 @@ describe('Collection Browser', () => {
|
|
|
1398
1398
|
});
|
|
1399
1399
|
it('can remove all checked tiles', async () => {
|
|
1400
1400
|
const searchService = new MockSearchService();
|
|
1401
|
-
const el = await fixture(html `<collection-browser
|
|
1402
|
-
.searchService=${searchService}
|
|
1403
|
-
.baseNavigationUrl=${''}
|
|
1404
|
-
>
|
|
1401
|
+
const el = await fixture(html `<collection-browser
|
|
1402
|
+
.searchService=${searchService}
|
|
1403
|
+
.baseNavigationUrl=${''}
|
|
1404
|
+
>
|
|
1405
1405
|
</collection-browser>`);
|
|
1406
1406
|
el.baseQuery = 'foo';
|
|
1407
1407
|
el.pageSize = 1; // To hit the edge case of a page break while offsetting tiles
|
|
@@ -1439,10 +1439,10 @@ describe('Collection Browser', () => {
|
|
|
1439
1439
|
});
|
|
1440
1440
|
it('can check/uncheck all tiles', async () => {
|
|
1441
1441
|
const searchService = new MockSearchService();
|
|
1442
|
-
const el = await fixture(html `<collection-browser
|
|
1443
|
-
.searchService=${searchService}
|
|
1444
|
-
.baseNavigationUrl=${''}
|
|
1445
|
-
>
|
|
1442
|
+
const el = await fixture(html `<collection-browser
|
|
1443
|
+
.searchService=${searchService}
|
|
1444
|
+
.baseNavigationUrl=${''}
|
|
1445
|
+
>
|
|
1446
1446
|
</collection-browser>`);
|
|
1447
1447
|
el.baseQuery = 'foo';
|
|
1448
1448
|
await el.updateComplete;
|
|
@@ -1461,10 +1461,10 @@ describe('Collection Browser', () => {
|
|
|
1461
1461
|
it('emits event when manage view state changes', async () => {
|
|
1462
1462
|
const spy = sinon.spy();
|
|
1463
1463
|
const searchService = new MockSearchService();
|
|
1464
|
-
const el = await fixture(html `<collection-browser
|
|
1465
|
-
.searchService=${searchService}
|
|
1466
|
-
.baseNavigationUrl=${''}
|
|
1467
|
-
@manageModeChanged=${spy}
|
|
1464
|
+
const el = await fixture(html `<collection-browser
|
|
1465
|
+
.searchService=${searchService}
|
|
1466
|
+
.baseNavigationUrl=${''}
|
|
1467
|
+
@manageModeChanged=${spy}
|
|
1468
1468
|
></collection-browser>`);
|
|
1469
1469
|
el.isManageView = true;
|
|
1470
1470
|
await el.updateComplete;
|
|
@@ -1478,11 +1478,11 @@ describe('Collection Browser', () => {
|
|
|
1478
1478
|
it('emits event when item removal requested', async () => {
|
|
1479
1479
|
const spy = sinon.spy();
|
|
1480
1480
|
const searchService = new MockSearchService();
|
|
1481
|
-
const el = await fixture(html `<collection-browser
|
|
1482
|
-
.searchService=${searchService}
|
|
1483
|
-
.baseNavigationUrl=${''}
|
|
1484
|
-
@itemRemovalRequested=${spy}
|
|
1485
|
-
>
|
|
1481
|
+
const el = await fixture(html `<collection-browser
|
|
1482
|
+
.searchService=${searchService}
|
|
1483
|
+
.baseNavigationUrl=${''}
|
|
1484
|
+
@itemRemovalRequested=${spy}
|
|
1485
|
+
>
|
|
1486
1486
|
</collection-browser>`);
|
|
1487
1487
|
el.baseQuery = 'foo';
|
|
1488
1488
|
await el.updateComplete;
|
|
@@ -1511,10 +1511,10 @@ describe('Collection Browser', () => {
|
|
|
1511
1511
|
});
|
|
1512
1512
|
it('disables manage view when manage bar cancelled', async () => {
|
|
1513
1513
|
const searchService = new MockSearchService();
|
|
1514
|
-
const el = await fixture(html `<collection-browser
|
|
1515
|
-
.searchService=${searchService}
|
|
1516
|
-
.baseNavigationUrl=${''}
|
|
1517
|
-
>
|
|
1514
|
+
const el = await fixture(html `<collection-browser
|
|
1515
|
+
.searchService=${searchService}
|
|
1516
|
+
.baseNavigationUrl=${''}
|
|
1517
|
+
>
|
|
1518
1518
|
</collection-browser>`);
|
|
1519
1519
|
el.baseQuery = 'foo';
|
|
1520
1520
|
await el.updateComplete;
|
|
@@ -1530,7 +1530,7 @@ describe('Collection Browser', () => {
|
|
|
1530
1530
|
});
|
|
1531
1531
|
it('enable/disable manage view delete button when you selectAll/unselectAll', async () => {
|
|
1532
1532
|
const searchService = new MockSearchService();
|
|
1533
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1533
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1534
1534
|
</collection-browser>`);
|
|
1535
1535
|
el.baseQuery = 'foo';
|
|
1536
1536
|
await el.updateComplete;
|
|
@@ -1557,10 +1557,10 @@ describe('Collection Browser', () => {
|
|
|
1557
1557
|
});
|
|
1558
1558
|
it('shows Blurring checkbox for admin users', async () => {
|
|
1559
1559
|
const searchService = new MockSearchService();
|
|
1560
|
-
const el = await fixture(html `<collection-browser
|
|
1561
|
-
.baseNavigationUrl=${''}
|
|
1562
|
-
.searchService=${searchService}
|
|
1563
|
-
>
|
|
1560
|
+
const el = await fixture(html `<collection-browser
|
|
1561
|
+
.baseNavigationUrl=${''}
|
|
1562
|
+
.searchService=${searchService}
|
|
1563
|
+
>
|
|
1564
1564
|
</collection-browser>`);
|
|
1565
1565
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1566
1566
|
await el.updateComplete;
|
|
@@ -1571,10 +1571,10 @@ describe('Collection Browser', () => {
|
|
|
1571
1571
|
});
|
|
1572
1572
|
it('unchecks Blurring checkbox for admin users with blurring preference off', async () => {
|
|
1573
1573
|
const searchService = new MockSearchService();
|
|
1574
|
-
const el = await fixture(html `<collection-browser
|
|
1575
|
-
.baseNavigationUrl=${''}
|
|
1576
|
-
.searchService=${searchService}
|
|
1577
|
-
>
|
|
1574
|
+
const el = await fixture(html `<collection-browser
|
|
1575
|
+
.baseNavigationUrl=${''}
|
|
1576
|
+
.searchService=${searchService}
|
|
1577
|
+
>
|
|
1578
1578
|
</collection-browser>`);
|
|
1579
1579
|
el.baseQuery = 'archive-org-user-loggedin-noblur';
|
|
1580
1580
|
await el.updateComplete;
|
|
@@ -1585,10 +1585,10 @@ describe('Collection Browser', () => {
|
|
|
1585
1585
|
});
|
|
1586
1586
|
it('toggles blur state when Blurring checkbox is toggled', async () => {
|
|
1587
1587
|
const searchService = new MockSearchService();
|
|
1588
|
-
const el = await fixture(html `<collection-browser
|
|
1589
|
-
.baseNavigationUrl=${''}
|
|
1590
|
-
.searchService=${searchService}
|
|
1591
|
-
>
|
|
1588
|
+
const el = await fixture(html `<collection-browser
|
|
1589
|
+
.baseNavigationUrl=${''}
|
|
1590
|
+
.searchService=${searchService}
|
|
1591
|
+
>
|
|
1592
1592
|
</collection-browser>`);
|
|
1593
1593
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1594
1594
|
await el.updateComplete;
|
|
@@ -1603,11 +1603,11 @@ describe('Collection Browser', () => {
|
|
|
1603
1603
|
});
|
|
1604
1604
|
it('applies loans tab properties to sort bar', async () => {
|
|
1605
1605
|
const searchService = new MockSearchService();
|
|
1606
|
-
const el = await fixture(html `<collection-browser
|
|
1607
|
-
.baseNavigationUrl=${''}
|
|
1608
|
-
.searchService=${searchService}
|
|
1609
|
-
.enableSortOptionsSlot=${true}
|
|
1610
|
-
>
|
|
1606
|
+
const el = await fixture(html `<collection-browser
|
|
1607
|
+
.baseNavigationUrl=${''}
|
|
1608
|
+
.searchService=${searchService}
|
|
1609
|
+
.enableSortOptionsSlot=${true}
|
|
1610
|
+
>
|
|
1611
1611
|
</collection-browser>`);
|
|
1612
1612
|
el.baseQuery = 'collection:foo';
|
|
1613
1613
|
await el.updateComplete;
|
|
@@ -1621,9 +1621,9 @@ describe('Collection Browser', () => {
|
|
|
1621
1621
|
});
|
|
1622
1622
|
it('can suppress presence of result count', async () => {
|
|
1623
1623
|
const searchService = new MockSearchService();
|
|
1624
|
-
const el = await fixture(html `<collection-browser
|
|
1625
|
-
.searchService=${searchService}
|
|
1626
|
-
suppressResultCount
|
|
1624
|
+
const el = await fixture(html `<collection-browser
|
|
1625
|
+
.searchService=${searchService}
|
|
1626
|
+
suppressResultCount
|
|
1627
1627
|
></collection-browser>`);
|
|
1628
1628
|
el.baseQuery = 'collection:foo';
|
|
1629
1629
|
await el.updateComplete;
|
|
@@ -1633,9 +1633,9 @@ describe('Collection Browser', () => {
|
|
|
1633
1633
|
});
|
|
1634
1634
|
it('can suppress presence of result tiles', async () => {
|
|
1635
1635
|
const searchService = new MockSearchService();
|
|
1636
|
-
const el = await fixture(html `<collection-browser
|
|
1637
|
-
.searchService=${searchService}
|
|
1638
|
-
suppressResultTiles
|
|
1636
|
+
const el = await fixture(html `<collection-browser
|
|
1637
|
+
.searchService=${searchService}
|
|
1638
|
+
suppressResultTiles
|
|
1639
1639
|
></collection-browser>`);
|
|
1640
1640
|
el.baseQuery = 'collection:foo';
|
|
1641
1641
|
await el.updateComplete;
|
|
@@ -1648,7 +1648,7 @@ describe('Collection Browser', () => {
|
|
|
1648
1648
|
asyncResponse: true,
|
|
1649
1649
|
resultsSpy,
|
|
1650
1650
|
});
|
|
1651
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1651
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1652
1652
|
</collection-browser>`);
|
|
1653
1653
|
const numberOfPages = 15;
|
|
1654
1654
|
el.baseQuery = 'jack';
|