@internetarchive/collection-browser 2.22.1-alpha-webdev7818.4 → 2.22.1-alpha-webdev7761.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/dist/src/collection-browser.d.ts +12 -5
- package/dist/src/collection-browser.js +785 -691
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets.js +12 -0
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +10 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +19 -1
- package/dist/src/data-source/collection-browser-data-source.js +36 -18
- 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 -2
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.d.ts +11 -0
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/models.d.ts +2 -6
- package/dist/src/models.js +8 -12
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +1 -2
- package/dist/src/restoration-state-handler.js +3 -9
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js +45 -45
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +97 -97
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +289 -289
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/test/collection-browser.test.js +206 -196
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +5 -37
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +2848 -2755
- package/src/collection-facets.ts +11 -0
- package/src/data-source/collection-browser-data-source-interface.ts +345 -333
- package/src/data-source/collection-browser-data-source.ts +1432 -1390
- package/src/data-source/collection-browser-query-state.ts +1 -7
- package/src/data-source/models.ts +13 -0
- package/src/models.ts +10 -14
- package/src/restoration-state-handler.ts +9 -11
- package/src/tiles/list/tile-list-compact-header.ts +86 -86
- package/src/tiles/list/tile-list-compact.ts +236 -236
- package/src/tiles/list/tile-list.ts +688 -688
- package/test/collection-browser.test.ts +2369 -2359
- package/test/restoration-state-handler.test.ts +12 -42
|
@@ -250,25 +250,33 @@ describe('Restoration state handler', () => {
|
|
|
250
250
|
url.search = '?only_commercials=1';
|
|
251
251
|
window.history.replaceState({ path: url.href }, '', url.href);
|
|
252
252
|
const commercialsRestorationState = handler.getRestorationState();
|
|
253
|
-
expect(
|
|
253
|
+
expect(
|
|
254
|
+
commercialsRestorationState.selectedFacets.clip_type?.commercial.state,
|
|
255
|
+
).to.equal('selected');
|
|
254
256
|
|
|
255
257
|
// Fact checks
|
|
256
258
|
url.search = '?only_factchecks=1';
|
|
257
259
|
window.history.replaceState({ path: url.href }, '', url.href);
|
|
258
260
|
const factchecksRestorationState = handler.getRestorationState();
|
|
259
|
-
expect(
|
|
261
|
+
expect(
|
|
262
|
+
factchecksRestorationState.selectedFacets.clip_type?.['fact check'].state,
|
|
263
|
+
).to.equal('selected');
|
|
260
264
|
|
|
261
265
|
// Quotes
|
|
262
266
|
url.search = '?only_quotes=1';
|
|
263
267
|
window.history.replaceState({ path: url.href }, '', url.href);
|
|
264
268
|
const quotesRestorationState = handler.getRestorationState();
|
|
265
|
-
expect(
|
|
269
|
+
expect(
|
|
270
|
+
quotesRestorationState.selectedFacets.clip_type?.quote.state,
|
|
271
|
+
).to.equal('selected');
|
|
266
272
|
|
|
267
273
|
// No filter param
|
|
268
274
|
url.search = '';
|
|
269
275
|
window.history.replaceState({ path: url.href }, '', url.href);
|
|
270
276
|
const unfilteredRestorationState = handler.getRestorationState();
|
|
271
|
-
expect(unfilteredRestorationState.
|
|
277
|
+
expect(unfilteredRestorationState.selectedFacets.clip_type).to.deep.equal(
|
|
278
|
+
{},
|
|
279
|
+
);
|
|
272
280
|
});
|
|
273
281
|
|
|
274
282
|
it('should restore sort from URL (space format)', async () => {
|
|
@@ -402,44 +410,6 @@ describe('Restoration state handler', () => {
|
|
|
402
410
|
expect(window.location.search).to.equal('?page=2');
|
|
403
411
|
});
|
|
404
412
|
|
|
405
|
-
it('should persist TV clip filter types to the URL', async () => {
|
|
406
|
-
const url = new URL(window.location.href);
|
|
407
|
-
url.search = '';
|
|
408
|
-
window.history.replaceState({ path: url.href }, '', url.href);
|
|
409
|
-
|
|
410
|
-
// Commercials
|
|
411
|
-
const handler = new RestorationStateHandler({ context: 'search' });
|
|
412
|
-
handler.persistState({
|
|
413
|
-
tvClipFilter: 'commercials',
|
|
414
|
-
selectedFacets: getDefaultSelectedFacets(),
|
|
415
|
-
});
|
|
416
|
-
expect(window.location.search).to.equal('?only_commercials=1');
|
|
417
|
-
|
|
418
|
-
// Fact checks
|
|
419
|
-
window.history.replaceState({ path: url.href }, '', url.href);
|
|
420
|
-
handler.persistState({
|
|
421
|
-
tvClipFilter: 'factchecks',
|
|
422
|
-
selectedFacets: getDefaultSelectedFacets(),
|
|
423
|
-
});
|
|
424
|
-
expect(window.location.search).to.equal('?only_factchecks=1');
|
|
425
|
-
|
|
426
|
-
// Quotes
|
|
427
|
-
window.history.replaceState({ path: url.href }, '', url.href);
|
|
428
|
-
handler.persistState({
|
|
429
|
-
tvClipFilter: 'quotes',
|
|
430
|
-
selectedFacets: getDefaultSelectedFacets(),
|
|
431
|
-
});
|
|
432
|
-
expect(window.location.search).to.equal('?only_quotes=1');
|
|
433
|
-
|
|
434
|
-
// Unfiltered
|
|
435
|
-
window.history.replaceState({ path: url.href }, '', url.href);
|
|
436
|
-
handler.persistState({
|
|
437
|
-
tvClipFilter: 'all',
|
|
438
|
-
selectedFacets: getDefaultSelectedFacets(),
|
|
439
|
-
});
|
|
440
|
-
expect(window.location.search).to.equal('');
|
|
441
|
-
});
|
|
442
|
-
|
|
443
413
|
it('should upgrade legacy search params to new ones', async () => {
|
|
444
414
|
const url = new URL(window.location.href);
|
|
445
415
|
url.search = '?q=foo';
|