@internetarchive/collection-browser 3.4.1-alpha-webdev7761.2 → 3.4.1-alpha-webdev7761.4
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/app-root.js +19 -28
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +14 -10
- package/dist/src/collection-browser.js +870 -886
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +3 -4
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/models.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.js +145 -156
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +6 -10
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +16 -21
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +7 -10
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js +3 -2
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +9 -11
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +7 -7
- package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.js +4 -6
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.js +34 -50
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/combo-box/caret-closed.js +5 -11
- package/dist/src/combo-box/caret-closed.js.map +1 -1
- package/dist/src/combo-box/caret-open.js +5 -11
- package/dist/src/combo-box/caret-open.js.map +1 -1
- package/dist/src/combo-box/clear.d.ts +2 -0
- package/dist/src/combo-box/clear.js +11 -0
- package/dist/src/combo-box/clear.js.map +1 -0
- package/dist/src/combo-box/ia-combo-box.d.ts +40 -9
- package/dist/src/combo-box/ia-combo-box.js +363 -272
- package/dist/src/combo-box/ia-combo-box.js.map +1 -1
- package/dist/src/combo-box/models.d.ts +14 -0
- package/dist/src/combo-box/models.js +32 -1
- package/dist/src/combo-box/models.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +35 -47
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/empty-placeholder.js +19 -18
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/expanded-date-picker.js +6 -10
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/language-code-handler/language-code-handler.js +2 -2
- package/dist/src/language-code-handler/language-code-handler.js.map +1 -1
- package/dist/src/manage/manage-bar.js +86 -92
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/manage/remove-items-modal-content.js +2 -2
- package/dist/src/manage/remove-items-modal-content.js.map +1 -1
- package/dist/src/models.js +36 -40
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.js +9 -10
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +9 -14
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +14 -24
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js +1 -2
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -38
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +79 -82
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +154 -164
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +42 -43
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +2 -3
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +42 -49
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.js +113 -114
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/image-block.js +5 -8
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.js +12 -19
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +114 -122
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +326 -347
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.js +1 -2
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js +2 -4
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.js +2 -4
- package/dist/src/tiles/text-snippet-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +233 -241
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js +5 -9
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/tiles/tile-mediatype-icon.js +12 -19
- package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
- package/dist/src/utils/collapse-repeated-quotes.js +1 -1
- package/dist/src/utils/collapse-repeated-quotes.js.map +1 -1
- package/dist/src/utils/facet-utils.js +3 -5
- package/dist/src/utils/facet-utils.js.map +1 -1
- package/dist/src/utils/format-count.js +10 -10
- package/dist/src/utils/format-count.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/src/utils/resolve-mediatype.js +2 -3
- package/dist/src/utils/resolve-mediatype.js.map +1 -1
- package/dist/test/collection-browser.test.js +131 -185
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +60 -75
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.js +17 -23
- package/dist/test/collection-facets/facets-template.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +22 -32
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +16 -22
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +22 -19
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +80 -97
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.js +11 -17
- package/dist/test/empty-placeholder.test.js.map +1 -1
- package/dist/test/expanded-date-picker.test.js +8 -14
- package/dist/test/expanded-date-picker.test.js.map +1 -1
- package/dist/test/icon-overlay.test.js +7 -6
- package/dist/test/icon-overlay.test.js.map +1 -1
- package/dist/test/image-block.test.js +16 -26
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +23 -32
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.js +21 -33
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/manage/remove-items-modal-content.test.js +10 -15
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js +2 -3
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +13 -21
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/review-block.test.js +16 -18
- package/dist/test/review-block.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +2 -3
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +18 -24
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +178 -180
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.js +16 -15
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.js +14 -19
- package/dist/test/text-snippet-block.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +73 -34
- package/dist/test/tile-stats.test.js.map +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +25 -25
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +13 -19
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +141 -168
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +9 -13
- package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +50 -62
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +12 -16
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +104 -118
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +202 -231
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +97 -110
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/tiles/tile-mediatype-icon.test.js +12 -24
- package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/index.html +1 -1
- package/package.json +5 -3
- package/src/collection-browser.ts +3060 -3030
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/more-facets-content.ts +639 -639
- package/src/collection-facets.ts +1 -1
- package/src/combo-box/caret-closed.ts +5 -11
- package/src/combo-box/caret-open.ts +5 -11
- package/src/combo-box/clear.ts +11 -0
- package/src/combo-box/ia-combo-box.ts +1288 -1180
- package/src/combo-box/models.ts +31 -1
- package/src/manage/manage-bar.ts +247 -247
- package/src/restoration-state-handler.ts +5 -1
- package/src/tiles/base-tile-component.ts +65 -65
- package/src/tiles/grid/account-tile.ts +113 -113
- package/src/tiles/grid/collection-tile.ts +163 -163
- package/src/tiles/grid/item-tile.ts +340 -340
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/src/tiles/hover/hover-pane-controller.ts +613 -613
- package/src/tiles/hover/tile-hover-pane.ts +184 -184
- package/src/tiles/list/tile-list-compact.ts +239 -239
- package/src/tiles/list/tile-list.ts +700 -700
- package/src/tiles/tile-dispatcher.ts +517 -517
- package/src/utils/format-date.ts +62 -62
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/tiles/grid/item-tile.test.ts +520 -520
- package/test/tiles/hover/hover-pane-controller.test.ts +418 -418
- package/test/tiles/list/tile-list-compact.test.ts +282 -282
- package/test/tiles/list/tile-list.test.ts +552 -552
- package/test/tiles/tile-dispatcher.test.ts +283 -283
- package/test/utils/format-date.test.ts +89 -89
- package/tsconfig.json +8 -3
- package/vite.config.ts +29 -22
|
@@ -202,47 +202,43 @@ describe('Collection Browser', () => {
|
|
|
202
202
|
expect(mockAnalyticsHandler.callLabel).to.equal('mediatype');
|
|
203
203
|
});
|
|
204
204
|
it('should render with a sort bar, facets, and infinite scroller', async () => {
|
|
205
|
-
var _a, _b, _c;
|
|
206
205
|
const searchService = new MockSearchService();
|
|
207
206
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
208
207
|
</collection-browser>`);
|
|
209
208
|
el.baseQuery = 'hello';
|
|
210
209
|
await el.updateComplete;
|
|
211
210
|
await nextTick();
|
|
212
|
-
const facets =
|
|
213
|
-
const sortBar =
|
|
214
|
-
const infiniteScroller =
|
|
211
|
+
const facets = el.shadowRoot?.querySelector('collection-facets');
|
|
212
|
+
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
213
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
215
214
|
expect(facets, 'facets').to.exist;
|
|
216
215
|
expect(sortBar, 'sort bar').to.exist;
|
|
217
216
|
expect(infiniteScroller, 'infinite scroller').to.exist;
|
|
218
217
|
});
|
|
219
218
|
it('queries the search service when given a base query', async () => {
|
|
220
|
-
var _a, _b, _c;
|
|
221
219
|
const searchService = new MockSearchService();
|
|
222
220
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
223
221
|
</collection-browser>`);
|
|
224
222
|
el.baseQuery = 'collection:foo';
|
|
225
223
|
await el.updateComplete;
|
|
226
224
|
await el.initialSearchComplete;
|
|
227
|
-
expect(
|
|
228
|
-
expect(
|
|
225
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
226
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Results');
|
|
229
227
|
});
|
|
230
228
|
it('queries the search service when given a list of identifiers and no query', async () => {
|
|
231
|
-
var _a, _b, _c;
|
|
232
229
|
const searchService = new MockSearchService();
|
|
233
230
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
234
231
|
</collection-browser>`);
|
|
235
232
|
el.identifiers = ['foo', 'bar'];
|
|
236
233
|
await el.updateComplete;
|
|
237
234
|
await el.initialSearchComplete;
|
|
238
|
-
expect(
|
|
235
|
+
expect(searchService.searchParams?.identifiers).to.deep.equal([
|
|
239
236
|
'foo',
|
|
240
237
|
'bar',
|
|
241
238
|
]);
|
|
242
|
-
expect(
|
|
239
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Results');
|
|
243
240
|
});
|
|
244
241
|
it('queries the search service when given a list of identifiers with a query', async () => {
|
|
245
|
-
var _a, _b, _c, _d;
|
|
246
242
|
const searchService = new MockSearchService();
|
|
247
243
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
248
244
|
</collection-browser>`);
|
|
@@ -250,15 +246,14 @@ describe('Collection Browser', () => {
|
|
|
250
246
|
el.identifiers = ['foo', 'bar'];
|
|
251
247
|
await el.updateComplete;
|
|
252
248
|
await el.initialSearchComplete;
|
|
253
|
-
expect(
|
|
254
|
-
expect(
|
|
249
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
250
|
+
expect(searchService.searchParams?.identifiers).to.deep.equal([
|
|
255
251
|
'foo',
|
|
256
252
|
'bar',
|
|
257
253
|
]);
|
|
258
|
-
expect(
|
|
254
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Results');
|
|
259
255
|
});
|
|
260
256
|
it('queries the search service with a metadata search', async () => {
|
|
261
|
-
var _a, _b, _c;
|
|
262
257
|
const searchService = new MockSearchService();
|
|
263
258
|
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
264
259
|
</collection-browser>`);
|
|
@@ -267,9 +262,9 @@ describe('Collection Browser', () => {
|
|
|
267
262
|
el.baseQuery = 'collection:foo';
|
|
268
263
|
await el.updateComplete;
|
|
269
264
|
await el.initialSearchComplete;
|
|
270
|
-
expect(
|
|
265
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
271
266
|
expect(searchService.searchType).to.equal(SearchType.METADATA);
|
|
272
|
-
expect(
|
|
267
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Results');
|
|
273
268
|
});
|
|
274
269
|
it('can change search type', async () => {
|
|
275
270
|
const searchService = new MockSearchService();
|
|
@@ -283,7 +278,6 @@ describe('Collection Browser', () => {
|
|
|
283
278
|
expect(searchService.searchType).to.equal(SearchType.FULLTEXT);
|
|
284
279
|
});
|
|
285
280
|
it('queries the search service with a fulltext search', async () => {
|
|
286
|
-
var _a, _b, _c;
|
|
287
281
|
const searchService = new MockSearchService();
|
|
288
282
|
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
289
283
|
</collection-browser>`);
|
|
@@ -292,12 +286,11 @@ describe('Collection Browser', () => {
|
|
|
292
286
|
el.baseQuery = 'collection:foo';
|
|
293
287
|
await el.updateComplete;
|
|
294
288
|
await el.initialSearchComplete;
|
|
295
|
-
expect(
|
|
289
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
296
290
|
expect(searchService.searchType).to.equal(SearchType.FULLTEXT);
|
|
297
|
-
expect(
|
|
291
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Results');
|
|
298
292
|
});
|
|
299
293
|
it('queries the search service with a radio search', async () => {
|
|
300
|
-
var _a, _b, _c;
|
|
301
294
|
const searchService = new MockSearchService();
|
|
302
295
|
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
303
296
|
</collection-browser>`);
|
|
@@ -306,12 +299,11 @@ describe('Collection Browser', () => {
|
|
|
306
299
|
el.baseQuery = 'collection:foo';
|
|
307
300
|
await el.updateComplete;
|
|
308
301
|
await el.initialSearchComplete;
|
|
309
|
-
expect(
|
|
302
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
310
303
|
expect(searchService.searchType).to.equal(SearchType.RADIO);
|
|
311
|
-
expect(
|
|
304
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Results');
|
|
312
305
|
});
|
|
313
306
|
it('queries the search service with a TV search', async () => {
|
|
314
|
-
var _a, _b, _c;
|
|
315
307
|
const searchService = new MockSearchService();
|
|
316
308
|
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
317
309
|
</collection-browser>`);
|
|
@@ -320,12 +312,11 @@ describe('Collection Browser', () => {
|
|
|
320
312
|
el.baseQuery = 'collection:foo';
|
|
321
313
|
await el.updateComplete;
|
|
322
314
|
await el.initialSearchComplete;
|
|
323
|
-
expect(
|
|
315
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
324
316
|
expect(searchService.searchType).to.equal(SearchType.TV);
|
|
325
|
-
expect(
|
|
317
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Results');
|
|
326
318
|
});
|
|
327
319
|
it('queries the search service with facets selected/negated', async () => {
|
|
328
|
-
var _a, _b;
|
|
329
320
|
const searchService = new MockSearchService();
|
|
330
321
|
const selectedFacets = {
|
|
331
322
|
subject: {
|
|
@@ -359,8 +350,8 @@ describe('Collection Browser', () => {
|
|
|
359
350
|
el.selectedFacets = selectedFacets;
|
|
360
351
|
await el.updateComplete;
|
|
361
352
|
await el.initialSearchComplete;
|
|
362
|
-
expect(
|
|
363
|
-
expect(
|
|
353
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
354
|
+
expect(searchService.searchParams?.filters).to.deep.equal({
|
|
364
355
|
subject: {
|
|
365
356
|
foo: 'inc',
|
|
366
357
|
bar: 'exc',
|
|
@@ -371,14 +362,13 @@ describe('Collection Browser', () => {
|
|
|
371
362
|
});
|
|
372
363
|
});
|
|
373
364
|
it('fails gracefully if no search service provided', async () => {
|
|
374
|
-
var _a;
|
|
375
365
|
const el = await fixture(html `<collection-browser></collection-browser>`);
|
|
376
366
|
el.baseQuery = 'collection:foo';
|
|
377
367
|
await el.updateComplete;
|
|
378
368
|
// This shouldn't throw an error
|
|
379
369
|
expect(el.dataSource.fetchPage(3)).to.exist;
|
|
380
370
|
// Should continue showing the empty placeholder
|
|
381
|
-
expect(
|
|
371
|
+
expect(el.shadowRoot?.querySelector('empty-placeholder')).to.exist;
|
|
382
372
|
});
|
|
383
373
|
it('restores search type from URL param', async () => {
|
|
384
374
|
// Add a sin=TXT param to the URL
|
|
@@ -448,7 +438,6 @@ describe('Collection Browser', () => {
|
|
|
448
438
|
expect(searchErrorSpy.callCount).to.equal(1);
|
|
449
439
|
});
|
|
450
440
|
it('applies loggedin flag to tile models if needed', async () => {
|
|
451
|
-
var _a;
|
|
452
441
|
const searchService = new MockSearchService();
|
|
453
442
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
454
443
|
</collection-browser>`);
|
|
@@ -459,10 +448,9 @@ describe('Collection Browser', () => {
|
|
|
459
448
|
expect(cellTemplate).to.exist;
|
|
460
449
|
const cell = await fixture(cellTemplate);
|
|
461
450
|
expect(cell).to.exist;
|
|
462
|
-
expect(
|
|
451
|
+
expect(cell.model?.loginRequired).to.be.true;
|
|
463
452
|
});
|
|
464
453
|
it('applies no-preview flag to tile models if needed', async () => {
|
|
465
|
-
var _a;
|
|
466
454
|
const searchService = new MockSearchService();
|
|
467
455
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
468
456
|
</collection-browser>`);
|
|
@@ -473,10 +461,9 @@ describe('Collection Browser', () => {
|
|
|
473
461
|
expect(cellTemplate).to.exist;
|
|
474
462
|
const cell = await fixture(cellTemplate);
|
|
475
463
|
expect(cell).to.exist;
|
|
476
|
-
expect(
|
|
464
|
+
expect(cell.model?.contentWarning).to.be.true;
|
|
477
465
|
});
|
|
478
466
|
it('both loggedin and no-preview flags can be set simultaneously', async () => {
|
|
479
|
-
var _a, _b;
|
|
480
467
|
const searchService = new MockSearchService();
|
|
481
468
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
482
469
|
</collection-browser>`);
|
|
@@ -487,11 +474,10 @@ describe('Collection Browser', () => {
|
|
|
487
474
|
expect(cellTemplate).to.exist;
|
|
488
475
|
const cell = await fixture(cellTemplate);
|
|
489
476
|
expect(cell).to.exist;
|
|
490
|
-
expect(
|
|
491
|
-
expect(
|
|
477
|
+
expect(cell.model?.loginRequired).to.be.true;
|
|
478
|
+
expect(cell.model?.contentWarning).to.be.true;
|
|
492
479
|
});
|
|
493
480
|
it('joins full description array into a single string with line breaks', async () => {
|
|
494
|
-
var _a;
|
|
495
481
|
const searchService = new MockSearchService();
|
|
496
482
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
497
483
|
</collection-browser>`);
|
|
@@ -504,10 +490,9 @@ describe('Collection Browser', () => {
|
|
|
504
490
|
const cell = await fixture(cellTemplate);
|
|
505
491
|
expect(cell).to.exist;
|
|
506
492
|
// Actual model description should be joined
|
|
507
|
-
expect(
|
|
493
|
+
expect(cell.model?.description).to.equal('line1\nline2');
|
|
508
494
|
});
|
|
509
495
|
it('can change search type', async () => {
|
|
510
|
-
var _a;
|
|
511
496
|
const searchService = new MockSearchService();
|
|
512
497
|
const el = await fixture(html `<collection-browser
|
|
513
498
|
.searchService=${searchService}
|
|
@@ -517,11 +502,10 @@ describe('Collection Browser', () => {
|
|
|
517
502
|
el.searchType = SearchType.FULLTEXT;
|
|
518
503
|
await el.updateComplete;
|
|
519
504
|
await el.initialSearchComplete;
|
|
520
|
-
expect(
|
|
505
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
521
506
|
expect(searchService.searchType).to.equal(SearchType.FULLTEXT);
|
|
522
507
|
});
|
|
523
508
|
it('trims queries of leading/trailing whitespace', async () => {
|
|
524
|
-
var _a;
|
|
525
509
|
const searchService = new MockSearchService();
|
|
526
510
|
const el = await fixture(html `<collection-browser
|
|
527
511
|
.searchService=${searchService}
|
|
@@ -529,10 +513,9 @@ describe('Collection Browser', () => {
|
|
|
529
513
|
el.baseQuery = ' collection:foo ';
|
|
530
514
|
await el.updateComplete;
|
|
531
515
|
await el.initialSearchComplete;
|
|
532
|
-
expect(
|
|
516
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
533
517
|
});
|
|
534
518
|
it('shows error message when error response received', async () => {
|
|
535
|
-
var _a, _b;
|
|
536
519
|
const searchService = new MockSearchService();
|
|
537
520
|
const el = await fixture(html `<collection-browser
|
|
538
521
|
.searchService=${searchService}
|
|
@@ -540,13 +523,12 @@ describe('Collection Browser', () => {
|
|
|
540
523
|
el.baseQuery = 'error';
|
|
541
524
|
await el.updateComplete;
|
|
542
525
|
await el.initialSearchComplete;
|
|
543
|
-
const errorPlaceholder =
|
|
544
|
-
const errorDetails =
|
|
526
|
+
const errorPlaceholder = el.shadowRoot?.querySelector('empty-placeholder');
|
|
527
|
+
const errorDetails = errorPlaceholder?.shadowRoot?.querySelector('.error-details');
|
|
545
528
|
expect(errorDetails).to.exist;
|
|
546
529
|
expect(errorDetails.textContent).to.contain('foo');
|
|
547
530
|
});
|
|
548
531
|
it('shows error message when error response received for a collection', async () => {
|
|
549
|
-
var _a, _b;
|
|
550
532
|
const searchService = new MockSearchService();
|
|
551
533
|
const el = await fixture(html `<collection-browser
|
|
552
534
|
.searchService=${searchService}
|
|
@@ -554,8 +536,8 @@ describe('Collection Browser', () => {
|
|
|
554
536
|
el.withinCollection = 'error';
|
|
555
537
|
await el.updateComplete;
|
|
556
538
|
await el.initialSearchComplete;
|
|
557
|
-
const errorPlaceholder =
|
|
558
|
-
const errorDetails =
|
|
539
|
+
const errorPlaceholder = el.shadowRoot?.querySelector('empty-placeholder');
|
|
540
|
+
const errorDetails = errorPlaceholder?.shadowRoot?.querySelector('.error-details');
|
|
559
541
|
expect(errorDetails).to.exist;
|
|
560
542
|
expect(errorDetails.textContent).to.contain('foo');
|
|
561
543
|
});
|
|
@@ -677,7 +659,6 @@ describe('Collection Browser', () => {
|
|
|
677
659
|
expect(resultsSpy.callCount).to.equal(0);
|
|
678
660
|
});
|
|
679
661
|
it('sets sort properties when user changes sort', async () => {
|
|
680
|
-
var _a, _b, _c, _d, _e, _f;
|
|
681
662
|
const searchService = new MockSearchService();
|
|
682
663
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
683
664
|
</collection-browser>`);
|
|
@@ -685,22 +666,25 @@ describe('Collection Browser', () => {
|
|
|
685
666
|
el.baseQuery = 'foo';
|
|
686
667
|
await el.updateComplete;
|
|
687
668
|
await nextTick();
|
|
688
|
-
const sortBar =
|
|
689
|
-
const sortSelector =
|
|
669
|
+
const sortBar = el.shadowRoot?.querySelector('#content-container sort-filter-bar');
|
|
670
|
+
const sortSelector = sortBar?.shadowRoot?.querySelector('#desktop-sort-selector');
|
|
690
671
|
expect(sortSelector, 'sort bar').to.exist;
|
|
691
672
|
// Click the title sorter
|
|
692
|
-
|
|
693
|
-
.find(child =>
|
|
673
|
+
Array.from(sortSelector.children)
|
|
674
|
+
.find(child => child.textContent?.trim() === 'Title')
|
|
675
|
+
?.querySelector('button')
|
|
676
|
+
?.click();
|
|
694
677
|
await el.updateComplete;
|
|
695
678
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
696
679
|
// Click the creator sorter
|
|
697
|
-
|
|
698
|
-
.find(child =>
|
|
680
|
+
Array.from(sortSelector.children)
|
|
681
|
+
.find(child => child.textContent?.trim() === 'Creator')
|
|
682
|
+
?.querySelector('button')
|
|
683
|
+
?.click();
|
|
699
684
|
await el.updateComplete;
|
|
700
685
|
expect(el.selectedSort).to.equal(SortField.creator);
|
|
701
686
|
});
|
|
702
687
|
it('sets sort filter properties when user selects title filter', async () => {
|
|
703
|
-
var _a, _b, _c, _d;
|
|
704
688
|
const searchService = new MockSearchService();
|
|
705
689
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
706
690
|
</collection-browser>`);
|
|
@@ -710,11 +694,10 @@ describe('Collection Browser', () => {
|
|
|
710
694
|
el.selectedTitleFilter = 'X';
|
|
711
695
|
await el.updateComplete;
|
|
712
696
|
await el.initialSearchComplete;
|
|
713
|
-
expect(
|
|
714
|
-
expect(
|
|
697
|
+
expect(searchService.searchParams?.query).to.equal('first-title');
|
|
698
|
+
expect(searchService.searchParams?.filters?.firstTitle?.X).to.equal(FilterConstraint.INCLUDE);
|
|
715
699
|
});
|
|
716
700
|
it('sets sort filter properties when user selects creator filter', async () => {
|
|
717
|
-
var _a, _b, _c, _d;
|
|
718
701
|
const searchService = new MockSearchService();
|
|
719
702
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
720
703
|
</collection-browser>`);
|
|
@@ -724,11 +707,10 @@ describe('Collection Browser', () => {
|
|
|
724
707
|
el.selectedCreatorFilter = 'X';
|
|
725
708
|
await el.updateComplete;
|
|
726
709
|
await el.initialSearchComplete;
|
|
727
|
-
expect(
|
|
728
|
-
expect(
|
|
710
|
+
expect(searchService.searchParams?.query).to.equal('first-creator');
|
|
711
|
+
expect(searchService.searchParams?.filters?.firstCreator?.X).to.equal(FilterConstraint.INCLUDE);
|
|
729
712
|
});
|
|
730
713
|
it('sets sort filter properties simultaneous with facets and date range', async () => {
|
|
731
|
-
var _a, _b;
|
|
732
714
|
const searchService = new MockSearchService();
|
|
733
715
|
const selectedFacets = {
|
|
734
716
|
collection: { foo: { key: 'foo', state: 'selected', count: 1 } },
|
|
@@ -750,8 +732,8 @@ describe('Collection Browser', () => {
|
|
|
750
732
|
el.selectedCreatorFilter = 'X';
|
|
751
733
|
await el.updateComplete;
|
|
752
734
|
await el.initialSearchComplete;
|
|
753
|
-
expect(
|
|
754
|
-
expect(
|
|
735
|
+
expect(searchService.searchParams?.query).to.equal('first-creator');
|
|
736
|
+
expect(searchService.searchParams?.filters).to.deep.equal({
|
|
755
737
|
collection: {
|
|
756
738
|
foo: 'inc',
|
|
757
739
|
},
|
|
@@ -765,7 +747,6 @@ describe('Collection Browser', () => {
|
|
|
765
747
|
});
|
|
766
748
|
});
|
|
767
749
|
it('applies correct TV search filter for commercials', async () => {
|
|
768
|
-
var _a, _b, _c;
|
|
769
750
|
const searchService = new MockSearchService();
|
|
770
751
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
771
752
|
</collection-browser>`);
|
|
@@ -778,10 +759,9 @@ describe('Collection Browser', () => {
|
|
|
778
759
|
};
|
|
779
760
|
await el.updateComplete;
|
|
780
761
|
await el.initialSearchComplete;
|
|
781
|
-
expect(
|
|
762
|
+
expect(searchService.searchParams?.filters?.clip_type?.commercial).to.equal(FilterConstraint.INCLUDE);
|
|
782
763
|
});
|
|
783
764
|
it('applies correct TV search filter for fact checks', async () => {
|
|
784
|
-
var _a, _b, _c;
|
|
785
765
|
const searchService = new MockSearchService();
|
|
786
766
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
787
767
|
</collection-browser>`);
|
|
@@ -794,10 +774,9 @@ describe('Collection Browser', () => {
|
|
|
794
774
|
};
|
|
795
775
|
await el.updateComplete;
|
|
796
776
|
await el.initialSearchComplete;
|
|
797
|
-
expect(
|
|
777
|
+
expect(searchService.searchParams?.filters?.clip_type?.['fact check']).to.equal(FilterConstraint.INCLUDE);
|
|
798
778
|
});
|
|
799
779
|
it('applies correct TV search filter for quotes', async () => {
|
|
800
|
-
var _a, _b, _c;
|
|
801
780
|
const searchService = new MockSearchService();
|
|
802
781
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
803
782
|
</collection-browser>`);
|
|
@@ -808,10 +787,9 @@ describe('Collection Browser', () => {
|
|
|
808
787
|
};
|
|
809
788
|
await el.updateComplete;
|
|
810
789
|
await el.initialSearchComplete;
|
|
811
|
-
expect(
|
|
790
|
+
expect(searchService.searchParams?.filters?.clip_type?.quote).to.equal(FilterConstraint.INCLUDE);
|
|
812
791
|
});
|
|
813
792
|
it('resets letter filters when query changes', async () => {
|
|
814
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
815
793
|
const searchService = new MockSearchService();
|
|
816
794
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
817
795
|
</collection-browser>`);
|
|
@@ -822,16 +800,15 @@ describe('Collection Browser', () => {
|
|
|
822
800
|
await el.updateComplete;
|
|
823
801
|
await el.initialSearchComplete;
|
|
824
802
|
await nextTick();
|
|
825
|
-
expect(
|
|
826
|
-
expect(
|
|
803
|
+
expect(searchService.searchParams?.query).to.equal('first-creator');
|
|
804
|
+
expect(searchService.searchParams?.filters?.firstCreator?.X).to.equal(FilterConstraint.INCLUDE);
|
|
827
805
|
el.baseQuery = 'collection:foo';
|
|
828
806
|
await el.updateComplete;
|
|
829
807
|
await nextTick();
|
|
830
|
-
expect(
|
|
831
|
-
expect(
|
|
808
|
+
expect(searchService.searchParams?.query).to.equal('collection:foo');
|
|
809
|
+
expect(searchService.searchParams?.filters?.firstCreator).not.to.exist;
|
|
832
810
|
});
|
|
833
811
|
it('sets date range query when date picker selection changed', async () => {
|
|
834
|
-
var _a, _b, _c;
|
|
835
812
|
const searchService = new MockSearchService();
|
|
836
813
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
837
814
|
const el = await fixture(html `<collection-browser
|
|
@@ -843,14 +820,14 @@ describe('Collection Browser', () => {
|
|
|
843
820
|
el.baseQuery = 'years'; // Includes year_histogram aggregation in response
|
|
844
821
|
el.showHistogramDatePicker = true;
|
|
845
822
|
await el.updateComplete;
|
|
846
|
-
const facets =
|
|
847
|
-
await
|
|
823
|
+
const facets = el.shadowRoot?.querySelector('collection-facets');
|
|
824
|
+
await facets?.updateComplete;
|
|
848
825
|
// Wait for the date picker to be rendered (which may take until the next tick)
|
|
849
826
|
await nextTick();
|
|
850
|
-
const histogram =
|
|
827
|
+
const histogram = facets?.shadowRoot?.querySelector('histogram-date-range');
|
|
851
828
|
expect(histogram, 'histogram exists').to.exist;
|
|
852
829
|
// Enter a new min date into the date picker
|
|
853
|
-
const minDateInput =
|
|
830
|
+
const minDateInput = histogram.shadowRoot?.querySelector('#date-min');
|
|
854
831
|
const pressEnterEvent = new KeyboardEvent('keyup', {
|
|
855
832
|
key: 'Enter',
|
|
856
833
|
});
|
|
@@ -865,7 +842,6 @@ describe('Collection Browser', () => {
|
|
|
865
842
|
expect(el.maxSelectedDate).to.equal('2009');
|
|
866
843
|
});
|
|
867
844
|
it('sets date range query when monthly date picker selection changed', async () => {
|
|
868
|
-
var _a, _b, _c;
|
|
869
845
|
const searchService = new MockSearchService();
|
|
870
846
|
const el = await fixture(html `<collection-browser
|
|
871
847
|
.searchService=${searchService}
|
|
@@ -876,14 +852,14 @@ describe('Collection Browser', () => {
|
|
|
876
852
|
el.searchType = SearchType.TV;
|
|
877
853
|
el.showHistogramDatePicker = true;
|
|
878
854
|
await el.updateComplete;
|
|
879
|
-
const facets =
|
|
880
|
-
await
|
|
855
|
+
const facets = el.shadowRoot?.querySelector('collection-facets');
|
|
856
|
+
await facets?.updateComplete;
|
|
881
857
|
// Wait for the date picker to be rendered (which may take until the next tick)
|
|
882
858
|
await nextTick();
|
|
883
|
-
const histogram =
|
|
859
|
+
const histogram = facets?.shadowRoot?.querySelector('histogram-date-range');
|
|
884
860
|
expect(histogram, 'histogram exists').to.exist;
|
|
885
861
|
// Enter a new min date into the date picker
|
|
886
|
-
const minDateInput =
|
|
862
|
+
const minDateInput = histogram.shadowRoot?.querySelector('#date-min');
|
|
887
863
|
const pressEnterEvent = new KeyboardEvent('keyup', {
|
|
888
864
|
key: 'Enter',
|
|
889
865
|
});
|
|
@@ -898,7 +874,6 @@ describe('Collection Browser', () => {
|
|
|
898
874
|
expect(el.maxSelectedDate).to.equal('2002-12');
|
|
899
875
|
});
|
|
900
876
|
it('emits event when results start and end loading', async () => {
|
|
901
|
-
var _a, _b, _c, _d;
|
|
902
877
|
const spy = sinon.spy();
|
|
903
878
|
const searchService = new MockSearchService();
|
|
904
879
|
const el = await fixture(html `<collection-browser
|
|
@@ -911,11 +886,10 @@ describe('Collection Browser', () => {
|
|
|
911
886
|
await el.initialSearchComplete;
|
|
912
887
|
// Should initially emit loading=true, then later emit loading=false
|
|
913
888
|
expect(spy.callCount).to.equal(2);
|
|
914
|
-
expect(
|
|
915
|
-
expect(
|
|
889
|
+
expect(spy.firstCall.firstArg?.detail?.loading).to.equal(true);
|
|
890
|
+
expect(spy.secondCall.firstArg?.detail?.loading).to.equal(false);
|
|
916
891
|
});
|
|
917
892
|
it('collapses extra set of quotes around href field', async () => {
|
|
918
|
-
var _a;
|
|
919
893
|
const searchService = new MockSearchService();
|
|
920
894
|
const el = await fixture(html `<collection-browser
|
|
921
895
|
.searchService=${searchService}
|
|
@@ -927,10 +901,9 @@ describe('Collection Browser', () => {
|
|
|
927
901
|
await el.updateComplete;
|
|
928
902
|
await aTimeout(50);
|
|
929
903
|
// Original href q param starts/ends with %22%22, but should be collapsed to %22 before render
|
|
930
|
-
expect(
|
|
904
|
+
expect(el.dataSource.getTileModelAt(0)?.href).to.equal('/details/foo?q=%22quoted+query%22');
|
|
931
905
|
});
|
|
932
906
|
it('sets default sort from collection metadata', async () => {
|
|
933
|
-
var _a;
|
|
934
907
|
const searchService = new MockSearchService();
|
|
935
908
|
const el = await fixture(html `<collection-browser
|
|
936
909
|
.searchService=${searchService}
|
|
@@ -941,7 +914,7 @@ describe('Collection Browser', () => {
|
|
|
941
914
|
await el.initialSearchComplete;
|
|
942
915
|
await el.updateComplete;
|
|
943
916
|
await aTimeout(50);
|
|
944
|
-
const sortBar =
|
|
917
|
+
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
945
918
|
expect(sortBar).to.exist;
|
|
946
919
|
expect(sortBar.defaultSortField).to.equal(SortField.title);
|
|
947
920
|
expect(sortBar.defaultSortDirection).to.equal('asc');
|
|
@@ -949,7 +922,6 @@ describe('Collection Browser', () => {
|
|
|
949
922
|
expect(sortBar.sortDirection).to.be.null;
|
|
950
923
|
});
|
|
951
924
|
it('sets default sort from collection metadata in "-field" format', async () => {
|
|
952
|
-
var _a;
|
|
953
925
|
const searchService = new MockSearchService();
|
|
954
926
|
const el = await fixture(html `<collection-browser
|
|
955
927
|
.searchService=${searchService}
|
|
@@ -960,7 +932,7 @@ describe('Collection Browser', () => {
|
|
|
960
932
|
await el.initialSearchComplete;
|
|
961
933
|
await el.updateComplete;
|
|
962
934
|
await aTimeout(50);
|
|
963
|
-
const sortBar =
|
|
935
|
+
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
964
936
|
expect(sortBar).to.exist;
|
|
965
937
|
expect(sortBar.defaultSortField).to.equal(SortField.dateadded);
|
|
966
938
|
expect(sortBar.defaultSortDirection).to.equal('desc');
|
|
@@ -978,7 +950,6 @@ describe('Collection Browser', () => {
|
|
|
978
950
|
});
|
|
979
951
|
});
|
|
980
952
|
it('uses relevance sort as default when a query is set', async () => {
|
|
981
|
-
var _a;
|
|
982
953
|
const searchService = new MockSearchService();
|
|
983
954
|
const el = await fixture(html `<collection-browser
|
|
984
955
|
.searchService=${searchService}
|
|
@@ -990,7 +961,7 @@ describe('Collection Browser', () => {
|
|
|
990
961
|
await el.initialSearchComplete;
|
|
991
962
|
await el.updateComplete;
|
|
992
963
|
await aTimeout(50);
|
|
993
|
-
const sortBar =
|
|
964
|
+
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
994
965
|
expect(sortBar).to.exist;
|
|
995
966
|
expect(sortBar.defaultSortField).to.equal(SortField.relevance);
|
|
996
967
|
expect(sortBar.defaultSortDirection).to.be.null;
|
|
@@ -998,7 +969,6 @@ describe('Collection Browser', () => {
|
|
|
998
969
|
expect(sortBar.sortDirection).to.be.null;
|
|
999
970
|
});
|
|
1000
971
|
it('uses date favorited sort as default when targeting fav- collection', async () => {
|
|
1001
|
-
var _a;
|
|
1002
972
|
const searchService = new MockSearchService();
|
|
1003
973
|
const el = await fixture(html `<collection-browser
|
|
1004
974
|
.searchService=${searchService}
|
|
@@ -1009,7 +979,7 @@ describe('Collection Browser', () => {
|
|
|
1009
979
|
await el.initialSearchComplete;
|
|
1010
980
|
await el.updateComplete;
|
|
1011
981
|
await aTimeout(50);
|
|
1012
|
-
const sortBar =
|
|
982
|
+
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
1013
983
|
expect(sortBar).to.exist;
|
|
1014
984
|
expect(sortBar.defaultSortField).to.equal(SortField.datefavorited);
|
|
1015
985
|
expect(sortBar.defaultSortDirection).to.equal('desc');
|
|
@@ -1017,7 +987,6 @@ describe('Collection Browser', () => {
|
|
|
1017
987
|
expect(sortBar.sortDirection).to.be.null;
|
|
1018
988
|
});
|
|
1019
989
|
it('scrolls to page', async () => {
|
|
1020
|
-
var _a;
|
|
1021
990
|
const searchService = new MockSearchService();
|
|
1022
991
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1023
992
|
</collection-browser>`);
|
|
@@ -1029,7 +998,7 @@ describe('Collection Browser', () => {
|
|
|
1029
998
|
el.baseQuery = 'collection:foo';
|
|
1030
999
|
await el.updateComplete;
|
|
1031
1000
|
await nextTick();
|
|
1032
|
-
const infiniteScroller =
|
|
1001
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
1033
1002
|
expect(infiniteScroller).to.exist;
|
|
1034
1003
|
const oldScrollToCell = infiniteScroller.scrollToCell;
|
|
1035
1004
|
const spy = sinon.spy();
|
|
@@ -1039,7 +1008,6 @@ describe('Collection Browser', () => {
|
|
|
1039
1008
|
infiniteScroller.scrollToCell = oldScrollToCell;
|
|
1040
1009
|
});
|
|
1041
1010
|
it('shows mobile facets in mobile view', async () => {
|
|
1042
|
-
var _a, _b;
|
|
1043
1011
|
const searchService = new MockSearchService();
|
|
1044
1012
|
const el = await fixture(html `<collection-browser
|
|
1045
1013
|
.searchService=${searchService}
|
|
@@ -1047,7 +1015,7 @@ describe('Collection Browser', () => {
|
|
|
1047
1015
|
></collection-browser>`);
|
|
1048
1016
|
el.baseQuery = 'collection:foo';
|
|
1049
1017
|
await el.updateComplete;
|
|
1050
|
-
const contentContainer =
|
|
1018
|
+
const contentContainer = el.shadowRoot?.querySelector('#content-container');
|
|
1051
1019
|
el.handleResize({
|
|
1052
1020
|
target: contentContainer,
|
|
1053
1021
|
contentRect: contentContainer.getBoundingClientRect(),
|
|
@@ -1056,11 +1024,10 @@ describe('Collection Browser', () => {
|
|
|
1056
1024
|
devicePixelContentBoxSize: [],
|
|
1057
1025
|
});
|
|
1058
1026
|
await el.updateComplete;
|
|
1059
|
-
const mobileFacets =
|
|
1027
|
+
const mobileFacets = el.shadowRoot?.querySelector('#mobile-filter-collapse');
|
|
1060
1028
|
expect(mobileFacets).to.exist;
|
|
1061
1029
|
});
|
|
1062
1030
|
it('fires analytics when mobile facets toggled', async () => {
|
|
1063
|
-
var _a, _b;
|
|
1064
1031
|
const searchService = new MockSearchService();
|
|
1065
1032
|
const analyticsHandler = new MockAnalyticsHandler();
|
|
1066
1033
|
const el = await fixture(html `<collection-browser
|
|
@@ -1071,7 +1038,7 @@ describe('Collection Browser', () => {
|
|
|
1071
1038
|
></collection-browser>`);
|
|
1072
1039
|
el.baseQuery = 'collection:foo';
|
|
1073
1040
|
await el.updateComplete;
|
|
1074
|
-
const contentContainer =
|
|
1041
|
+
const contentContainer = el.shadowRoot?.querySelector('#content-container');
|
|
1075
1042
|
el.handleResize({
|
|
1076
1043
|
target: contentContainer,
|
|
1077
1044
|
contentRect: contentContainer.getBoundingClientRect(),
|
|
@@ -1080,7 +1047,7 @@ describe('Collection Browser', () => {
|
|
|
1080
1047
|
devicePixelContentBoxSize: [],
|
|
1081
1048
|
});
|
|
1082
1049
|
await el.updateComplete;
|
|
1083
|
-
const mobileFacets =
|
|
1050
|
+
const mobileFacets = el.shadowRoot?.querySelector('#mobile-filter-collapse');
|
|
1084
1051
|
expect(mobileFacets).to.exist;
|
|
1085
1052
|
// We set up a Promise to wait for the 'toggle' event on the collapser,
|
|
1086
1053
|
// which is what triggers the analytics.
|
|
@@ -1130,7 +1097,6 @@ describe('Collection Browser', () => {
|
|
|
1130
1097
|
expect(el.isTVCollection).to.be.true;
|
|
1131
1098
|
});
|
|
1132
1099
|
it('refreshes when certain properties change - with some analytics event sampling', async () => {
|
|
1133
|
-
var _a;
|
|
1134
1100
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
1135
1101
|
const searchService = new MockSearchService();
|
|
1136
1102
|
const el = await fixture(html `<collection-browser
|
|
@@ -1142,7 +1108,7 @@ describe('Collection Browser', () => {
|
|
|
1142
1108
|
el.baseQuery = 'collection:foo';
|
|
1143
1109
|
await el.updateComplete;
|
|
1144
1110
|
await nextTick();
|
|
1145
|
-
const infiniteScroller =
|
|
1111
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
1146
1112
|
infiniteScroller.reload = infiniteScrollerRefreshSpy;
|
|
1147
1113
|
expect(infiniteScrollerRefreshSpy.called).to.be.false;
|
|
1148
1114
|
expect(infiniteScrollerRefreshSpy.callCount).to.equal(0);
|
|
@@ -1179,14 +1145,13 @@ describe('Collection Browser', () => {
|
|
|
1179
1145
|
expect(infiniteScrollerRefreshSpy.callCount, '6th Infinite Scroller Refresh').to.equal(6);
|
|
1180
1146
|
});
|
|
1181
1147
|
it('query the search service for single result', async () => {
|
|
1182
|
-
var _a, _b;
|
|
1183
1148
|
const searchService = new MockSearchService();
|
|
1184
1149
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1185
1150
|
</collection-browser>`);
|
|
1186
1151
|
el.baseQuery = 'single-result';
|
|
1187
1152
|
await el.updateComplete;
|
|
1188
1153
|
await el.initialSearchComplete;
|
|
1189
|
-
expect(
|
|
1154
|
+
expect(el.shadowRoot?.querySelector('#big-results-label')?.textContent).to.contains('Result');
|
|
1190
1155
|
});
|
|
1191
1156
|
it('`searchContext` prop helps describe where component is being used', async () => {
|
|
1192
1157
|
const el = await fixture(html `<collection-browser></collection-browser>`);
|
|
@@ -1198,7 +1163,6 @@ describe('Collection Browser', () => {
|
|
|
1198
1163
|
expect(el.getAttribute('searchcontext')).to.equal('unicorn-search');
|
|
1199
1164
|
});
|
|
1200
1165
|
it('respects the initial set of URL parameters for a general search', async () => {
|
|
1201
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1202
1166
|
const url = new URL(window.location.href);
|
|
1203
1167
|
const { searchParams } = url;
|
|
1204
1168
|
searchParams.set('query', 'foo');
|
|
@@ -1217,14 +1181,13 @@ describe('Collection Browser', () => {
|
|
|
1217
1181
|
expect(el.baseQuery).to.equal('foo');
|
|
1218
1182
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1219
1183
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1220
|
-
expect(
|
|
1221
|
-
expect(
|
|
1184
|
+
expect(el.selectedFacets?.mediatype?.data?.state).to.equal('hidden');
|
|
1185
|
+
expect(el.selectedFacets?.subject?.baz?.state).to.equal('selected');
|
|
1222
1186
|
expect(el.selectedTitleFilter).to.equal('X');
|
|
1223
1187
|
expect(el.minSelectedDate).to.equal('2000');
|
|
1224
1188
|
expect(el.maxSelectedDate).to.equal('2010');
|
|
1225
1189
|
});
|
|
1226
1190
|
it('respects the initial set of URL parameters within a collection', async () => {
|
|
1227
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1228
1191
|
const url = new URL(window.location.href);
|
|
1229
1192
|
const { searchParams } = url;
|
|
1230
1193
|
searchParams.set('query', 'foo');
|
|
@@ -1247,14 +1210,13 @@ describe('Collection Browser', () => {
|
|
|
1247
1210
|
expect(el.baseQuery).to.equal('foo');
|
|
1248
1211
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1249
1212
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1250
|
-
expect(
|
|
1251
|
-
expect(
|
|
1213
|
+
expect(el.selectedFacets?.mediatype?.data?.state).to.equal('hidden');
|
|
1214
|
+
expect(el.selectedFacets?.subject?.baz?.state).to.equal('selected');
|
|
1252
1215
|
expect(el.selectedTitleFilter).to.equal('X');
|
|
1253
1216
|
expect(el.minSelectedDate).to.equal('2000');
|
|
1254
1217
|
expect(el.maxSelectedDate).to.equal('2010');
|
|
1255
1218
|
});
|
|
1256
1219
|
it('respects the initial set of URL parameters within a profile page', async () => {
|
|
1257
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1258
1220
|
const url = new URL(window.location.href);
|
|
1259
1221
|
const { searchParams } = url;
|
|
1260
1222
|
searchParams.set('query', 'foo');
|
|
@@ -1276,14 +1238,13 @@ describe('Collection Browser', () => {
|
|
|
1276
1238
|
expect(el.profileElement).to.equal('uploads');
|
|
1277
1239
|
expect(el.baseQuery).to.equal('foo');
|
|
1278
1240
|
expect(el.searchType).to.equal(SearchType.DEFAULT);
|
|
1279
|
-
expect(
|
|
1280
|
-
expect(
|
|
1241
|
+
expect(el.selectedFacets?.mediatype?.data?.state).to.equal('hidden');
|
|
1242
|
+
expect(el.selectedFacets?.subject?.baz?.state).to.equal('selected');
|
|
1281
1243
|
expect(el.selectedTitleFilter).to.equal('X');
|
|
1282
1244
|
expect(el.minSelectedDate).to.equal('2000');
|
|
1283
1245
|
expect(el.maxSelectedDate).to.equal('2010');
|
|
1284
1246
|
});
|
|
1285
1247
|
it('clears filters except sort when query changes for a general search', async () => {
|
|
1286
|
-
var _a, _b, _c, _d;
|
|
1287
1248
|
const url = new URL(window.location.href);
|
|
1288
1249
|
const { searchParams } = url;
|
|
1289
1250
|
searchParams.set('query', 'foo');
|
|
@@ -1304,14 +1265,13 @@ describe('Collection Browser', () => {
|
|
|
1304
1265
|
expect(el.baseQuery).to.equal('bar');
|
|
1305
1266
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1306
1267
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1307
|
-
expect(
|
|
1308
|
-
expect(
|
|
1268
|
+
expect(el.selectedFacets?.mediatype?.data).not.to.exist;
|
|
1269
|
+
expect(el.selectedFacets?.subject?.baz).not.to.exist;
|
|
1309
1270
|
expect(el.selectedTitleFilter).not.to.exist;
|
|
1310
1271
|
expect(el.minSelectedDate).not.to.exist;
|
|
1311
1272
|
expect(el.maxSelectedDate).not.to.exist;
|
|
1312
1273
|
});
|
|
1313
1274
|
it('clears filters except sort when query changes within a collection', async () => {
|
|
1314
|
-
var _a, _b, _c, _d;
|
|
1315
1275
|
const url = new URL(window.location.href);
|
|
1316
1276
|
const { searchParams } = url;
|
|
1317
1277
|
searchParams.set('query', 'foo');
|
|
@@ -1334,14 +1294,13 @@ describe('Collection Browser', () => {
|
|
|
1334
1294
|
expect(el.baseQuery).to.equal('bar');
|
|
1335
1295
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1336
1296
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1337
|
-
expect(
|
|
1338
|
-
expect(
|
|
1297
|
+
expect(el.selectedFacets?.mediatype?.data).not.to.exist;
|
|
1298
|
+
expect(el.selectedFacets?.subject?.baz).not.to.exist;
|
|
1339
1299
|
expect(el.selectedTitleFilter).not.to.exist;
|
|
1340
1300
|
expect(el.minSelectedDate).not.to.exist;
|
|
1341
1301
|
expect(el.maxSelectedDate).not.to.exist;
|
|
1342
1302
|
});
|
|
1343
1303
|
it('clears filters *including* sort when target collection changes', async () => {
|
|
1344
|
-
var _a, _b, _c, _d;
|
|
1345
1304
|
const url = new URL(window.location.href);
|
|
1346
1305
|
const { searchParams } = url;
|
|
1347
1306
|
searchParams.set('query', 'foo');
|
|
@@ -1364,14 +1323,13 @@ describe('Collection Browser', () => {
|
|
|
1364
1323
|
expect(el.baseQuery).to.equal('foo');
|
|
1365
1324
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1366
1325
|
expect(el.selectedSort).to.equal(SortField.default);
|
|
1367
|
-
expect(
|
|
1368
|
-
expect(
|
|
1326
|
+
expect(el.selectedFacets?.mediatype?.data).not.to.exist;
|
|
1327
|
+
expect(el.selectedFacets?.subject?.baz).not.to.exist;
|
|
1369
1328
|
expect(el.selectedTitleFilter).not.to.exist;
|
|
1370
1329
|
expect(el.minSelectedDate).not.to.exist;
|
|
1371
1330
|
expect(el.maxSelectedDate).not.to.exist;
|
|
1372
1331
|
});
|
|
1373
1332
|
it('correctly retrieves web archive hits', async () => {
|
|
1374
|
-
var _a, _b, _c;
|
|
1375
1333
|
const searchService = new MockSearchService();
|
|
1376
1334
|
const el = await fixture(html `<collection-browser
|
|
1377
1335
|
.searchService=${searchService}
|
|
@@ -1385,11 +1343,10 @@ describe('Collection Browser', () => {
|
|
|
1385
1343
|
await nextTick();
|
|
1386
1344
|
console.log('\n\n*****\n\n*****\n\n', el.dataSource.getAllPages(), '\n\n*****\n\n*****\n\n');
|
|
1387
1345
|
expect(el.dataSource.totalResults, 'total results').to.equal(1);
|
|
1388
|
-
expect(
|
|
1389
|
-
expect(
|
|
1346
|
+
expect(el.dataSource.getTileModelAt(0)?.title).to.equal('https://example.com');
|
|
1347
|
+
expect(el.dataSource.getTileModelAt(0)?.captureDates?.length, 'capture dates').to.equal(1);
|
|
1390
1348
|
});
|
|
1391
1349
|
it('shows dropdown accordion in facet sidebar when opt-in strategy is specified', async () => {
|
|
1392
|
-
var _a;
|
|
1393
1350
|
const searchService = new MockSearchService();
|
|
1394
1351
|
const el = await fixture(html `<collection-browser
|
|
1395
1352
|
.searchService=${searchService}
|
|
@@ -1399,11 +1356,10 @@ describe('Collection Browser', () => {
|
|
|
1399
1356
|
el.baseQuery = 'foo';
|
|
1400
1357
|
await el.updateComplete;
|
|
1401
1358
|
await el.initialSearchComplete;
|
|
1402
|
-
const facetsDropdown =
|
|
1359
|
+
const facetsDropdown = el.shadowRoot?.querySelector('.desktop-facets-dropdown');
|
|
1403
1360
|
expect(facetsDropdown).to.exist;
|
|
1404
1361
|
});
|
|
1405
1362
|
it('shows temporarily unavailable message when facets suppressed', async () => {
|
|
1406
|
-
var _a, _b;
|
|
1407
1363
|
const searchService = new MockSearchService();
|
|
1408
1364
|
const el = await fixture(html `<collection-browser
|
|
1409
1365
|
.searchService=${searchService}
|
|
@@ -1413,12 +1369,11 @@ describe('Collection Browser', () => {
|
|
|
1413
1369
|
el.baseQuery = 'foo';
|
|
1414
1370
|
await el.updateComplete;
|
|
1415
1371
|
await el.initialSearchComplete;
|
|
1416
|
-
const facetsMsg =
|
|
1372
|
+
const facetsMsg = el.shadowRoot?.querySelector('.facets-message');
|
|
1417
1373
|
expect(facetsMsg).to.exist;
|
|
1418
|
-
expect(
|
|
1374
|
+
expect(facetsMsg?.textContent?.trim()).to.equal('Facets are temporarily unavailable.');
|
|
1419
1375
|
});
|
|
1420
1376
|
it('shows manage bar interface instead of sort bar when in manage view', async () => {
|
|
1421
|
-
var _a, _b, _c, _d;
|
|
1422
1377
|
const searchService = new MockSearchService();
|
|
1423
1378
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1424
1379
|
</collection-browser>`);
|
|
@@ -1427,12 +1382,12 @@ describe('Collection Browser', () => {
|
|
|
1427
1382
|
await el.initialSearchComplete;
|
|
1428
1383
|
el.isManageView = true;
|
|
1429
1384
|
await el.updateComplete;
|
|
1430
|
-
expect(
|
|
1431
|
-
expect(
|
|
1385
|
+
expect(el.shadowRoot?.querySelector('manage-bar')).to.exist;
|
|
1386
|
+
expect(el.shadowRoot?.querySelector('sort-filter-bar')).not.to.exist;
|
|
1432
1387
|
el.isManageView = false;
|
|
1433
1388
|
await el.updateComplete;
|
|
1434
|
-
expect(
|
|
1435
|
-
expect(
|
|
1389
|
+
expect(el.shadowRoot?.querySelector('manage-bar')).not.to.exist;
|
|
1390
|
+
expect(el.shadowRoot?.querySelector('sort-filter-bar')).to.exist;
|
|
1436
1391
|
});
|
|
1437
1392
|
it('switches to grid display mode when manage view activated', async () => {
|
|
1438
1393
|
const searchService = new MockSearchService();
|
|
@@ -1447,7 +1402,6 @@ describe('Collection Browser', () => {
|
|
|
1447
1402
|
expect(el.displayMode).to.equal('grid');
|
|
1448
1403
|
});
|
|
1449
1404
|
it('can remove all checked tiles', async () => {
|
|
1450
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1451
1405
|
const searchService = new MockSearchService();
|
|
1452
1406
|
const el = await fixture(html `<collection-browser
|
|
1453
1407
|
.searchService=${searchService}
|
|
@@ -1460,29 +1414,31 @@ describe('Collection Browser', () => {
|
|
|
1460
1414
|
await el.initialSearchComplete;
|
|
1461
1415
|
el.isManageView = true;
|
|
1462
1416
|
await el.updateComplete;
|
|
1463
|
-
const infiniteScroller =
|
|
1417
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
1464
1418
|
expect(infiniteScroller).to.exist;
|
|
1465
|
-
let tiles =
|
|
1419
|
+
let tiles = infiniteScroller.shadowRoot?.querySelectorAll('tile-dispatcher');
|
|
1466
1420
|
expect(tiles).to.exist;
|
|
1467
|
-
expect(tiles
|
|
1421
|
+
expect(tiles?.length).to.equal(2);
|
|
1468
1422
|
const firstTile = tiles[0];
|
|
1469
|
-
const firstTileLink =
|
|
1470
|
-
expect(
|
|
1423
|
+
const firstTileLink = firstTile.shadowRoot?.querySelector('a[href]');
|
|
1424
|
+
expect(firstTile.model?.identifier).to.equal('foo');
|
|
1471
1425
|
expect(firstTileLink).to.exist;
|
|
1472
1426
|
// No effect if no tiles checked
|
|
1473
1427
|
el.removeCheckedTiles();
|
|
1474
1428
|
await el.updateComplete;
|
|
1475
|
-
tiles =
|
|
1429
|
+
tiles = infiniteScroller.shadowRoot?.querySelectorAll('tile-dispatcher');
|
|
1476
1430
|
expect(tiles).to.exist;
|
|
1477
|
-
expect(tiles
|
|
1431
|
+
expect(tiles?.length).to.equal(2);
|
|
1478
1432
|
// Check the first tile
|
|
1479
1433
|
firstTileLink.click();
|
|
1480
|
-
expect(
|
|
1434
|
+
expect(firstTile.model?.checked).to.be.true;
|
|
1481
1435
|
// Remove checked tiles and verify that we only kept the second tile
|
|
1482
1436
|
el.removeCheckedTiles();
|
|
1483
1437
|
await el.updateComplete;
|
|
1484
|
-
expect(
|
|
1485
|
-
tiles =
|
|
1438
|
+
expect(el?.dataSource?.size, 'data source count').to.equal(1);
|
|
1439
|
+
tiles = el.shadowRoot
|
|
1440
|
+
?.querySelector('infinite-scroller')
|
|
1441
|
+
.shadowRoot?.querySelectorAll('tile-dispatcher');
|
|
1486
1442
|
expect(tiles).to.exist;
|
|
1487
1443
|
expect(tiles.length, 'tile count after `el.removeCheckedTiles()`').to.equal(1);
|
|
1488
1444
|
});
|
|
@@ -1508,7 +1464,6 @@ describe('Collection Browser', () => {
|
|
|
1508
1464
|
expect(el.dataSource.uncheckedTileModels.length).to.equal(2);
|
|
1509
1465
|
});
|
|
1510
1466
|
it('emits event when manage view state changes', async () => {
|
|
1511
|
-
var _a, _b;
|
|
1512
1467
|
const spy = sinon.spy();
|
|
1513
1468
|
const searchService = new MockSearchService();
|
|
1514
1469
|
const el = await fixture(html `<collection-browser
|
|
@@ -1519,14 +1474,13 @@ describe('Collection Browser', () => {
|
|
|
1519
1474
|
el.isManageView = true;
|
|
1520
1475
|
await el.updateComplete;
|
|
1521
1476
|
expect(spy.callCount).to.equal(1);
|
|
1522
|
-
expect(
|
|
1477
|
+
expect(spy.args[0][0]?.detail).to.be.true;
|
|
1523
1478
|
el.isManageView = false;
|
|
1524
1479
|
await el.updateComplete;
|
|
1525
1480
|
expect(spy.callCount).to.equal(2);
|
|
1526
|
-
expect(
|
|
1481
|
+
expect(spy.args[1][0]?.detail).to.be.false;
|
|
1527
1482
|
});
|
|
1528
1483
|
it('emits event when item removal requested', async () => {
|
|
1529
|
-
var _a, _b, _c, _d, _e;
|
|
1530
1484
|
const spy = sinon.spy();
|
|
1531
1485
|
const searchService = new MockSearchService();
|
|
1532
1486
|
const el = await fixture(html `<collection-browser
|
|
@@ -1540,18 +1494,18 @@ describe('Collection Browser', () => {
|
|
|
1540
1494
|
await el.initialSearchComplete;
|
|
1541
1495
|
el.isManageView = true;
|
|
1542
1496
|
await el.updateComplete;
|
|
1543
|
-
const infiniteScroller =
|
|
1497
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
1544
1498
|
expect(infiniteScroller).to.exist;
|
|
1545
|
-
const tiles =
|
|
1499
|
+
const tiles = infiniteScroller.shadowRoot?.querySelectorAll('tile-dispatcher');
|
|
1546
1500
|
expect(tiles).to.exist.and.have.length(2);
|
|
1547
1501
|
const firstTile = tiles[0];
|
|
1548
|
-
const firstTileLink =
|
|
1549
|
-
expect(
|
|
1502
|
+
const firstTileLink = firstTile.shadowRoot?.querySelector('a[href]');
|
|
1503
|
+
expect(firstTile.model?.identifier).to.equal('foo');
|
|
1550
1504
|
expect(firstTileLink).to.exist;
|
|
1551
1505
|
// Check the first tile
|
|
1552
1506
|
firstTileLink.click();
|
|
1553
1507
|
await el.updateComplete;
|
|
1554
|
-
const manageBar =
|
|
1508
|
+
const manageBar = el.shadowRoot?.querySelector('manage-bar');
|
|
1555
1509
|
expect(manageBar).to.exist;
|
|
1556
1510
|
// Emit remove event from manage bar
|
|
1557
1511
|
manageBar.dispatchEvent(new CustomEvent('removeItems'));
|
|
@@ -1561,7 +1515,6 @@ describe('Collection Browser', () => {
|
|
|
1561
1515
|
expect(spy.args[0][0].detail.items[0]).to.equal('foo');
|
|
1562
1516
|
});
|
|
1563
1517
|
it('disables manage view when manage bar cancelled', async () => {
|
|
1564
|
-
var _a;
|
|
1565
1518
|
const searchService = new MockSearchService();
|
|
1566
1519
|
const el = await fixture(html `<collection-browser
|
|
1567
1520
|
.searchService=${searchService}
|
|
@@ -1573,7 +1526,7 @@ describe('Collection Browser', () => {
|
|
|
1573
1526
|
await el.initialSearchComplete;
|
|
1574
1527
|
el.isManageView = true;
|
|
1575
1528
|
await el.updateComplete;
|
|
1576
|
-
const manageBar =
|
|
1529
|
+
const manageBar = el.shadowRoot?.querySelector('manage-bar');
|
|
1577
1530
|
expect(manageBar).to.exist;
|
|
1578
1531
|
// Emit remove event from manage bar
|
|
1579
1532
|
manageBar.dispatchEvent(new CustomEvent('cancel'));
|
|
@@ -1581,7 +1534,6 @@ describe('Collection Browser', () => {
|
|
|
1581
1534
|
expect(el.isManageView).to.be.false;
|
|
1582
1535
|
});
|
|
1583
1536
|
it('enable/disable manage view delete button when you selectAll/unselectAll', async () => {
|
|
1584
|
-
var _a, _b, _c, _d;
|
|
1585
1537
|
const searchService = new MockSearchService();
|
|
1586
1538
|
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1587
1539
|
</collection-browser>`);
|
|
@@ -1590,26 +1542,25 @@ describe('Collection Browser', () => {
|
|
|
1590
1542
|
await el.initialSearchComplete;
|
|
1591
1543
|
el.isManageView = true;
|
|
1592
1544
|
await el.updateComplete;
|
|
1593
|
-
const manageBar =
|
|
1545
|
+
const manageBar = el.shadowRoot?.querySelector('manage-bar');
|
|
1594
1546
|
expect(manageBar).to.exist;
|
|
1595
1547
|
// disable button exists
|
|
1596
|
-
expect(
|
|
1548
|
+
expect(manageBar?.shadowRoot?.querySelector('.danger:disabled')).to.be
|
|
1597
1549
|
.exist;
|
|
1598
1550
|
// Emit remove event from manage bar
|
|
1599
1551
|
manageBar.dispatchEvent(new CustomEvent('selectAll'));
|
|
1600
1552
|
await el.updateComplete;
|
|
1601
1553
|
// disable button does not exists
|
|
1602
|
-
expect(
|
|
1554
|
+
expect(manageBar?.shadowRoot?.querySelector('.danger:disabled')).to.be.not
|
|
1603
1555
|
.exist;
|
|
1604
1556
|
// Emit remove event from manage bar
|
|
1605
1557
|
manageBar.dispatchEvent(new CustomEvent('unselectAll'));
|
|
1606
1558
|
await el.updateComplete;
|
|
1607
1559
|
// disable button exists again
|
|
1608
|
-
expect(
|
|
1560
|
+
expect(manageBar?.shadowRoot?.querySelector('.danger:disabled')).to.be
|
|
1609
1561
|
.exist;
|
|
1610
1562
|
});
|
|
1611
1563
|
it('shows Blurring checkbox for admin users', async () => {
|
|
1612
|
-
var _a;
|
|
1613
1564
|
const searchService = new MockSearchService();
|
|
1614
1565
|
const el = await fixture(html `<collection-browser
|
|
1615
1566
|
.baseNavigationUrl=${''}
|
|
@@ -1619,12 +1570,11 @@ describe('Collection Browser', () => {
|
|
|
1619
1570
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1620
1571
|
await el.updateComplete;
|
|
1621
1572
|
await el.initialSearchComplete;
|
|
1622
|
-
const blurringCheck =
|
|
1573
|
+
const blurringCheck = el.shadowRoot?.querySelector('#tile-blur-check');
|
|
1623
1574
|
expect(blurringCheck).to.exist;
|
|
1624
1575
|
expect(blurringCheck.checked).to.be.true;
|
|
1625
1576
|
});
|
|
1626
1577
|
it('unchecks Blurring checkbox for admin users with blurring preference off', async () => {
|
|
1627
|
-
var _a;
|
|
1628
1578
|
const searchService = new MockSearchService();
|
|
1629
1579
|
const el = await fixture(html `<collection-browser
|
|
1630
1580
|
.baseNavigationUrl=${''}
|
|
@@ -1634,12 +1584,11 @@ describe('Collection Browser', () => {
|
|
|
1634
1584
|
el.baseQuery = 'archive-org-user-loggedin-noblur';
|
|
1635
1585
|
await el.updateComplete;
|
|
1636
1586
|
await el.initialSearchComplete;
|
|
1637
|
-
const blurringCheck =
|
|
1587
|
+
const blurringCheck = el.shadowRoot?.querySelector('#tile-blur-check');
|
|
1638
1588
|
expect(blurringCheck).to.exist;
|
|
1639
1589
|
expect(blurringCheck.checked).to.be.false;
|
|
1640
1590
|
});
|
|
1641
1591
|
it('toggles blur state when Blurring checkbox is toggled', async () => {
|
|
1642
|
-
var _a, _b, _c;
|
|
1643
1592
|
const searchService = new MockSearchService();
|
|
1644
1593
|
const el = await fixture(html `<collection-browser
|
|
1645
1594
|
.baseNavigationUrl=${''}
|
|
@@ -1649,16 +1598,15 @@ describe('Collection Browser', () => {
|
|
|
1649
1598
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1650
1599
|
await el.updateComplete;
|
|
1651
1600
|
await el.initialSearchComplete;
|
|
1652
|
-
const blurringCheck =
|
|
1601
|
+
const blurringCheck = el.shadowRoot?.querySelector('#tile-blur-check');
|
|
1653
1602
|
expect(blurringCheck).to.exist;
|
|
1654
1603
|
blurringCheck.dispatchEvent(new PointerEvent('click'));
|
|
1655
1604
|
await el.updateComplete;
|
|
1656
|
-
const infiniteScroller =
|
|
1657
|
-
const firstTile =
|
|
1605
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
1606
|
+
const firstTile = infiniteScroller?.shadowRoot?.querySelector('tile-dispatcher');
|
|
1658
1607
|
expect(firstTile.suppressBlurring).to.be.true;
|
|
1659
1608
|
});
|
|
1660
1609
|
it('applies loans tab properties to sort bar', async () => {
|
|
1661
|
-
var _a;
|
|
1662
1610
|
const searchService = new MockSearchService();
|
|
1663
1611
|
const el = await fixture(html `<collection-browser
|
|
1664
1612
|
.baseNavigationUrl=${''}
|
|
@@ -1669,15 +1617,14 @@ describe('Collection Browser', () => {
|
|
|
1669
1617
|
el.baseQuery = 'collection:foo';
|
|
1670
1618
|
await el.updateComplete;
|
|
1671
1619
|
await aTimeout(10);
|
|
1672
|
-
const sortBar =
|
|
1673
|
-
expect(sortBar
|
|
1620
|
+
const sortBar = el.shadowRoot?.querySelector('sort-filter-bar');
|
|
1621
|
+
expect(sortBar?.enableSortOptionsSlot, 'show loans in sort bar').to.be.true;
|
|
1674
1622
|
expect(el.enableSortOptionsSlot, 'collection browser is loans tab').to.be
|
|
1675
1623
|
.true;
|
|
1676
1624
|
const loansTabSlot = sortBar.querySelector('slot[name="sort-options"]');
|
|
1677
1625
|
expect(loansTabSlot).to.exist;
|
|
1678
1626
|
});
|
|
1679
1627
|
it('can suppress presence of result count', async () => {
|
|
1680
|
-
var _a;
|
|
1681
1628
|
const searchService = new MockSearchService();
|
|
1682
1629
|
const el = await fixture(html `<collection-browser
|
|
1683
1630
|
.searchService=${searchService}
|
|
@@ -1686,11 +1633,10 @@ describe('Collection Browser', () => {
|
|
|
1686
1633
|
el.baseQuery = 'collection:foo';
|
|
1687
1634
|
await el.updateComplete;
|
|
1688
1635
|
await el.initialSearchComplete;
|
|
1689
|
-
const resultCount =
|
|
1636
|
+
const resultCount = el.shadowRoot?.querySelector('#results-total');
|
|
1690
1637
|
expect(resultCount).not.to.exist;
|
|
1691
1638
|
});
|
|
1692
1639
|
it('can suppress presence of result tiles', async () => {
|
|
1693
|
-
var _a;
|
|
1694
1640
|
const searchService = new MockSearchService();
|
|
1695
1641
|
const el = await fixture(html `<collection-browser
|
|
1696
1642
|
.searchService=${searchService}
|
|
@@ -1698,7 +1644,7 @@ describe('Collection Browser', () => {
|
|
|
1698
1644
|
></collection-browser>`);
|
|
1699
1645
|
el.baseQuery = 'collection:foo';
|
|
1700
1646
|
await el.updateComplete;
|
|
1701
|
-
const infiniteScroller =
|
|
1647
|
+
const infiniteScroller = el.shadowRoot?.querySelector('infinite-scroller');
|
|
1702
1648
|
expect(infiniteScroller).not.to.exist;
|
|
1703
1649
|
});
|
|
1704
1650
|
it('fetch larger result on search page for admin user to manage items', async () => {
|