@internetarchive/collection-browser 3.4.1-alpha-webdev7761.4 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +29 -29
- package/.github/workflows/ci.yml +27 -27
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/src/app-root.js +28 -19
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +4 -24
- package/dist/src/collection-browser.js +125 -286
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +143 -143
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.d.ts +1 -1
- package/dist/src/collection-facets/more-facets-content.js +48 -34
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.js +10 -6
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +21 -16
- 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 +10 -7
- 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 +2 -3
- 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 +11 -9
- 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 +6 -4
- package/dist/src/collection-facets/toggle-switch.js.map +1 -1
- package/dist/src/collection-facets.js +310 -309
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +1 -10
- 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 +1 -19
- package/dist/src/data-source/collection-browser-data-source.js +65 -71
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +2 -1
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.d.ts +0 -11
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/empty-placeholder.js +18 -19
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/expanded-date-picker.js +10 -6
- 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 +15 -9
- 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.d.ts +6 -2
- package/dist/src/models.js +54 -46
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +2 -1
- package/dist/src/restoration-state-handler.js +19 -12
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +14 -9
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +24 -14
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js +2 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +7 -5
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +6 -3
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +33 -23
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +2 -1
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +3 -2
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +28 -21
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.js +4 -3
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/image-block.js +8 -5
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.js +19 -12
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +25 -17
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +55 -34
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.js +2 -1
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js +4 -2
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/text-snippet-block.js +4 -2
- package/dist/src/tiles/text-snippet-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +30 -22
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js +9 -5
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/src/tiles/tile-mediatype-icon.js +19 -12
- 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 +5 -3
- 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/resolve-mediatype.js +3 -2
- package/dist/src/utils/resolve-mediatype.js.map +1 -1
- package/dist/test/collection-browser.test.js +380 -336
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +52 -37
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets/facets-template.test.js +23 -17
- package/dist/test/collection-facets/facets-template.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +32 -22
- package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +22 -16
- package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +19 -22
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +77 -60
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/empty-placeholder.test.js +17 -11
- package/dist/test/empty-placeholder.test.js.map +1 -1
- package/dist/test/expanded-date-picker.test.js +14 -8
- package/dist/test/expanded-date-picker.test.js.map +1 -1
- package/dist/test/icon-overlay.test.js +6 -7
- package/dist/test/icon-overlay.test.js.map +1 -1
- package/dist/test/image-block.test.js +26 -16
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +32 -23
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.js +33 -21
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/manage/remove-items-modal-content.test.js +15 -10
- package/dist/test/manage/remove-items-modal-content.test.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js +3 -2
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +54 -14
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/review-block.test.js +18 -16
- package/dist/test/review-block.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +3 -2
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +24 -18
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +180 -178
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/text-overlay.test.js +15 -16
- package/dist/test/text-overlay.test.js.map +1 -1
- package/dist/test/text-snippet-block.test.js +19 -14
- package/dist/test/text-snippet-block.test.js.map +1 -1
- package/dist/test/tile-stats.test.js +34 -73
- 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 +19 -13
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +91 -64
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +13 -9
- package/dist/test/tiles/grid/search-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +35 -23
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +16 -12
- package/dist/test/tiles/hover/tile-hover-pane.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +48 -34
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +105 -76
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +30 -17
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/tiles/tile-mediatype-icon.test.js +24 -12
- package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +118 -120
- package/renovate.json +6 -6
- package/src/collection-browser.ts +15 -246
- package/src/collection-facets/facet-row.ts +296 -299
- package/src/collection-facets/more-facets-content.ts +8 -5
- package/src/collection-facets.ts +995 -1010
- package/src/data-source/collection-browser-data-source-interface.ts +333 -345
- package/src/data-source/collection-browser-data-source.ts +1401 -1441
- package/src/data-source/collection-browser-query-state.ts +65 -59
- package/src/data-source/models.ts +43 -56
- package/src/models.ts +870 -866
- package/src/restoration-state-handler.ts +544 -546
- package/test/collection-browser.test.ts +2403 -2413
- package/test/restoration-state-handler.test.ts +510 -480
- package/tsconfig.json +20 -25
- package/vite.config.ts +22 -29
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
- package/dist/src/combo-box/caret-closed.d.ts +0 -2
- package/dist/src/combo-box/caret-closed.js +0 -7
- package/dist/src/combo-box/caret-closed.js.map +0 -1
- package/dist/src/combo-box/caret-open.d.ts +0 -2
- package/dist/src/combo-box/caret-open.js +0 -7
- package/dist/src/combo-box/caret-open.js.map +0 -1
- package/dist/src/combo-box/clear.d.ts +0 -2
- package/dist/src/combo-box/clear.js +0 -11
- package/dist/src/combo-box/clear.js.map +0 -1
- package/dist/src/combo-box/ia-combo-box.d.ts +0 -422
- package/dist/src/combo-box/ia-combo-box.js +0 -1203
- package/dist/src/combo-box/ia-combo-box.js.map +0 -1
- package/dist/src/combo-box/models.d.ts +0 -75
- package/dist/src/combo-box/models.js +0 -40
- package/dist/src/combo-box/models.js.map +0 -1
- package/src/combo-box/caret-closed.ts +0 -7
- package/src/combo-box/caret-open.ts +0 -7
- package/src/combo-box/clear.ts +0 -11
- package/src/combo-box/ia-combo-box.ts +0 -1288
- package/src/combo-box/models.ts +0 -113
|
@@ -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;
|
|
@@ -202,73 +202,78 @@ 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;
|
|
205
206
|
const searchService = new MockSearchService();
|
|
206
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
207
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
207
208
|
</collection-browser>`);
|
|
208
209
|
el.baseQuery = 'hello';
|
|
209
210
|
await el.updateComplete;
|
|
210
211
|
await nextTick();
|
|
211
|
-
const facets = el.shadowRoot
|
|
212
|
-
const sortBar = el.shadowRoot
|
|
213
|
-
const infiniteScroller = el.shadowRoot
|
|
212
|
+
const facets = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('collection-facets');
|
|
213
|
+
const sortBar = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('sort-filter-bar');
|
|
214
|
+
const infiniteScroller = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('infinite-scroller');
|
|
214
215
|
expect(facets, 'facets').to.exist;
|
|
215
216
|
expect(sortBar, 'sort bar').to.exist;
|
|
216
217
|
expect(infiniteScroller, 'infinite scroller').to.exist;
|
|
217
218
|
});
|
|
218
219
|
it('queries the search service when given a base query', async () => {
|
|
220
|
+
var _a, _b, _c;
|
|
219
221
|
const searchService = new MockSearchService();
|
|
220
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
222
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
221
223
|
</collection-browser>`);
|
|
222
224
|
el.baseQuery = 'collection:foo';
|
|
223
225
|
await el.updateComplete;
|
|
224
226
|
await el.initialSearchComplete;
|
|
225
|
-
expect(searchService.searchParams
|
|
226
|
-
expect(el.shadowRoot
|
|
227
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
228
|
+
expect((_c = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#big-results-label')) === null || _c === void 0 ? void 0 : _c.textContent).to.contains('Results');
|
|
227
229
|
});
|
|
228
230
|
it('queries the search service when given a list of identifiers and no query', async () => {
|
|
231
|
+
var _a, _b, _c;
|
|
229
232
|
const searchService = new MockSearchService();
|
|
230
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
233
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
231
234
|
</collection-browser>`);
|
|
232
235
|
el.identifiers = ['foo', 'bar'];
|
|
233
236
|
await el.updateComplete;
|
|
234
237
|
await el.initialSearchComplete;
|
|
235
|
-
expect(searchService.searchParams
|
|
238
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.identifiers).to.deep.equal([
|
|
236
239
|
'foo',
|
|
237
240
|
'bar',
|
|
238
241
|
]);
|
|
239
|
-
expect(el.shadowRoot
|
|
242
|
+
expect((_c = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#big-results-label')) === null || _c === void 0 ? void 0 : _c.textContent).to.contains('Results');
|
|
240
243
|
});
|
|
241
244
|
it('queries the search service when given a list of identifiers with a query', async () => {
|
|
245
|
+
var _a, _b, _c, _d;
|
|
242
246
|
const searchService = new MockSearchService();
|
|
243
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
247
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
244
248
|
</collection-browser>`);
|
|
245
249
|
el.baseQuery = 'collection:foo';
|
|
246
250
|
el.identifiers = ['foo', 'bar'];
|
|
247
251
|
await el.updateComplete;
|
|
248
252
|
await el.initialSearchComplete;
|
|
249
|
-
expect(searchService.searchParams
|
|
250
|
-
expect(searchService.searchParams
|
|
253
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
254
|
+
expect((_b = searchService.searchParams) === null || _b === void 0 ? void 0 : _b.identifiers).to.deep.equal([
|
|
251
255
|
'foo',
|
|
252
256
|
'bar',
|
|
253
257
|
]);
|
|
254
|
-
expect(el.shadowRoot
|
|
258
|
+
expect((_d = (_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('#big-results-label')) === null || _d === void 0 ? void 0 : _d.textContent).to.contains('Results');
|
|
255
259
|
});
|
|
256
260
|
it('queries the search service with a metadata search', async () => {
|
|
261
|
+
var _a, _b, _c;
|
|
257
262
|
const searchService = new MockSearchService();
|
|
258
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
263
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
259
264
|
</collection-browser>`);
|
|
260
265
|
el.searchType = SearchType.METADATA;
|
|
261
266
|
await el.updateComplete;
|
|
262
267
|
el.baseQuery = 'collection:foo';
|
|
263
268
|
await el.updateComplete;
|
|
264
269
|
await el.initialSearchComplete;
|
|
265
|
-
expect(searchService.searchParams
|
|
270
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
266
271
|
expect(searchService.searchType).to.equal(SearchType.METADATA);
|
|
267
|
-
expect(el.shadowRoot
|
|
272
|
+
expect((_c = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#big-results-label')) === null || _c === void 0 ? void 0 : _c.textContent).to.contains('Results');
|
|
268
273
|
});
|
|
269
274
|
it('can change search type', async () => {
|
|
270
275
|
const searchService = new MockSearchService();
|
|
271
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
276
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
272
277
|
</collection-browser>`);
|
|
273
278
|
el.baseQuery = 'collection:foo';
|
|
274
279
|
await el.updateComplete;
|
|
@@ -278,45 +283,49 @@ describe('Collection Browser', () => {
|
|
|
278
283
|
expect(searchService.searchType).to.equal(SearchType.FULLTEXT);
|
|
279
284
|
});
|
|
280
285
|
it('queries the search service with a fulltext search', async () => {
|
|
286
|
+
var _a, _b, _c;
|
|
281
287
|
const searchService = new MockSearchService();
|
|
282
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
288
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
283
289
|
</collection-browser>`);
|
|
284
290
|
el.searchType = SearchType.FULLTEXT;
|
|
285
291
|
await el.updateComplete;
|
|
286
292
|
el.baseQuery = 'collection:foo';
|
|
287
293
|
await el.updateComplete;
|
|
288
294
|
await el.initialSearchComplete;
|
|
289
|
-
expect(searchService.searchParams
|
|
295
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
290
296
|
expect(searchService.searchType).to.equal(SearchType.FULLTEXT);
|
|
291
|
-
expect(el.shadowRoot
|
|
297
|
+
expect((_c = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#big-results-label')) === null || _c === void 0 ? void 0 : _c.textContent).to.contains('Results');
|
|
292
298
|
});
|
|
293
299
|
it('queries the search service with a radio search', async () => {
|
|
300
|
+
var _a, _b, _c;
|
|
294
301
|
const searchService = new MockSearchService();
|
|
295
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
302
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
296
303
|
</collection-browser>`);
|
|
297
304
|
el.searchType = SearchType.RADIO;
|
|
298
305
|
await el.updateComplete;
|
|
299
306
|
el.baseQuery = 'collection:foo';
|
|
300
307
|
await el.updateComplete;
|
|
301
308
|
await el.initialSearchComplete;
|
|
302
|
-
expect(searchService.searchParams
|
|
309
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
303
310
|
expect(searchService.searchType).to.equal(SearchType.RADIO);
|
|
304
|
-
expect(el.shadowRoot
|
|
311
|
+
expect((_c = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#big-results-label')) === null || _c === void 0 ? void 0 : _c.textContent).to.contains('Results');
|
|
305
312
|
});
|
|
306
313
|
it('queries the search service with a TV search', async () => {
|
|
314
|
+
var _a, _b, _c;
|
|
307
315
|
const searchService = new MockSearchService();
|
|
308
|
-
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
316
|
+
const el = await fixture(html ` <collection-browser .searchService=${searchService}>
|
|
309
317
|
</collection-browser>`);
|
|
310
318
|
el.searchType = SearchType.TV;
|
|
311
319
|
await el.updateComplete;
|
|
312
320
|
el.baseQuery = 'collection:foo';
|
|
313
321
|
await el.updateComplete;
|
|
314
322
|
await el.initialSearchComplete;
|
|
315
|
-
expect(searchService.searchParams
|
|
323
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
316
324
|
expect(searchService.searchType).to.equal(SearchType.TV);
|
|
317
|
-
expect(el.shadowRoot
|
|
325
|
+
expect((_c = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#big-results-label')) === null || _c === void 0 ? void 0 : _c.textContent).to.contains('Results');
|
|
318
326
|
});
|
|
319
327
|
it('queries the search service with facets selected/negated', async () => {
|
|
328
|
+
var _a, _b;
|
|
320
329
|
const searchService = new MockSearchService();
|
|
321
330
|
const selectedFacets = {
|
|
322
331
|
subject: {
|
|
@@ -344,14 +353,14 @@ describe('Collection Browser', () => {
|
|
|
344
353
|
collection: {},
|
|
345
354
|
year: {},
|
|
346
355
|
};
|
|
347
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
356
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
348
357
|
</collection-browser>`);
|
|
349
358
|
el.baseQuery = 'collection:foo';
|
|
350
359
|
el.selectedFacets = selectedFacets;
|
|
351
360
|
await el.updateComplete;
|
|
352
361
|
await el.initialSearchComplete;
|
|
353
|
-
expect(searchService.searchParams
|
|
354
|
-
expect(searchService.searchParams
|
|
362
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
363
|
+
expect((_b = searchService.searchParams) === null || _b === void 0 ? void 0 : _b.filters).to.deep.equal({
|
|
355
364
|
subject: {
|
|
356
365
|
foo: 'inc',
|
|
357
366
|
bar: 'exc',
|
|
@@ -362,13 +371,14 @@ describe('Collection Browser', () => {
|
|
|
362
371
|
});
|
|
363
372
|
});
|
|
364
373
|
it('fails gracefully if no search service provided', async () => {
|
|
374
|
+
var _a;
|
|
365
375
|
const el = await fixture(html `<collection-browser></collection-browser>`);
|
|
366
376
|
el.baseQuery = 'collection:foo';
|
|
367
377
|
await el.updateComplete;
|
|
368
378
|
// This shouldn't throw an error
|
|
369
379
|
expect(el.dataSource.fetchPage(3)).to.exist;
|
|
370
380
|
// Should continue showing the empty placeholder
|
|
371
|
-
expect(el.shadowRoot
|
|
381
|
+
expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('empty-placeholder')).to.exist;
|
|
372
382
|
});
|
|
373
383
|
it('restores search type from URL param', async () => {
|
|
374
384
|
// Add a sin=TXT param to the URL
|
|
@@ -376,7 +386,7 @@ describe('Collection Browser', () => {
|
|
|
376
386
|
url.searchParams.append('sin', 'TXT');
|
|
377
387
|
window.history.replaceState({}, '', url);
|
|
378
388
|
const searchService = new MockSearchService();
|
|
379
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
389
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
380
390
|
</collection-browser>`);
|
|
381
391
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
382
392
|
});
|
|
@@ -386,10 +396,10 @@ describe('Collection Browser', () => {
|
|
|
386
396
|
url.searchParams.append('sin', 'TXT');
|
|
387
397
|
window.history.replaceState({}, '', url);
|
|
388
398
|
const searchService = new MockSearchService();
|
|
389
|
-
const el = await fixture(html `<collection-browser
|
|
390
|
-
.searchService=${searchService}
|
|
391
|
-
suppressURLSinParam
|
|
392
|
-
>
|
|
399
|
+
const el = await fixture(html `<collection-browser
|
|
400
|
+
.searchService=${searchService}
|
|
401
|
+
suppressURLSinParam
|
|
402
|
+
>
|
|
393
403
|
</collection-browser>`);
|
|
394
404
|
url = new URL(window.location.href);
|
|
395
405
|
expect(el.searchType).to.equal(SearchType.DEFAULT);
|
|
@@ -401,7 +411,7 @@ describe('Collection Browser', () => {
|
|
|
401
411
|
});
|
|
402
412
|
it('can construct tile models with many fields present', async () => {
|
|
403
413
|
const searchService = new MockSearchService();
|
|
404
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
414
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
405
415
|
</collection-browser>`);
|
|
406
416
|
el.baseQuery = 'many-fields';
|
|
407
417
|
await el.updateComplete;
|
|
@@ -414,10 +424,10 @@ describe('Collection Browser', () => {
|
|
|
414
424
|
it('emits empty results event when search fetches no results', async () => {
|
|
415
425
|
const searchService = new MockSearchService();
|
|
416
426
|
const emptyResultsSpy = sinon.spy();
|
|
417
|
-
const el = await fixture(html `<collection-browser
|
|
418
|
-
.searchService=${searchService}
|
|
419
|
-
@emptyResults=${emptyResultsSpy}
|
|
420
|
-
>
|
|
427
|
+
const el = await fixture(html `<collection-browser
|
|
428
|
+
.searchService=${searchService}
|
|
429
|
+
@emptyResults=${emptyResultsSpy}
|
|
430
|
+
>
|
|
421
431
|
</collection-browser>`);
|
|
422
432
|
el.baseQuery = 'no-results';
|
|
423
433
|
await el.updateComplete;
|
|
@@ -427,10 +437,10 @@ describe('Collection Browser', () => {
|
|
|
427
437
|
it('emits searchError event when search results in an error', async () => {
|
|
428
438
|
const searchService = new MockSearchService();
|
|
429
439
|
const searchErrorSpy = sinon.spy();
|
|
430
|
-
const el = await fixture(html `<collection-browser
|
|
431
|
-
.searchService=${searchService}
|
|
432
|
-
@searchError=${searchErrorSpy}
|
|
433
|
-
>
|
|
440
|
+
const el = await fixture(html `<collection-browser
|
|
441
|
+
.searchService=${searchService}
|
|
442
|
+
@searchError=${searchErrorSpy}
|
|
443
|
+
>
|
|
434
444
|
</collection-browser>`);
|
|
435
445
|
el.baseQuery = 'error';
|
|
436
446
|
await el.updateComplete;
|
|
@@ -438,8 +448,9 @@ describe('Collection Browser', () => {
|
|
|
438
448
|
expect(searchErrorSpy.callCount).to.equal(1);
|
|
439
449
|
});
|
|
440
450
|
it('applies loggedin flag to tile models if needed', async () => {
|
|
451
|
+
var _a;
|
|
441
452
|
const searchService = new MockSearchService();
|
|
442
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
453
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
443
454
|
</collection-browser>`);
|
|
444
455
|
el.baseQuery = 'loggedin';
|
|
445
456
|
await el.updateComplete;
|
|
@@ -448,11 +459,12 @@ describe('Collection Browser', () => {
|
|
|
448
459
|
expect(cellTemplate).to.exist;
|
|
449
460
|
const cell = await fixture(cellTemplate);
|
|
450
461
|
expect(cell).to.exist;
|
|
451
|
-
expect(cell.model
|
|
462
|
+
expect((_a = cell.model) === null || _a === void 0 ? void 0 : _a.loginRequired).to.be.true;
|
|
452
463
|
});
|
|
453
464
|
it('applies no-preview flag to tile models if needed', async () => {
|
|
465
|
+
var _a;
|
|
454
466
|
const searchService = new MockSearchService();
|
|
455
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
467
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
456
468
|
</collection-browser>`);
|
|
457
469
|
el.baseQuery = 'no-preview';
|
|
458
470
|
await el.updateComplete;
|
|
@@ -461,11 +473,12 @@ describe('Collection Browser', () => {
|
|
|
461
473
|
expect(cellTemplate).to.exist;
|
|
462
474
|
const cell = await fixture(cellTemplate);
|
|
463
475
|
expect(cell).to.exist;
|
|
464
|
-
expect(cell.model
|
|
476
|
+
expect((_a = cell.model) === null || _a === void 0 ? void 0 : _a.contentWarning).to.be.true;
|
|
465
477
|
});
|
|
466
478
|
it('both loggedin and no-preview flags can be set simultaneously', async () => {
|
|
479
|
+
var _a, _b;
|
|
467
480
|
const searchService = new MockSearchService();
|
|
468
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
481
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
469
482
|
</collection-browser>`);
|
|
470
483
|
el.baseQuery = 'loggedin-no-preview';
|
|
471
484
|
await el.updateComplete;
|
|
@@ -474,12 +487,13 @@ describe('Collection Browser', () => {
|
|
|
474
487
|
expect(cellTemplate).to.exist;
|
|
475
488
|
const cell = await fixture(cellTemplate);
|
|
476
489
|
expect(cell).to.exist;
|
|
477
|
-
expect(cell.model
|
|
478
|
-
expect(cell.model
|
|
490
|
+
expect((_a = cell.model) === null || _a === void 0 ? void 0 : _a.loginRequired).to.be.true;
|
|
491
|
+
expect((_b = cell.model) === null || _b === void 0 ? void 0 : _b.contentWarning).to.be.true;
|
|
479
492
|
});
|
|
480
493
|
it('joins full description array into a single string with line breaks', async () => {
|
|
494
|
+
var _a;
|
|
481
495
|
const searchService = new MockSearchService();
|
|
482
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
496
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
483
497
|
</collection-browser>`);
|
|
484
498
|
// This query receives an array description like ['line1', 'line2']
|
|
485
499
|
el.baseQuery = 'multi-line-description';
|
|
@@ -490,54 +504,58 @@ describe('Collection Browser', () => {
|
|
|
490
504
|
const cell = await fixture(cellTemplate);
|
|
491
505
|
expect(cell).to.exist;
|
|
492
506
|
// Actual model description should be joined
|
|
493
|
-
expect(cell.model
|
|
507
|
+
expect((_a = cell.model) === null || _a === void 0 ? void 0 : _a.description).to.equal('line1\nline2');
|
|
494
508
|
});
|
|
495
509
|
it('can change search type', async () => {
|
|
510
|
+
var _a;
|
|
496
511
|
const searchService = new MockSearchService();
|
|
497
|
-
const el = await fixture(html `<collection-browser
|
|
498
|
-
.searchService=${searchService}
|
|
499
|
-
.searchType=${SearchType.METADATA}
|
|
512
|
+
const el = await fixture(html `<collection-browser
|
|
513
|
+
.searchService=${searchService}
|
|
514
|
+
.searchType=${SearchType.METADATA}
|
|
500
515
|
></collection-browser>`);
|
|
501
516
|
el.baseQuery = 'collection:foo';
|
|
502
517
|
el.searchType = SearchType.FULLTEXT;
|
|
503
518
|
await el.updateComplete;
|
|
504
519
|
await el.initialSearchComplete;
|
|
505
|
-
expect(searchService.searchParams
|
|
520
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
506
521
|
expect(searchService.searchType).to.equal(SearchType.FULLTEXT);
|
|
507
522
|
});
|
|
508
523
|
it('trims queries of leading/trailing whitespace', async () => {
|
|
524
|
+
var _a;
|
|
509
525
|
const searchService = new MockSearchService();
|
|
510
|
-
const el = await fixture(html `<collection-browser
|
|
511
|
-
.searchService=${searchService}
|
|
526
|
+
const el = await fixture(html `<collection-browser
|
|
527
|
+
.searchService=${searchService}
|
|
512
528
|
></collection-browser>`);
|
|
513
529
|
el.baseQuery = ' collection:foo ';
|
|
514
530
|
await el.updateComplete;
|
|
515
531
|
await el.initialSearchComplete;
|
|
516
|
-
expect(searchService.searchParams
|
|
532
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo');
|
|
517
533
|
});
|
|
518
534
|
it('shows error message when error response received', async () => {
|
|
535
|
+
var _a, _b;
|
|
519
536
|
const searchService = new MockSearchService();
|
|
520
|
-
const el = await fixture(html `<collection-browser
|
|
521
|
-
.searchService=${searchService}
|
|
537
|
+
const el = await fixture(html `<collection-browser
|
|
538
|
+
.searchService=${searchService}
|
|
522
539
|
></collection-browser>`);
|
|
523
540
|
el.baseQuery = 'error';
|
|
524
541
|
await el.updateComplete;
|
|
525
542
|
await el.initialSearchComplete;
|
|
526
|
-
const errorPlaceholder = el.shadowRoot
|
|
527
|
-
const errorDetails = errorPlaceholder
|
|
543
|
+
const errorPlaceholder = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('empty-placeholder');
|
|
544
|
+
const errorDetails = (_b = errorPlaceholder === null || errorPlaceholder === void 0 ? void 0 : errorPlaceholder.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.error-details');
|
|
528
545
|
expect(errorDetails).to.exist;
|
|
529
546
|
expect(errorDetails.textContent).to.contain('foo');
|
|
530
547
|
});
|
|
531
548
|
it('shows error message when error response received for a collection', async () => {
|
|
549
|
+
var _a, _b;
|
|
532
550
|
const searchService = new MockSearchService();
|
|
533
|
-
const el = await fixture(html `<collection-browser
|
|
534
|
-
.searchService=${searchService}
|
|
551
|
+
const el = await fixture(html `<collection-browser
|
|
552
|
+
.searchService=${searchService}
|
|
535
553
|
></collection-browser>`);
|
|
536
554
|
el.withinCollection = 'error';
|
|
537
555
|
await el.updateComplete;
|
|
538
556
|
await el.initialSearchComplete;
|
|
539
|
-
const errorPlaceholder = el.shadowRoot
|
|
540
|
-
const errorDetails = errorPlaceholder
|
|
557
|
+
const errorPlaceholder = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('empty-placeholder');
|
|
558
|
+
const errorDetails = (_b = errorPlaceholder === null || errorPlaceholder === void 0 ? void 0 : errorPlaceholder.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.error-details');
|
|
541
559
|
expect(errorDetails).to.exist;
|
|
542
560
|
expect(errorDetails.textContent).to.contain('foo');
|
|
543
561
|
});
|
|
@@ -546,8 +564,8 @@ describe('Collection Browser', () => {
|
|
|
546
564
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
547
565
|
window.Sentry = { captureMessage: sentrySpy };
|
|
548
566
|
const searchService = new MockSearchService();
|
|
549
|
-
const el = await fixture(html `<collection-browser
|
|
550
|
-
.searchService=${searchService}
|
|
567
|
+
const el = await fixture(html `<collection-browser
|
|
568
|
+
.searchService=${searchService}
|
|
551
569
|
></collection-browser>`);
|
|
552
570
|
el.baseQuery = 'malformed';
|
|
553
571
|
await el.updateComplete;
|
|
@@ -556,7 +574,7 @@ describe('Collection Browser', () => {
|
|
|
556
574
|
});
|
|
557
575
|
it('adds collection names to cache when present on response', async () => {
|
|
558
576
|
const searchService = new MockSearchService();
|
|
559
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
577
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
560
578
|
</collection-browser>`);
|
|
561
579
|
el.baseQuery = 'collection-titles';
|
|
562
580
|
await el.updateComplete;
|
|
@@ -568,7 +586,7 @@ describe('Collection Browser', () => {
|
|
|
568
586
|
});
|
|
569
587
|
it('adds tv channel aliases to cache when present on response', async () => {
|
|
570
588
|
const searchService = new MockSearchService();
|
|
571
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
589
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
572
590
|
</collection-browser>`);
|
|
573
591
|
el.baseQuery = 'channel-aliases';
|
|
574
592
|
await el.updateComplete;
|
|
@@ -582,7 +600,7 @@ describe('Collection Browser', () => {
|
|
|
582
600
|
asyncResponse: true,
|
|
583
601
|
resultsSpy,
|
|
584
602
|
});
|
|
585
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
603
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
586
604
|
</collection-browser>`);
|
|
587
605
|
el.baseQuery = 'with-sort';
|
|
588
606
|
el.selectedSort = SortField.date;
|
|
@@ -599,7 +617,7 @@ describe('Collection Browser', () => {
|
|
|
599
617
|
asyncResponse: true,
|
|
600
618
|
resultsSpy,
|
|
601
619
|
});
|
|
602
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
620
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
603
621
|
</collection-browser>`);
|
|
604
622
|
el.baseQuery = 'with-sort';
|
|
605
623
|
el.selectedSort = SortField.date;
|
|
@@ -621,7 +639,7 @@ describe('Collection Browser', () => {
|
|
|
621
639
|
asyncResponse: true,
|
|
622
640
|
resultsSpy,
|
|
623
641
|
});
|
|
624
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
642
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
625
643
|
</collection-browser>`);
|
|
626
644
|
el.baseQuery = 'single-result';
|
|
627
645
|
await el.updateComplete;
|
|
@@ -642,7 +660,7 @@ describe('Collection Browser', () => {
|
|
|
642
660
|
asyncResponse: true,
|
|
643
661
|
resultsSpy,
|
|
644
662
|
});
|
|
645
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
663
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
646
664
|
</collection-browser>`);
|
|
647
665
|
el.baseQuery = 'with-sort';
|
|
648
666
|
el.selectedSort = SortField.date;
|
|
@@ -659,34 +677,32 @@ describe('Collection Browser', () => {
|
|
|
659
677
|
expect(resultsSpy.callCount).to.equal(0);
|
|
660
678
|
});
|
|
661
679
|
it('sets sort properties when user changes sort', async () => {
|
|
680
|
+
var _a, _b, _c, _d, _e, _f;
|
|
662
681
|
const searchService = new MockSearchService();
|
|
663
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
682
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
664
683
|
</collection-browser>`);
|
|
665
684
|
expect(el.selectedSort).to.equal(SortField.default);
|
|
666
685
|
el.baseQuery = 'foo';
|
|
667
686
|
await el.updateComplete;
|
|
668
687
|
await nextTick();
|
|
669
|
-
const sortBar = el.shadowRoot
|
|
670
|
-
const sortSelector = sortBar
|
|
688
|
+
const sortBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#content-container sort-filter-bar');
|
|
689
|
+
const sortSelector = (_b = sortBar === null || sortBar === void 0 ? void 0 : sortBar.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#desktop-sort-selector');
|
|
671
690
|
expect(sortSelector, 'sort bar').to.exist;
|
|
672
691
|
// Click the title sorter
|
|
673
|
-
Array.from(sortSelector.children)
|
|
674
|
-
.find(child => child.textContent
|
|
675
|
-
?.querySelector('button')
|
|
676
|
-
?.click();
|
|
692
|
+
(_d = (_c = Array.from(sortSelector.children)
|
|
693
|
+
.find(child => { var _a; return ((_a = child.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === 'Title'; })) === null || _c === void 0 ? void 0 : _c.querySelector('button')) === null || _d === void 0 ? void 0 : _d.click();
|
|
677
694
|
await el.updateComplete;
|
|
678
695
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
679
696
|
// Click the creator sorter
|
|
680
|
-
Array.from(sortSelector.children)
|
|
681
|
-
.find(child => child.textContent
|
|
682
|
-
?.querySelector('button')
|
|
683
|
-
?.click();
|
|
697
|
+
(_f = (_e = Array.from(sortSelector.children)
|
|
698
|
+
.find(child => { var _a; return ((_a = child.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === 'Creator'; })) === null || _e === void 0 ? void 0 : _e.querySelector('button')) === null || _f === void 0 ? void 0 : _f.click();
|
|
684
699
|
await el.updateComplete;
|
|
685
700
|
expect(el.selectedSort).to.equal(SortField.creator);
|
|
686
701
|
});
|
|
687
702
|
it('sets sort filter properties when user selects title filter', async () => {
|
|
703
|
+
var _a, _b, _c, _d;
|
|
688
704
|
const searchService = new MockSearchService();
|
|
689
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
705
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
690
706
|
</collection-browser>`);
|
|
691
707
|
el.baseQuery = 'first-title';
|
|
692
708
|
el.selectedSort = 'title';
|
|
@@ -694,12 +710,13 @@ describe('Collection Browser', () => {
|
|
|
694
710
|
el.selectedTitleFilter = 'X';
|
|
695
711
|
await el.updateComplete;
|
|
696
712
|
await el.initialSearchComplete;
|
|
697
|
-
expect(searchService.searchParams
|
|
698
|
-
expect(searchService.searchParams
|
|
713
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('first-title');
|
|
714
|
+
expect((_d = (_c = (_b = searchService.searchParams) === null || _b === void 0 ? void 0 : _b.filters) === null || _c === void 0 ? void 0 : _c.firstTitle) === null || _d === void 0 ? void 0 : _d.X).to.equal(FilterConstraint.INCLUDE);
|
|
699
715
|
});
|
|
700
716
|
it('sets sort filter properties when user selects creator filter', async () => {
|
|
717
|
+
var _a, _b, _c, _d;
|
|
701
718
|
const searchService = new MockSearchService();
|
|
702
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
719
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
703
720
|
</collection-browser>`);
|
|
704
721
|
el.baseQuery = 'first-creator';
|
|
705
722
|
el.selectedSort = 'creator';
|
|
@@ -707,10 +724,11 @@ describe('Collection Browser', () => {
|
|
|
707
724
|
el.selectedCreatorFilter = 'X';
|
|
708
725
|
await el.updateComplete;
|
|
709
726
|
await el.initialSearchComplete;
|
|
710
|
-
expect(searchService.searchParams
|
|
711
|
-
expect(searchService.searchParams
|
|
727
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('first-creator');
|
|
728
|
+
expect((_d = (_c = (_b = searchService.searchParams) === null || _b === void 0 ? void 0 : _b.filters) === null || _c === void 0 ? void 0 : _c.firstCreator) === null || _d === void 0 ? void 0 : _d.X).to.equal(FilterConstraint.INCLUDE);
|
|
712
729
|
});
|
|
713
730
|
it('sets sort filter properties simultaneous with facets and date range', async () => {
|
|
731
|
+
var _a, _b;
|
|
714
732
|
const searchService = new MockSearchService();
|
|
715
733
|
const selectedFacets = {
|
|
716
734
|
collection: { foo: { key: 'foo', state: 'selected', count: 1 } },
|
|
@@ -721,7 +739,7 @@ describe('Collection Browser', () => {
|
|
|
721
739
|
subject: {},
|
|
722
740
|
year: {},
|
|
723
741
|
};
|
|
724
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
742
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
725
743
|
</collection-browser>`);
|
|
726
744
|
el.baseQuery = 'first-creator';
|
|
727
745
|
el.selectedSort = 'creator';
|
|
@@ -732,8 +750,8 @@ describe('Collection Browser', () => {
|
|
|
732
750
|
el.selectedCreatorFilter = 'X';
|
|
733
751
|
await el.updateComplete;
|
|
734
752
|
await el.initialSearchComplete;
|
|
735
|
-
expect(searchService.searchParams
|
|
736
|
-
expect(searchService.searchParams
|
|
753
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('first-creator');
|
|
754
|
+
expect((_b = searchService.searchParams) === null || _b === void 0 ? void 0 : _b.filters).to.deep.equal({
|
|
737
755
|
collection: {
|
|
738
756
|
foo: 'inc',
|
|
739
757
|
},
|
|
@@ -746,52 +764,46 @@ describe('Collection Browser', () => {
|
|
|
746
764
|
},
|
|
747
765
|
});
|
|
748
766
|
});
|
|
749
|
-
it('applies correct TV
|
|
767
|
+
it('applies correct search filter when TV clip filter set to commercials', async () => {
|
|
768
|
+
var _a, _b, _c;
|
|
750
769
|
const searchService = new MockSearchService();
|
|
751
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
770
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
752
771
|
</collection-browser>`);
|
|
753
772
|
el.baseQuery = 'tv-fields';
|
|
754
773
|
el.searchType = SearchType.TV;
|
|
755
|
-
el.
|
|
756
|
-
clip_type: {
|
|
757
|
-
commercial: { key: 'commercial', count: 1, state: 'selected' },
|
|
758
|
-
},
|
|
759
|
-
};
|
|
774
|
+
el.tvClipFilter = 'commercials';
|
|
760
775
|
await el.updateComplete;
|
|
761
776
|
await el.initialSearchComplete;
|
|
762
|
-
expect(searchService.searchParams
|
|
777
|
+
expect((_c = (_b = (_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.ad_id) === null || _c === void 0 ? void 0 : _c['*']).to.equal(FilterConstraint.INCLUDE);
|
|
763
778
|
});
|
|
764
|
-
it('applies correct TV
|
|
779
|
+
it('applies correct search filter when TV clip filter set to factchecks', async () => {
|
|
780
|
+
var _a, _b, _c;
|
|
765
781
|
const searchService = new MockSearchService();
|
|
766
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
782
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
767
783
|
</collection-browser>`);
|
|
768
784
|
el.baseQuery = 'tv-fields';
|
|
769
785
|
el.searchType = SearchType.TV;
|
|
770
|
-
el.
|
|
771
|
-
clip_type: {
|
|
772
|
-
'fact check': { key: 'fact check', count: 1, state: 'selected' },
|
|
773
|
-
},
|
|
774
|
-
};
|
|
786
|
+
el.tvClipFilter = 'factchecks';
|
|
775
787
|
await el.updateComplete;
|
|
776
788
|
await el.initialSearchComplete;
|
|
777
|
-
expect(searchService.searchParams
|
|
789
|
+
expect((_c = (_b = (_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.factcheck) === null || _c === void 0 ? void 0 : _c['*']).to.equal(FilterConstraint.INCLUDE);
|
|
778
790
|
});
|
|
779
|
-
it('applies correct TV
|
|
791
|
+
it('applies correct search filter when TV clip filter set to quotes', async () => {
|
|
792
|
+
var _a, _b, _c;
|
|
780
793
|
const searchService = new MockSearchService();
|
|
781
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
794
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
782
795
|
</collection-browser>`);
|
|
783
796
|
el.baseQuery = 'tv-fields';
|
|
784
797
|
el.searchType = SearchType.TV;
|
|
785
|
-
el.
|
|
786
|
-
clip_type: { quote: { key: 'quote', count: 1, state: 'selected' } },
|
|
787
|
-
};
|
|
798
|
+
el.tvClipFilter = 'quotes';
|
|
788
799
|
await el.updateComplete;
|
|
789
800
|
await el.initialSearchComplete;
|
|
790
|
-
expect(searchService.searchParams
|
|
801
|
+
expect((_c = (_b = (_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.filters) === null || _b === void 0 ? void 0 : _b.clip) === null || _c === void 0 ? void 0 : _c['1']).to.equal(FilterConstraint.INCLUDE);
|
|
791
802
|
});
|
|
792
803
|
it('resets letter filters when query changes', async () => {
|
|
804
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
793
805
|
const searchService = new MockSearchService();
|
|
794
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
806
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
795
807
|
</collection-browser>`);
|
|
796
808
|
el.baseQuery = 'first-creator';
|
|
797
809
|
el.selectedSort = 'creator';
|
|
@@ -800,34 +812,35 @@ describe('Collection Browser', () => {
|
|
|
800
812
|
await el.updateComplete;
|
|
801
813
|
await el.initialSearchComplete;
|
|
802
814
|
await nextTick();
|
|
803
|
-
expect(searchService.searchParams
|
|
804
|
-
expect(searchService.searchParams
|
|
815
|
+
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('first-creator');
|
|
816
|
+
expect((_d = (_c = (_b = searchService.searchParams) === null || _b === void 0 ? void 0 : _b.filters) === null || _c === void 0 ? void 0 : _c.firstCreator) === null || _d === void 0 ? void 0 : _d.X).to.equal(FilterConstraint.INCLUDE);
|
|
805
817
|
el.baseQuery = 'collection:foo';
|
|
806
818
|
await el.updateComplete;
|
|
807
819
|
await nextTick();
|
|
808
|
-
expect(searchService.searchParams
|
|
809
|
-
expect(searchService.searchParams
|
|
820
|
+
expect((_e = searchService.searchParams) === null || _e === void 0 ? void 0 : _e.query).to.equal('collection:foo');
|
|
821
|
+
expect((_g = (_f = searchService.searchParams) === null || _f === void 0 ? void 0 : _f.filters) === null || _g === void 0 ? void 0 : _g.firstCreator).not.to.exist;
|
|
810
822
|
});
|
|
811
823
|
it('sets date range query when date picker selection changed', async () => {
|
|
824
|
+
var _a, _b, _c;
|
|
812
825
|
const searchService = new MockSearchService();
|
|
813
826
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
814
|
-
const el = await fixture(html `<collection-browser
|
|
815
|
-
.searchService=${searchService}
|
|
816
|
-
.analyticsHandler=${mockAnalyticsHandler}
|
|
817
|
-
.suppressPlaceholders=${true}
|
|
818
|
-
>
|
|
827
|
+
const el = await fixture(html `<collection-browser
|
|
828
|
+
.searchService=${searchService}
|
|
829
|
+
.analyticsHandler=${mockAnalyticsHandler}
|
|
830
|
+
.suppressPlaceholders=${true}
|
|
831
|
+
>
|
|
819
832
|
</collection-browser>`);
|
|
820
833
|
el.baseQuery = 'years'; // Includes year_histogram aggregation in response
|
|
821
834
|
el.showHistogramDatePicker = true;
|
|
822
835
|
await el.updateComplete;
|
|
823
|
-
const facets = el.shadowRoot
|
|
824
|
-
await facets
|
|
836
|
+
const facets = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('collection-facets');
|
|
837
|
+
await (facets === null || facets === void 0 ? void 0 : facets.updateComplete);
|
|
825
838
|
// Wait for the date picker to be rendered (which may take until the next tick)
|
|
826
839
|
await nextTick();
|
|
827
|
-
const histogram = facets
|
|
840
|
+
const histogram = (_b = facets === null || facets === void 0 ? void 0 : facets.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('histogram-date-range');
|
|
828
841
|
expect(histogram, 'histogram exists').to.exist;
|
|
829
842
|
// Enter a new min date into the date picker
|
|
830
|
-
const minDateInput = histogram.shadowRoot
|
|
843
|
+
const minDateInput = (_c = histogram.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('#date-min');
|
|
831
844
|
const pressEnterEvent = new KeyboardEvent('keyup', {
|
|
832
845
|
key: 'Enter',
|
|
833
846
|
});
|
|
@@ -842,24 +855,25 @@ describe('Collection Browser', () => {
|
|
|
842
855
|
expect(el.maxSelectedDate).to.equal('2009');
|
|
843
856
|
});
|
|
844
857
|
it('sets date range query when monthly date picker selection changed', async () => {
|
|
858
|
+
var _a, _b, _c;
|
|
845
859
|
const searchService = new MockSearchService();
|
|
846
|
-
const el = await fixture(html `<collection-browser
|
|
847
|
-
.searchService=${searchService}
|
|
848
|
-
.suppressPlaceholders=${true}
|
|
849
|
-
>
|
|
860
|
+
const el = await fixture(html `<collection-browser
|
|
861
|
+
.searchService=${searchService}
|
|
862
|
+
.suppressPlaceholders=${true}
|
|
863
|
+
>
|
|
850
864
|
</collection-browser>`);
|
|
851
865
|
el.baseQuery = 'months'; // Includes date_histogram aggregation in response
|
|
852
866
|
el.searchType = SearchType.TV;
|
|
853
867
|
el.showHistogramDatePicker = true;
|
|
854
868
|
await el.updateComplete;
|
|
855
|
-
const facets = el.shadowRoot
|
|
856
|
-
await facets
|
|
869
|
+
const facets = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('collection-facets');
|
|
870
|
+
await (facets === null || facets === void 0 ? void 0 : facets.updateComplete);
|
|
857
871
|
// Wait for the date picker to be rendered (which may take until the next tick)
|
|
858
872
|
await nextTick();
|
|
859
|
-
const histogram = facets
|
|
873
|
+
const histogram = (_b = facets === null || facets === void 0 ? void 0 : facets.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('histogram-date-range');
|
|
860
874
|
expect(histogram, 'histogram exists').to.exist;
|
|
861
875
|
// Enter a new min date into the date picker
|
|
862
|
-
const minDateInput = histogram.shadowRoot
|
|
876
|
+
const minDateInput = (_c = histogram.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('#date-min');
|
|
863
877
|
const pressEnterEvent = new KeyboardEvent('keyup', {
|
|
864
878
|
key: 'Enter',
|
|
865
879
|
});
|
|
@@ -874,11 +888,12 @@ describe('Collection Browser', () => {
|
|
|
874
888
|
expect(el.maxSelectedDate).to.equal('2002-12');
|
|
875
889
|
});
|
|
876
890
|
it('emits event when results start and end loading', async () => {
|
|
891
|
+
var _a, _b, _c, _d;
|
|
877
892
|
const spy = sinon.spy();
|
|
878
893
|
const searchService = new MockSearchService();
|
|
879
|
-
const el = await fixture(html `<collection-browser
|
|
880
|
-
.searchService=${searchService}
|
|
881
|
-
@searchResultsLoadingChanged=${spy}
|
|
894
|
+
const el = await fixture(html `<collection-browser
|
|
895
|
+
.searchService=${searchService}
|
|
896
|
+
@searchResultsLoadingChanged=${spy}
|
|
882
897
|
></collection-browser>`);
|
|
883
898
|
spy.resetHistory();
|
|
884
899
|
el.baseQuery = 'collection:foo';
|
|
@@ -886,14 +901,15 @@ describe('Collection Browser', () => {
|
|
|
886
901
|
await el.initialSearchComplete;
|
|
887
902
|
// Should initially emit loading=true, then later emit loading=false
|
|
888
903
|
expect(spy.callCount).to.equal(2);
|
|
889
|
-
expect(spy.firstCall.firstArg
|
|
890
|
-
expect(spy.secondCall.firstArg
|
|
904
|
+
expect((_b = (_a = spy.firstCall.firstArg) === null || _a === void 0 ? void 0 : _a.detail) === null || _b === void 0 ? void 0 : _b.loading).to.equal(true);
|
|
905
|
+
expect((_d = (_c = spy.secondCall.firstArg) === null || _c === void 0 ? void 0 : _c.detail) === null || _d === void 0 ? void 0 : _d.loading).to.equal(false);
|
|
891
906
|
});
|
|
892
907
|
it('collapses extra set of quotes around href field', async () => {
|
|
908
|
+
var _a;
|
|
893
909
|
const searchService = new MockSearchService();
|
|
894
|
-
const el = await fixture(html `<collection-browser
|
|
895
|
-
.searchService=${searchService}
|
|
896
|
-
.baseNavigationUrl=${''}
|
|
910
|
+
const el = await fixture(html `<collection-browser
|
|
911
|
+
.searchService=${searchService}
|
|
912
|
+
.baseNavigationUrl=${''}
|
|
897
913
|
></collection-browser>`);
|
|
898
914
|
el.baseQuery = 'extra-quoted-href';
|
|
899
915
|
await el.updateComplete;
|
|
@@ -901,20 +917,21 @@ describe('Collection Browser', () => {
|
|
|
901
917
|
await el.updateComplete;
|
|
902
918
|
await aTimeout(50);
|
|
903
919
|
// Original href q param starts/ends with %22%22, but should be collapsed to %22 before render
|
|
904
|
-
expect(el.dataSource.getTileModelAt(0)
|
|
920
|
+
expect((_a = el.dataSource.getTileModelAt(0)) === null || _a === void 0 ? void 0 : _a.href).to.equal('/details/foo?q=%22quoted+query%22');
|
|
905
921
|
});
|
|
906
922
|
it('sets default sort from collection metadata', async () => {
|
|
923
|
+
var _a;
|
|
907
924
|
const searchService = new MockSearchService();
|
|
908
|
-
const el = await fixture(html `<collection-browser
|
|
909
|
-
.searchService=${searchService}
|
|
910
|
-
.baseNavigationUrl=${''}
|
|
925
|
+
const el = await fixture(html `<collection-browser
|
|
926
|
+
.searchService=${searchService}
|
|
927
|
+
.baseNavigationUrl=${''}
|
|
911
928
|
></collection-browser>`);
|
|
912
929
|
el.withinCollection = 'default-sort';
|
|
913
930
|
await el.updateComplete;
|
|
914
931
|
await el.initialSearchComplete;
|
|
915
932
|
await el.updateComplete;
|
|
916
933
|
await aTimeout(50);
|
|
917
|
-
const sortBar = el.shadowRoot
|
|
934
|
+
const sortBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('sort-filter-bar');
|
|
918
935
|
expect(sortBar).to.exist;
|
|
919
936
|
expect(sortBar.defaultSortField).to.equal(SortField.title);
|
|
920
937
|
expect(sortBar.defaultSortDirection).to.equal('asc');
|
|
@@ -922,17 +939,18 @@ describe('Collection Browser', () => {
|
|
|
922
939
|
expect(sortBar.sortDirection).to.be.null;
|
|
923
940
|
});
|
|
924
941
|
it('sets default sort from collection metadata in "-field" format', async () => {
|
|
942
|
+
var _a;
|
|
925
943
|
const searchService = new MockSearchService();
|
|
926
|
-
const el = await fixture(html `<collection-browser
|
|
927
|
-
.searchService=${searchService}
|
|
928
|
-
.baseNavigationUrl=${''}
|
|
944
|
+
const el = await fixture(html `<collection-browser
|
|
945
|
+
.searchService=${searchService}
|
|
946
|
+
.baseNavigationUrl=${''}
|
|
929
947
|
></collection-browser>`);
|
|
930
948
|
el.withinCollection = 'default-sort-concise';
|
|
931
949
|
await el.updateComplete;
|
|
932
950
|
await el.initialSearchComplete;
|
|
933
951
|
await el.updateComplete;
|
|
934
952
|
await aTimeout(50);
|
|
935
|
-
const sortBar = el.shadowRoot
|
|
953
|
+
const sortBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('sort-filter-bar');
|
|
936
954
|
expect(sortBar).to.exist;
|
|
937
955
|
expect(sortBar.defaultSortField).to.equal(SortField.dateadded);
|
|
938
956
|
expect(sortBar.defaultSortDirection).to.equal('desc');
|
|
@@ -940,8 +958,8 @@ describe('Collection Browser', () => {
|
|
|
940
958
|
expect(sortBar.sortDirection).to.be.null;
|
|
941
959
|
});
|
|
942
960
|
it('falls back to weekly views default sorting on profiles when tab not set', async () => {
|
|
943
|
-
const el = await fixture(html `<collection-browser
|
|
944
|
-
.withinProfile=${'@foobar'}
|
|
961
|
+
const el = await fixture(html `<collection-browser
|
|
962
|
+
.withinProfile=${'@foobar'}
|
|
945
963
|
></collection-browser>`);
|
|
946
964
|
el.applyDefaultProfileSort();
|
|
947
965
|
expect(el.defaultSortParam).to.deep.equal({
|
|
@@ -950,10 +968,11 @@ describe('Collection Browser', () => {
|
|
|
950
968
|
});
|
|
951
969
|
});
|
|
952
970
|
it('uses relevance sort as default when a query is set', async () => {
|
|
971
|
+
var _a;
|
|
953
972
|
const searchService = new MockSearchService();
|
|
954
|
-
const el = await fixture(html `<collection-browser
|
|
955
|
-
.searchService=${searchService}
|
|
956
|
-
.baseNavigationUrl=${''}
|
|
973
|
+
const el = await fixture(html `<collection-browser
|
|
974
|
+
.searchService=${searchService}
|
|
975
|
+
.baseNavigationUrl=${''}
|
|
957
976
|
></collection-browser>`);
|
|
958
977
|
el.withinCollection = 'default-sort';
|
|
959
978
|
el.baseQuery = 'default-sort';
|
|
@@ -961,7 +980,7 @@ describe('Collection Browser', () => {
|
|
|
961
980
|
await el.initialSearchComplete;
|
|
962
981
|
await el.updateComplete;
|
|
963
982
|
await aTimeout(50);
|
|
964
|
-
const sortBar = el.shadowRoot
|
|
983
|
+
const sortBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('sort-filter-bar');
|
|
965
984
|
expect(sortBar).to.exist;
|
|
966
985
|
expect(sortBar.defaultSortField).to.equal(SortField.relevance);
|
|
967
986
|
expect(sortBar.defaultSortDirection).to.be.null;
|
|
@@ -969,17 +988,18 @@ describe('Collection Browser', () => {
|
|
|
969
988
|
expect(sortBar.sortDirection).to.be.null;
|
|
970
989
|
});
|
|
971
990
|
it('uses date favorited sort as default when targeting fav- collection', async () => {
|
|
991
|
+
var _a;
|
|
972
992
|
const searchService = new MockSearchService();
|
|
973
|
-
const el = await fixture(html `<collection-browser
|
|
974
|
-
.searchService=${searchService}
|
|
975
|
-
.baseNavigationUrl=${''}
|
|
993
|
+
const el = await fixture(html `<collection-browser
|
|
994
|
+
.searchService=${searchService}
|
|
995
|
+
.baseNavigationUrl=${''}
|
|
976
996
|
></collection-browser>`);
|
|
977
997
|
el.withinCollection = 'fav-sort';
|
|
978
998
|
await el.updateComplete;
|
|
979
999
|
await el.initialSearchComplete;
|
|
980
1000
|
await el.updateComplete;
|
|
981
1001
|
await aTimeout(50);
|
|
982
|
-
const sortBar = el.shadowRoot
|
|
1002
|
+
const sortBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('sort-filter-bar');
|
|
983
1003
|
expect(sortBar).to.exist;
|
|
984
1004
|
expect(sortBar.defaultSortField).to.equal(SortField.datefavorited);
|
|
985
1005
|
expect(sortBar.defaultSortDirection).to.equal('desc');
|
|
@@ -987,8 +1007,9 @@ describe('Collection Browser', () => {
|
|
|
987
1007
|
expect(sortBar.sortDirection).to.be.null;
|
|
988
1008
|
});
|
|
989
1009
|
it('scrolls to page', async () => {
|
|
1010
|
+
var _a;
|
|
990
1011
|
const searchService = new MockSearchService();
|
|
991
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1012
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
992
1013
|
</collection-browser>`);
|
|
993
1014
|
// Infinite scroller won't exist unless there's a base query.
|
|
994
1015
|
// First ensure that we don't throw errors when it doesn't exist.
|
|
@@ -998,7 +1019,7 @@ describe('Collection Browser', () => {
|
|
|
998
1019
|
el.baseQuery = 'collection:foo';
|
|
999
1020
|
await el.updateComplete;
|
|
1000
1021
|
await nextTick();
|
|
1001
|
-
const infiniteScroller = el.shadowRoot
|
|
1022
|
+
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
1002
1023
|
expect(infiniteScroller).to.exist;
|
|
1003
1024
|
const oldScrollToCell = infiniteScroller.scrollToCell;
|
|
1004
1025
|
const spy = sinon.spy();
|
|
@@ -1008,14 +1029,15 @@ describe('Collection Browser', () => {
|
|
|
1008
1029
|
infiniteScroller.scrollToCell = oldScrollToCell;
|
|
1009
1030
|
});
|
|
1010
1031
|
it('shows mobile facets in mobile view', async () => {
|
|
1032
|
+
var _a, _b;
|
|
1011
1033
|
const searchService = new MockSearchService();
|
|
1012
|
-
const el = await fixture(html `<collection-browser
|
|
1013
|
-
.searchService=${searchService}
|
|
1014
|
-
.mobileBreakpoint=${9999}
|
|
1034
|
+
const el = await fixture(html `<collection-browser
|
|
1035
|
+
.searchService=${searchService}
|
|
1036
|
+
.mobileBreakpoint=${9999}
|
|
1015
1037
|
></collection-browser>`);
|
|
1016
1038
|
el.baseQuery = 'collection:foo';
|
|
1017
1039
|
await el.updateComplete;
|
|
1018
|
-
const contentContainer = el.shadowRoot
|
|
1040
|
+
const contentContainer = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#content-container');
|
|
1019
1041
|
el.handleResize({
|
|
1020
1042
|
target: contentContainer,
|
|
1021
1043
|
contentRect: contentContainer.getBoundingClientRect(),
|
|
@@ -1024,21 +1046,22 @@ describe('Collection Browser', () => {
|
|
|
1024
1046
|
devicePixelContentBoxSize: [],
|
|
1025
1047
|
});
|
|
1026
1048
|
await el.updateComplete;
|
|
1027
|
-
const mobileFacets = el.shadowRoot
|
|
1049
|
+
const mobileFacets = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#mobile-filter-collapse');
|
|
1028
1050
|
expect(mobileFacets).to.exist;
|
|
1029
1051
|
});
|
|
1030
1052
|
it('fires analytics when mobile facets toggled', async () => {
|
|
1053
|
+
var _a, _b;
|
|
1031
1054
|
const searchService = new MockSearchService();
|
|
1032
1055
|
const analyticsHandler = new MockAnalyticsHandler();
|
|
1033
|
-
const el = await fixture(html `<collection-browser
|
|
1034
|
-
.searchService=${searchService}
|
|
1035
|
-
.analyticsHandler=${analyticsHandler}
|
|
1036
|
-
.searchContext=${'foobar-context'}
|
|
1037
|
-
.mobileBreakpoint=${9999}
|
|
1056
|
+
const el = await fixture(html `<collection-browser
|
|
1057
|
+
.searchService=${searchService}
|
|
1058
|
+
.analyticsHandler=${analyticsHandler}
|
|
1059
|
+
.searchContext=${'foobar-context'}
|
|
1060
|
+
.mobileBreakpoint=${9999}
|
|
1038
1061
|
></collection-browser>`);
|
|
1039
1062
|
el.baseQuery = 'collection:foo';
|
|
1040
1063
|
await el.updateComplete;
|
|
1041
|
-
const contentContainer = el.shadowRoot
|
|
1064
|
+
const contentContainer = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#content-container');
|
|
1042
1065
|
el.handleResize({
|
|
1043
1066
|
target: contentContainer,
|
|
1044
1067
|
contentRect: contentContainer.getBoundingClientRect(),
|
|
@@ -1047,7 +1070,7 @@ describe('Collection Browser', () => {
|
|
|
1047
1070
|
devicePixelContentBoxSize: [],
|
|
1048
1071
|
});
|
|
1049
1072
|
await el.updateComplete;
|
|
1050
|
-
const mobileFacets = el.shadowRoot
|
|
1073
|
+
const mobileFacets = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('#mobile-filter-collapse');
|
|
1051
1074
|
expect(mobileFacets).to.exist;
|
|
1052
1075
|
// We set up a Promise to wait for the 'toggle' event on the collapser,
|
|
1053
1076
|
// which is what triggers the analytics.
|
|
@@ -1074,9 +1097,9 @@ describe('Collection Browser', () => {
|
|
|
1074
1097
|
});
|
|
1075
1098
|
it('sets parent collections to prop when searching a collection', async () => {
|
|
1076
1099
|
const searchService = new MockSearchService();
|
|
1077
|
-
const el = await fixture(html `<collection-browser
|
|
1078
|
-
.searchService=${searchService}
|
|
1079
|
-
.withinCollection=${'fake'}
|
|
1100
|
+
const el = await fixture(html `<collection-browser
|
|
1101
|
+
.searchService=${searchService}
|
|
1102
|
+
.withinCollection=${'fake'}
|
|
1080
1103
|
></collection-browser>`);
|
|
1081
1104
|
el.baseQuery = 'parent-collections';
|
|
1082
1105
|
await el.updateComplete;
|
|
@@ -1086,9 +1109,9 @@ describe('Collection Browser', () => {
|
|
|
1086
1109
|
});
|
|
1087
1110
|
it('recognizes TV collections', async () => {
|
|
1088
1111
|
const searchService = new MockSearchService();
|
|
1089
|
-
const el = await fixture(html `<collection-browser
|
|
1090
|
-
.searchService=${searchService}
|
|
1091
|
-
.withinCollection=${'TV-FOO'}
|
|
1112
|
+
const el = await fixture(html `<collection-browser
|
|
1113
|
+
.searchService=${searchService}
|
|
1114
|
+
.withinCollection=${'TV-FOO'}
|
|
1092
1115
|
></collection-browser>`);
|
|
1093
1116
|
el.baseQuery = 'tv-collection';
|
|
1094
1117
|
await el.updateComplete;
|
|
@@ -1097,18 +1120,19 @@ describe('Collection Browser', () => {
|
|
|
1097
1120
|
expect(el.isTVCollection).to.be.true;
|
|
1098
1121
|
});
|
|
1099
1122
|
it('refreshes when certain properties change - with some analytics event sampling', async () => {
|
|
1123
|
+
var _a;
|
|
1100
1124
|
const mockAnalyticsHandler = new MockAnalyticsHandler();
|
|
1101
1125
|
const searchService = new MockSearchService();
|
|
1102
|
-
const el = await fixture(html `<collection-browser
|
|
1103
|
-
.analyticsHandler=${mockAnalyticsHandler}
|
|
1104
|
-
.searchService=${searchService}
|
|
1126
|
+
const el = await fixture(html `<collection-browser
|
|
1127
|
+
.analyticsHandler=${mockAnalyticsHandler}
|
|
1128
|
+
.searchService=${searchService}
|
|
1105
1129
|
></collection-browser>`);
|
|
1106
1130
|
const infiniteScrollerRefreshSpy = sinon.spy();
|
|
1107
1131
|
// Infinite scroller won't exist unless there's a base query
|
|
1108
1132
|
el.baseQuery = 'collection:foo';
|
|
1109
1133
|
await el.updateComplete;
|
|
1110
1134
|
await nextTick();
|
|
1111
|
-
const infiniteScroller = el.shadowRoot
|
|
1135
|
+
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
1112
1136
|
infiniteScroller.reload = infiniteScrollerRefreshSpy;
|
|
1113
1137
|
expect(infiniteScrollerRefreshSpy.called).to.be.false;
|
|
1114
1138
|
expect(infiniteScrollerRefreshSpy.callCount).to.equal(0);
|
|
@@ -1145,13 +1169,14 @@ describe('Collection Browser', () => {
|
|
|
1145
1169
|
expect(infiniteScrollerRefreshSpy.callCount, '6th Infinite Scroller Refresh').to.equal(6);
|
|
1146
1170
|
});
|
|
1147
1171
|
it('query the search service for single result', async () => {
|
|
1172
|
+
var _a, _b;
|
|
1148
1173
|
const searchService = new MockSearchService();
|
|
1149
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1174
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1150
1175
|
</collection-browser>`);
|
|
1151
1176
|
el.baseQuery = 'single-result';
|
|
1152
1177
|
await el.updateComplete;
|
|
1153
1178
|
await el.initialSearchComplete;
|
|
1154
|
-
expect(el.shadowRoot
|
|
1179
|
+
expect((_b = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#big-results-label')) === null || _b === void 0 ? void 0 : _b.textContent).to.contains('Result');
|
|
1155
1180
|
});
|
|
1156
1181
|
it('`searchContext` prop helps describe where component is being used', async () => {
|
|
1157
1182
|
const el = await fixture(html `<collection-browser></collection-browser>`);
|
|
@@ -1163,6 +1188,7 @@ describe('Collection Browser', () => {
|
|
|
1163
1188
|
expect(el.getAttribute('searchcontext')).to.equal('unicorn-search');
|
|
1164
1189
|
});
|
|
1165
1190
|
it('respects the initial set of URL parameters for a general search', async () => {
|
|
1191
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1166
1192
|
const url = new URL(window.location.href);
|
|
1167
1193
|
const { searchParams } = url;
|
|
1168
1194
|
searchParams.set('query', 'foo');
|
|
@@ -1174,20 +1200,21 @@ describe('Collection Browser', () => {
|
|
|
1174
1200
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1175
1201
|
window.history.replaceState({}, '', url);
|
|
1176
1202
|
const searchService = new MockSearchService();
|
|
1177
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1203
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1178
1204
|
</collection-browser>`);
|
|
1179
1205
|
await el.initialSearchComplete;
|
|
1180
1206
|
await el.updateComplete;
|
|
1181
1207
|
expect(el.baseQuery).to.equal('foo');
|
|
1182
1208
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1183
1209
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1184
|
-
expect(el.selectedFacets
|
|
1185
|
-
expect(el.selectedFacets
|
|
1210
|
+
expect((_c = (_b = (_a = el.selectedFacets) === null || _a === void 0 ? void 0 : _a.mediatype) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.state).to.equal('hidden');
|
|
1211
|
+
expect((_f = (_e = (_d = el.selectedFacets) === null || _d === void 0 ? void 0 : _d.subject) === null || _e === void 0 ? void 0 : _e.baz) === null || _f === void 0 ? void 0 : _f.state).to.equal('selected');
|
|
1186
1212
|
expect(el.selectedTitleFilter).to.equal('X');
|
|
1187
1213
|
expect(el.minSelectedDate).to.equal('2000');
|
|
1188
1214
|
expect(el.maxSelectedDate).to.equal('2010');
|
|
1189
1215
|
});
|
|
1190
1216
|
it('respects the initial set of URL parameters within a collection', async () => {
|
|
1217
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1191
1218
|
const url = new URL(window.location.href);
|
|
1192
1219
|
const { searchParams } = url;
|
|
1193
1220
|
searchParams.set('query', 'foo');
|
|
@@ -1199,10 +1226,10 @@ describe('Collection Browser', () => {
|
|
|
1199
1226
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1200
1227
|
window.history.replaceState({}, '', url);
|
|
1201
1228
|
const searchService = new MockSearchService();
|
|
1202
|
-
const el = await fixture(html `<collection-browser
|
|
1203
|
-
.searchService=${searchService}
|
|
1204
|
-
.withinCollection=${'foobar'}
|
|
1205
|
-
>
|
|
1229
|
+
const el = await fixture(html `<collection-browser
|
|
1230
|
+
.searchService=${searchService}
|
|
1231
|
+
.withinCollection=${'foobar'}
|
|
1232
|
+
>
|
|
1206
1233
|
</collection-browser>`);
|
|
1207
1234
|
await el.initialSearchComplete;
|
|
1208
1235
|
await el.updateComplete;
|
|
@@ -1210,13 +1237,14 @@ describe('Collection Browser', () => {
|
|
|
1210
1237
|
expect(el.baseQuery).to.equal('foo');
|
|
1211
1238
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1212
1239
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1213
|
-
expect(el.selectedFacets
|
|
1214
|
-
expect(el.selectedFacets
|
|
1240
|
+
expect((_c = (_b = (_a = el.selectedFacets) === null || _a === void 0 ? void 0 : _a.mediatype) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.state).to.equal('hidden');
|
|
1241
|
+
expect((_f = (_e = (_d = el.selectedFacets) === null || _d === void 0 ? void 0 : _d.subject) === null || _e === void 0 ? void 0 : _e.baz) === null || _f === void 0 ? void 0 : _f.state).to.equal('selected');
|
|
1215
1242
|
expect(el.selectedTitleFilter).to.equal('X');
|
|
1216
1243
|
expect(el.minSelectedDate).to.equal('2000');
|
|
1217
1244
|
expect(el.maxSelectedDate).to.equal('2010');
|
|
1218
1245
|
});
|
|
1219
1246
|
it('respects the initial set of URL parameters within a profile page', async () => {
|
|
1247
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1220
1248
|
const url = new URL(window.location.href);
|
|
1221
1249
|
const { searchParams } = url;
|
|
1222
1250
|
searchParams.set('query', 'foo');
|
|
@@ -1226,11 +1254,11 @@ describe('Collection Browser', () => {
|
|
|
1226
1254
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1227
1255
|
window.history.replaceState({}, '', url);
|
|
1228
1256
|
const searchService = new MockSearchService();
|
|
1229
|
-
const el = await fixture(html `<collection-browser
|
|
1230
|
-
.searchService=${searchService}
|
|
1231
|
-
.withinProfile=${'@foobar'}
|
|
1232
|
-
.profileElement=${'uploads'}
|
|
1233
|
-
>
|
|
1257
|
+
const el = await fixture(html `<collection-browser
|
|
1258
|
+
.searchService=${searchService}
|
|
1259
|
+
.withinProfile=${'@foobar'}
|
|
1260
|
+
.profileElement=${'uploads'}
|
|
1261
|
+
>
|
|
1234
1262
|
</collection-browser>`);
|
|
1235
1263
|
await el.initialSearchComplete;
|
|
1236
1264
|
await el.updateComplete;
|
|
@@ -1238,13 +1266,14 @@ describe('Collection Browser', () => {
|
|
|
1238
1266
|
expect(el.profileElement).to.equal('uploads');
|
|
1239
1267
|
expect(el.baseQuery).to.equal('foo');
|
|
1240
1268
|
expect(el.searchType).to.equal(SearchType.DEFAULT);
|
|
1241
|
-
expect(el.selectedFacets
|
|
1242
|
-
expect(el.selectedFacets
|
|
1269
|
+
expect((_c = (_b = (_a = el.selectedFacets) === null || _a === void 0 ? void 0 : _a.mediatype) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.state).to.equal('hidden');
|
|
1270
|
+
expect((_f = (_e = (_d = el.selectedFacets) === null || _d === void 0 ? void 0 : _d.subject) === null || _e === void 0 ? void 0 : _e.baz) === null || _f === void 0 ? void 0 : _f.state).to.equal('selected');
|
|
1243
1271
|
expect(el.selectedTitleFilter).to.equal('X');
|
|
1244
1272
|
expect(el.minSelectedDate).to.equal('2000');
|
|
1245
1273
|
expect(el.maxSelectedDate).to.equal('2010');
|
|
1246
1274
|
});
|
|
1247
1275
|
it('clears filters except sort when query changes for a general search', async () => {
|
|
1276
|
+
var _a, _b, _c, _d;
|
|
1248
1277
|
const url = new URL(window.location.href);
|
|
1249
1278
|
const { searchParams } = url;
|
|
1250
1279
|
searchParams.set('query', 'foo');
|
|
@@ -1256,7 +1285,7 @@ describe('Collection Browser', () => {
|
|
|
1256
1285
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1257
1286
|
window.history.replaceState({}, '', url);
|
|
1258
1287
|
const searchService = new MockSearchService();
|
|
1259
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1288
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1260
1289
|
</collection-browser>`);
|
|
1261
1290
|
await el.initialSearchComplete;
|
|
1262
1291
|
await el.updateComplete;
|
|
@@ -1265,13 +1294,14 @@ describe('Collection Browser', () => {
|
|
|
1265
1294
|
expect(el.baseQuery).to.equal('bar');
|
|
1266
1295
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1267
1296
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1268
|
-
expect(el.selectedFacets
|
|
1269
|
-
expect(el.selectedFacets
|
|
1297
|
+
expect((_b = (_a = el.selectedFacets) === null || _a === void 0 ? void 0 : _a.mediatype) === null || _b === void 0 ? void 0 : _b.data).not.to.exist;
|
|
1298
|
+
expect((_d = (_c = el.selectedFacets) === null || _c === void 0 ? void 0 : _c.subject) === null || _d === void 0 ? void 0 : _d.baz).not.to.exist;
|
|
1270
1299
|
expect(el.selectedTitleFilter).not.to.exist;
|
|
1271
1300
|
expect(el.minSelectedDate).not.to.exist;
|
|
1272
1301
|
expect(el.maxSelectedDate).not.to.exist;
|
|
1273
1302
|
});
|
|
1274
1303
|
it('clears filters except sort when query changes within a collection', async () => {
|
|
1304
|
+
var _a, _b, _c, _d;
|
|
1275
1305
|
const url = new URL(window.location.href);
|
|
1276
1306
|
const { searchParams } = url;
|
|
1277
1307
|
searchParams.set('query', 'foo');
|
|
@@ -1283,10 +1313,10 @@ describe('Collection Browser', () => {
|
|
|
1283
1313
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1284
1314
|
window.history.replaceState({}, '', url);
|
|
1285
1315
|
const searchService = new MockSearchService();
|
|
1286
|
-
const el = await fixture(html `<collection-browser
|
|
1287
|
-
.searchService=${searchService}
|
|
1288
|
-
.withinCollection=${'foobar'}
|
|
1289
|
-
>
|
|
1316
|
+
const el = await fixture(html `<collection-browser
|
|
1317
|
+
.searchService=${searchService}
|
|
1318
|
+
.withinCollection=${'foobar'}
|
|
1319
|
+
>
|
|
1290
1320
|
</collection-browser>`);
|
|
1291
1321
|
el.baseQuery = 'bar';
|
|
1292
1322
|
await el.updateComplete;
|
|
@@ -1294,13 +1324,14 @@ describe('Collection Browser', () => {
|
|
|
1294
1324
|
expect(el.baseQuery).to.equal('bar');
|
|
1295
1325
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1296
1326
|
expect(el.selectedSort).to.equal(SortField.title);
|
|
1297
|
-
expect(el.selectedFacets
|
|
1298
|
-
expect(el.selectedFacets
|
|
1327
|
+
expect((_b = (_a = el.selectedFacets) === null || _a === void 0 ? void 0 : _a.mediatype) === null || _b === void 0 ? void 0 : _b.data).not.to.exist;
|
|
1328
|
+
expect((_d = (_c = el.selectedFacets) === null || _c === void 0 ? void 0 : _c.subject) === null || _d === void 0 ? void 0 : _d.baz).not.to.exist;
|
|
1299
1329
|
expect(el.selectedTitleFilter).not.to.exist;
|
|
1300
1330
|
expect(el.minSelectedDate).not.to.exist;
|
|
1301
1331
|
expect(el.maxSelectedDate).not.to.exist;
|
|
1302
1332
|
});
|
|
1303
1333
|
it('clears filters *including* sort when target collection changes', async () => {
|
|
1334
|
+
var _a, _b, _c, _d;
|
|
1304
1335
|
const url = new URL(window.location.href);
|
|
1305
1336
|
const { searchParams } = url;
|
|
1306
1337
|
searchParams.set('query', 'foo');
|
|
@@ -1312,10 +1343,10 @@ describe('Collection Browser', () => {
|
|
|
1312
1343
|
searchParams.append('and[]', 'year:[2000 TO 2010]');
|
|
1313
1344
|
window.history.replaceState({}, '', url);
|
|
1314
1345
|
const searchService = new MockSearchService();
|
|
1315
|
-
const el = await fixture(html `<collection-browser
|
|
1316
|
-
.searchService=${searchService}
|
|
1317
|
-
.withinCollection=${'foobar'}
|
|
1318
|
-
>
|
|
1346
|
+
const el = await fixture(html `<collection-browser
|
|
1347
|
+
.searchService=${searchService}
|
|
1348
|
+
.withinCollection=${'foobar'}
|
|
1349
|
+
>
|
|
1319
1350
|
</collection-browser>`);
|
|
1320
1351
|
el.withinCollection = 'bar';
|
|
1321
1352
|
await el.updateComplete;
|
|
@@ -1323,19 +1354,20 @@ describe('Collection Browser', () => {
|
|
|
1323
1354
|
expect(el.baseQuery).to.equal('foo');
|
|
1324
1355
|
expect(el.searchType).to.equal(SearchType.FULLTEXT);
|
|
1325
1356
|
expect(el.selectedSort).to.equal(SortField.default);
|
|
1326
|
-
expect(el.selectedFacets
|
|
1327
|
-
expect(el.selectedFacets
|
|
1357
|
+
expect((_b = (_a = el.selectedFacets) === null || _a === void 0 ? void 0 : _a.mediatype) === null || _b === void 0 ? void 0 : _b.data).not.to.exist;
|
|
1358
|
+
expect((_d = (_c = el.selectedFacets) === null || _c === void 0 ? void 0 : _c.subject) === null || _d === void 0 ? void 0 : _d.baz).not.to.exist;
|
|
1328
1359
|
expect(el.selectedTitleFilter).not.to.exist;
|
|
1329
1360
|
expect(el.minSelectedDate).not.to.exist;
|
|
1330
1361
|
expect(el.maxSelectedDate).not.to.exist;
|
|
1331
1362
|
});
|
|
1332
1363
|
it('correctly retrieves web archive hits', async () => {
|
|
1364
|
+
var _a, _b, _c;
|
|
1333
1365
|
const searchService = new MockSearchService();
|
|
1334
|
-
const el = await fixture(html `<collection-browser
|
|
1335
|
-
.searchService=${searchService}
|
|
1336
|
-
.withinProfile=${'@foo'}
|
|
1337
|
-
.profileElement=${'web_archives'}
|
|
1338
|
-
>
|
|
1366
|
+
const el = await fixture(html `<collection-browser
|
|
1367
|
+
.searchService=${searchService}
|
|
1368
|
+
.withinProfile=${'@foo'}
|
|
1369
|
+
.profileElement=${'web_archives'}
|
|
1370
|
+
>
|
|
1339
1371
|
</collection-browser>`);
|
|
1340
1372
|
el.baseQuery = 'web-archive';
|
|
1341
1373
|
await el.updateComplete;
|
|
@@ -1343,70 +1375,74 @@ describe('Collection Browser', () => {
|
|
|
1343
1375
|
await nextTick();
|
|
1344
1376
|
console.log('\n\n*****\n\n*****\n\n', el.dataSource.getAllPages(), '\n\n*****\n\n*****\n\n');
|
|
1345
1377
|
expect(el.dataSource.totalResults, 'total results').to.equal(1);
|
|
1346
|
-
expect(el.dataSource.getTileModelAt(0)
|
|
1347
|
-
expect(el.dataSource.getTileModelAt(0)
|
|
1378
|
+
expect((_a = el.dataSource.getTileModelAt(0)) === null || _a === void 0 ? void 0 : _a.title).to.equal('https://example.com');
|
|
1379
|
+
expect((_c = (_b = el.dataSource.getTileModelAt(0)) === null || _b === void 0 ? void 0 : _b.captureDates) === null || _c === void 0 ? void 0 : _c.length, 'capture dates').to.equal(1);
|
|
1348
1380
|
});
|
|
1349
1381
|
it('shows dropdown accordion in facet sidebar when opt-in strategy is specified', async () => {
|
|
1382
|
+
var _a;
|
|
1350
1383
|
const searchService = new MockSearchService();
|
|
1351
|
-
const el = await fixture(html `<collection-browser
|
|
1352
|
-
.searchService=${searchService}
|
|
1353
|
-
facetLoadStrategy=${'opt-in'}
|
|
1354
|
-
>
|
|
1384
|
+
const el = await fixture(html `<collection-browser
|
|
1385
|
+
.searchService=${searchService}
|
|
1386
|
+
facetLoadStrategy=${'opt-in'}
|
|
1387
|
+
>
|
|
1355
1388
|
</collection-browser>`);
|
|
1356
1389
|
el.baseQuery = 'foo';
|
|
1357
1390
|
await el.updateComplete;
|
|
1358
1391
|
await el.initialSearchComplete;
|
|
1359
|
-
const facetsDropdown = el.shadowRoot
|
|
1392
|
+
const facetsDropdown = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.desktop-facets-dropdown');
|
|
1360
1393
|
expect(facetsDropdown).to.exist;
|
|
1361
1394
|
});
|
|
1362
1395
|
it('shows temporarily unavailable message when facets suppressed', async () => {
|
|
1396
|
+
var _a, _b;
|
|
1363
1397
|
const searchService = new MockSearchService();
|
|
1364
|
-
const el = await fixture(html `<collection-browser
|
|
1365
|
-
.searchService=${searchService}
|
|
1366
|
-
facetLoadStrategy=${'off'}
|
|
1367
|
-
>
|
|
1398
|
+
const el = await fixture(html `<collection-browser
|
|
1399
|
+
.searchService=${searchService}
|
|
1400
|
+
facetLoadStrategy=${'off'}
|
|
1401
|
+
>
|
|
1368
1402
|
</collection-browser>`);
|
|
1369
1403
|
el.baseQuery = 'foo';
|
|
1370
1404
|
await el.updateComplete;
|
|
1371
1405
|
await el.initialSearchComplete;
|
|
1372
|
-
const facetsMsg = el.shadowRoot
|
|
1406
|
+
const facetsMsg = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.facets-message');
|
|
1373
1407
|
expect(facetsMsg).to.exist;
|
|
1374
|
-
expect(facetsMsg
|
|
1408
|
+
expect((_b = facetsMsg === null || facetsMsg === void 0 ? void 0 : facetsMsg.textContent) === null || _b === void 0 ? void 0 : _b.trim()).to.equal('Facets are temporarily unavailable.');
|
|
1375
1409
|
});
|
|
1376
1410
|
it('shows manage bar interface instead of sort bar when in manage view', async () => {
|
|
1411
|
+
var _a, _b, _c, _d;
|
|
1377
1412
|
const searchService = new MockSearchService();
|
|
1378
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1413
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1379
1414
|
</collection-browser>`);
|
|
1380
1415
|
el.baseQuery = 'foo';
|
|
1381
1416
|
await el.updateComplete;
|
|
1382
1417
|
await el.initialSearchComplete;
|
|
1383
1418
|
el.isManageView = true;
|
|
1384
1419
|
await el.updateComplete;
|
|
1385
|
-
expect(el.shadowRoot
|
|
1386
|
-
expect(el.shadowRoot
|
|
1420
|
+
expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('manage-bar')).to.exist;
|
|
1421
|
+
expect((_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('sort-filter-bar')).not.to.exist;
|
|
1387
1422
|
el.isManageView = false;
|
|
1388
1423
|
await el.updateComplete;
|
|
1389
|
-
expect(el.shadowRoot
|
|
1390
|
-
expect(el.shadowRoot
|
|
1424
|
+
expect((_c = el.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('manage-bar')).not.to.exist;
|
|
1425
|
+
expect((_d = el.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('sort-filter-bar')).to.exist;
|
|
1391
1426
|
});
|
|
1392
1427
|
it('switches to grid display mode when manage view activated', async () => {
|
|
1393
1428
|
const searchService = new MockSearchService();
|
|
1394
|
-
const el = await fixture(html `<collection-browser
|
|
1395
|
-
.searchService=${searchService}
|
|
1396
|
-
.baseQuery=${'foo'}
|
|
1397
|
-
.displayMode=${'list-detail'}
|
|
1398
|
-
>
|
|
1429
|
+
const el = await fixture(html `<collection-browser
|
|
1430
|
+
.searchService=${searchService}
|
|
1431
|
+
.baseQuery=${'foo'}
|
|
1432
|
+
.displayMode=${'list-detail'}
|
|
1433
|
+
>
|
|
1399
1434
|
</collection-browser>`);
|
|
1400
1435
|
el.isManageView = true;
|
|
1401
1436
|
await el.updateComplete;
|
|
1402
1437
|
expect(el.displayMode).to.equal('grid');
|
|
1403
1438
|
});
|
|
1404
1439
|
it('can remove all checked tiles', async () => {
|
|
1440
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1405
1441
|
const searchService = new MockSearchService();
|
|
1406
|
-
const el = await fixture(html `<collection-browser
|
|
1407
|
-
.searchService=${searchService}
|
|
1408
|
-
.baseNavigationUrl=${''}
|
|
1409
|
-
>
|
|
1442
|
+
const el = await fixture(html `<collection-browser
|
|
1443
|
+
.searchService=${searchService}
|
|
1444
|
+
.baseNavigationUrl=${''}
|
|
1445
|
+
>
|
|
1410
1446
|
</collection-browser>`);
|
|
1411
1447
|
el.baseQuery = 'foo';
|
|
1412
1448
|
el.pageSize = 1; // To hit the edge case of a page break while offsetting tiles
|
|
@@ -1414,40 +1450,38 @@ describe('Collection Browser', () => {
|
|
|
1414
1450
|
await el.initialSearchComplete;
|
|
1415
1451
|
el.isManageView = true;
|
|
1416
1452
|
await el.updateComplete;
|
|
1417
|
-
const infiniteScroller = el.shadowRoot
|
|
1453
|
+
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
1418
1454
|
expect(infiniteScroller).to.exist;
|
|
1419
|
-
let tiles = infiniteScroller.shadowRoot
|
|
1455
|
+
let tiles = (_b = infiniteScroller.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('tile-dispatcher');
|
|
1420
1456
|
expect(tiles).to.exist;
|
|
1421
|
-
expect(tiles
|
|
1457
|
+
expect(tiles === null || tiles === void 0 ? void 0 : tiles.length).to.equal(2);
|
|
1422
1458
|
const firstTile = tiles[0];
|
|
1423
|
-
const firstTileLink = firstTile.shadowRoot
|
|
1424
|
-
expect(firstTile.model
|
|
1459
|
+
const firstTileLink = (_c = firstTile.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('a[href]');
|
|
1460
|
+
expect((_d = firstTile.model) === null || _d === void 0 ? void 0 : _d.identifier).to.equal('foo');
|
|
1425
1461
|
expect(firstTileLink).to.exist;
|
|
1426
1462
|
// No effect if no tiles checked
|
|
1427
1463
|
el.removeCheckedTiles();
|
|
1428
1464
|
await el.updateComplete;
|
|
1429
|
-
tiles = infiniteScroller.shadowRoot
|
|
1465
|
+
tiles = (_e = infiniteScroller.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelectorAll('tile-dispatcher');
|
|
1430
1466
|
expect(tiles).to.exist;
|
|
1431
|
-
expect(tiles
|
|
1467
|
+
expect(tiles === null || tiles === void 0 ? void 0 : tiles.length).to.equal(2);
|
|
1432
1468
|
// Check the first tile
|
|
1433
1469
|
firstTileLink.click();
|
|
1434
|
-
expect(firstTile.model
|
|
1470
|
+
expect((_f = firstTile.model) === null || _f === void 0 ? void 0 : _f.checked).to.be.true;
|
|
1435
1471
|
// Remove checked tiles and verify that we only kept the second tile
|
|
1436
1472
|
el.removeCheckedTiles();
|
|
1437
1473
|
await el.updateComplete;
|
|
1438
|
-
expect(el
|
|
1439
|
-
tiles = el.shadowRoot
|
|
1440
|
-
?.querySelector('infinite-scroller')
|
|
1441
|
-
.shadowRoot?.querySelectorAll('tile-dispatcher');
|
|
1474
|
+
expect((_g = el === null || el === void 0 ? void 0 : el.dataSource) === null || _g === void 0 ? void 0 : _g.size, 'data source count').to.equal(1);
|
|
1475
|
+
tiles = (_j = (_h = el.shadowRoot) === null || _h === void 0 ? void 0 : _h.querySelector('infinite-scroller').shadowRoot) === null || _j === void 0 ? void 0 : _j.querySelectorAll('tile-dispatcher');
|
|
1442
1476
|
expect(tiles).to.exist;
|
|
1443
1477
|
expect(tiles.length, 'tile count after `el.removeCheckedTiles()`').to.equal(1);
|
|
1444
1478
|
});
|
|
1445
1479
|
it('can check/uncheck all tiles', async () => {
|
|
1446
1480
|
const searchService = new MockSearchService();
|
|
1447
|
-
const el = await fixture(html `<collection-browser
|
|
1448
|
-
.searchService=${searchService}
|
|
1449
|
-
.baseNavigationUrl=${''}
|
|
1450
|
-
>
|
|
1481
|
+
const el = await fixture(html `<collection-browser
|
|
1482
|
+
.searchService=${searchService}
|
|
1483
|
+
.baseNavigationUrl=${''}
|
|
1484
|
+
>
|
|
1451
1485
|
</collection-browser>`);
|
|
1452
1486
|
el.baseQuery = 'foo';
|
|
1453
1487
|
await el.updateComplete;
|
|
@@ -1464,48 +1498,50 @@ describe('Collection Browser', () => {
|
|
|
1464
1498
|
expect(el.dataSource.uncheckedTileModels.length).to.equal(2);
|
|
1465
1499
|
});
|
|
1466
1500
|
it('emits event when manage view state changes', async () => {
|
|
1501
|
+
var _a, _b;
|
|
1467
1502
|
const spy = sinon.spy();
|
|
1468
1503
|
const searchService = new MockSearchService();
|
|
1469
|
-
const el = await fixture(html `<collection-browser
|
|
1470
|
-
.searchService=${searchService}
|
|
1471
|
-
.baseNavigationUrl=${''}
|
|
1472
|
-
@manageModeChanged=${spy}
|
|
1504
|
+
const el = await fixture(html `<collection-browser
|
|
1505
|
+
.searchService=${searchService}
|
|
1506
|
+
.baseNavigationUrl=${''}
|
|
1507
|
+
@manageModeChanged=${spy}
|
|
1473
1508
|
></collection-browser>`);
|
|
1474
1509
|
el.isManageView = true;
|
|
1475
1510
|
await el.updateComplete;
|
|
1476
1511
|
expect(spy.callCount).to.equal(1);
|
|
1477
|
-
expect(spy.args[0][0]
|
|
1512
|
+
expect((_a = spy.args[0][0]) === null || _a === void 0 ? void 0 : _a.detail).to.be.true;
|
|
1478
1513
|
el.isManageView = false;
|
|
1479
1514
|
await el.updateComplete;
|
|
1480
1515
|
expect(spy.callCount).to.equal(2);
|
|
1481
|
-
expect(spy.args[1][0]
|
|
1516
|
+
expect((_b = spy.args[1][0]) === null || _b === void 0 ? void 0 : _b.detail).to.be.false;
|
|
1482
1517
|
});
|
|
1483
1518
|
it('emits event when item removal requested', async () => {
|
|
1519
|
+
var _a, _b, _c, _d, _e;
|
|
1484
1520
|
const spy = sinon.spy();
|
|
1485
1521
|
const searchService = new MockSearchService();
|
|
1486
|
-
const el = await fixture(html `<collection-browser
|
|
1487
|
-
.searchService=${searchService}
|
|
1488
|
-
.baseNavigationUrl=${''}
|
|
1489
|
-
@itemRemovalRequested=${spy}
|
|
1490
|
-
>
|
|
1522
|
+
const el = await fixture(html `<collection-browser
|
|
1523
|
+
.searchService=${searchService}
|
|
1524
|
+
.baseNavigationUrl=${''}
|
|
1525
|
+
@itemRemovalRequested=${spy}
|
|
1526
|
+
>
|
|
1491
1527
|
</collection-browser>`);
|
|
1492
1528
|
el.baseQuery = 'foo';
|
|
1493
1529
|
await el.updateComplete;
|
|
1494
1530
|
await el.initialSearchComplete;
|
|
1495
1531
|
el.isManageView = true;
|
|
1496
1532
|
await el.updateComplete;
|
|
1497
|
-
const infiniteScroller = el.shadowRoot
|
|
1533
|
+
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
1498
1534
|
expect(infiniteScroller).to.exist;
|
|
1499
|
-
const tiles = infiniteScroller.shadowRoot
|
|
1535
|
+
const tiles = (_b = infiniteScroller.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelectorAll('tile-dispatcher');
|
|
1500
1536
|
expect(tiles).to.exist.and.have.length(2);
|
|
1501
1537
|
const firstTile = tiles[0];
|
|
1502
|
-
const firstTileLink = firstTile.shadowRoot
|
|
1503
|
-
expect(firstTile.model
|
|
1538
|
+
const firstTileLink = (_c = firstTile.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('a[href]');
|
|
1539
|
+
expect((_d = firstTile.model) === null || _d === void 0 ? void 0 : _d.identifier).to.equal('foo');
|
|
1504
1540
|
expect(firstTileLink).to.exist;
|
|
1505
1541
|
// Check the first tile
|
|
1506
1542
|
firstTileLink.click();
|
|
1507
1543
|
await el.updateComplete;
|
|
1508
|
-
const manageBar = el.shadowRoot
|
|
1544
|
+
const manageBar = (_e = el.shadowRoot) === null || _e === void 0 ? void 0 : _e.querySelector('manage-bar');
|
|
1509
1545
|
expect(manageBar).to.exist;
|
|
1510
1546
|
// Emit remove event from manage bar
|
|
1511
1547
|
manageBar.dispatchEvent(new CustomEvent('removeItems'));
|
|
@@ -1515,18 +1551,19 @@ describe('Collection Browser', () => {
|
|
|
1515
1551
|
expect(spy.args[0][0].detail.items[0]).to.equal('foo');
|
|
1516
1552
|
});
|
|
1517
1553
|
it('disables manage view when manage bar cancelled', async () => {
|
|
1554
|
+
var _a;
|
|
1518
1555
|
const searchService = new MockSearchService();
|
|
1519
|
-
const el = await fixture(html `<collection-browser
|
|
1520
|
-
.searchService=${searchService}
|
|
1521
|
-
.baseNavigationUrl=${''}
|
|
1522
|
-
>
|
|
1556
|
+
const el = await fixture(html `<collection-browser
|
|
1557
|
+
.searchService=${searchService}
|
|
1558
|
+
.baseNavigationUrl=${''}
|
|
1559
|
+
>
|
|
1523
1560
|
</collection-browser>`);
|
|
1524
1561
|
el.baseQuery = 'foo';
|
|
1525
1562
|
await el.updateComplete;
|
|
1526
1563
|
await el.initialSearchComplete;
|
|
1527
1564
|
el.isManageView = true;
|
|
1528
1565
|
await el.updateComplete;
|
|
1529
|
-
const manageBar = el.shadowRoot
|
|
1566
|
+
const manageBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('manage-bar');
|
|
1530
1567
|
expect(manageBar).to.exist;
|
|
1531
1568
|
// Emit remove event from manage bar
|
|
1532
1569
|
manageBar.dispatchEvent(new CustomEvent('cancel'));
|
|
@@ -1534,117 +1571,124 @@ describe('Collection Browser', () => {
|
|
|
1534
1571
|
expect(el.isManageView).to.be.false;
|
|
1535
1572
|
});
|
|
1536
1573
|
it('enable/disable manage view delete button when you selectAll/unselectAll', async () => {
|
|
1574
|
+
var _a, _b, _c, _d;
|
|
1537
1575
|
const searchService = new MockSearchService();
|
|
1538
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1576
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1539
1577
|
</collection-browser>`);
|
|
1540
1578
|
el.baseQuery = 'foo';
|
|
1541
1579
|
await el.updateComplete;
|
|
1542
1580
|
await el.initialSearchComplete;
|
|
1543
1581
|
el.isManageView = true;
|
|
1544
1582
|
await el.updateComplete;
|
|
1545
|
-
const manageBar = el.shadowRoot
|
|
1583
|
+
const manageBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('manage-bar');
|
|
1546
1584
|
expect(manageBar).to.exist;
|
|
1547
1585
|
// disable button exists
|
|
1548
|
-
expect(manageBar
|
|
1586
|
+
expect((_b = manageBar === null || manageBar === void 0 ? void 0 : manageBar.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('.danger:disabled')).to.be
|
|
1549
1587
|
.exist;
|
|
1550
1588
|
// Emit remove event from manage bar
|
|
1551
1589
|
manageBar.dispatchEvent(new CustomEvent('selectAll'));
|
|
1552
1590
|
await el.updateComplete;
|
|
1553
1591
|
// disable button does not exists
|
|
1554
|
-
expect(manageBar
|
|
1592
|
+
expect((_c = manageBar === null || manageBar === void 0 ? void 0 : manageBar.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('.danger:disabled')).to.be.not
|
|
1555
1593
|
.exist;
|
|
1556
1594
|
// Emit remove event from manage bar
|
|
1557
1595
|
manageBar.dispatchEvent(new CustomEvent('unselectAll'));
|
|
1558
1596
|
await el.updateComplete;
|
|
1559
1597
|
// disable button exists again
|
|
1560
|
-
expect(manageBar
|
|
1598
|
+
expect((_d = manageBar === null || manageBar === void 0 ? void 0 : manageBar.shadowRoot) === null || _d === void 0 ? void 0 : _d.querySelector('.danger:disabled')).to.be
|
|
1561
1599
|
.exist;
|
|
1562
1600
|
});
|
|
1563
1601
|
it('shows Blurring checkbox for admin users', async () => {
|
|
1602
|
+
var _a;
|
|
1564
1603
|
const searchService = new MockSearchService();
|
|
1565
|
-
const el = await fixture(html `<collection-browser
|
|
1566
|
-
.baseNavigationUrl=${''}
|
|
1567
|
-
.searchService=${searchService}
|
|
1568
|
-
>
|
|
1604
|
+
const el = await fixture(html `<collection-browser
|
|
1605
|
+
.baseNavigationUrl=${''}
|
|
1606
|
+
.searchService=${searchService}
|
|
1607
|
+
>
|
|
1569
1608
|
</collection-browser>`);
|
|
1570
1609
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1571
1610
|
await el.updateComplete;
|
|
1572
1611
|
await el.initialSearchComplete;
|
|
1573
|
-
const blurringCheck = el.shadowRoot
|
|
1612
|
+
const blurringCheck = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#tile-blur-check');
|
|
1574
1613
|
expect(blurringCheck).to.exist;
|
|
1575
1614
|
expect(blurringCheck.checked).to.be.true;
|
|
1576
1615
|
});
|
|
1577
1616
|
it('unchecks Blurring checkbox for admin users with blurring preference off', async () => {
|
|
1617
|
+
var _a;
|
|
1578
1618
|
const searchService = new MockSearchService();
|
|
1579
|
-
const el = await fixture(html `<collection-browser
|
|
1580
|
-
.baseNavigationUrl=${''}
|
|
1581
|
-
.searchService=${searchService}
|
|
1582
|
-
>
|
|
1619
|
+
const el = await fixture(html `<collection-browser
|
|
1620
|
+
.baseNavigationUrl=${''}
|
|
1621
|
+
.searchService=${searchService}
|
|
1622
|
+
>
|
|
1583
1623
|
</collection-browser>`);
|
|
1584
1624
|
el.baseQuery = 'archive-org-user-loggedin-noblur';
|
|
1585
1625
|
await el.updateComplete;
|
|
1586
1626
|
await el.initialSearchComplete;
|
|
1587
|
-
const blurringCheck = el.shadowRoot
|
|
1627
|
+
const blurringCheck = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#tile-blur-check');
|
|
1588
1628
|
expect(blurringCheck).to.exist;
|
|
1589
1629
|
expect(blurringCheck.checked).to.be.false;
|
|
1590
1630
|
});
|
|
1591
1631
|
it('toggles blur state when Blurring checkbox is toggled', async () => {
|
|
1632
|
+
var _a, _b, _c;
|
|
1592
1633
|
const searchService = new MockSearchService();
|
|
1593
|
-
const el = await fixture(html `<collection-browser
|
|
1594
|
-
.baseNavigationUrl=${''}
|
|
1595
|
-
.searchService=${searchService}
|
|
1596
|
-
>
|
|
1634
|
+
const el = await fixture(html `<collection-browser
|
|
1635
|
+
.baseNavigationUrl=${''}
|
|
1636
|
+
.searchService=${searchService}
|
|
1637
|
+
>
|
|
1597
1638
|
</collection-browser>`);
|
|
1598
1639
|
el.baseQuery = 'archive-org-user-loggedin';
|
|
1599
1640
|
await el.updateComplete;
|
|
1600
1641
|
await el.initialSearchComplete;
|
|
1601
|
-
const blurringCheck = el.shadowRoot
|
|
1642
|
+
const blurringCheck = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#tile-blur-check');
|
|
1602
1643
|
expect(blurringCheck).to.exist;
|
|
1603
1644
|
blurringCheck.dispatchEvent(new PointerEvent('click'));
|
|
1604
1645
|
await el.updateComplete;
|
|
1605
|
-
const infiniteScroller = el.shadowRoot
|
|
1606
|
-
const firstTile = infiniteScroller
|
|
1646
|
+
const infiniteScroller = (_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('infinite-scroller');
|
|
1647
|
+
const firstTile = (_c = infiniteScroller === null || infiniteScroller === void 0 ? void 0 : infiniteScroller.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('tile-dispatcher');
|
|
1607
1648
|
expect(firstTile.suppressBlurring).to.be.true;
|
|
1608
1649
|
});
|
|
1609
1650
|
it('applies loans tab properties to sort bar', async () => {
|
|
1651
|
+
var _a;
|
|
1610
1652
|
const searchService = new MockSearchService();
|
|
1611
|
-
const el = await fixture(html `<collection-browser
|
|
1612
|
-
.baseNavigationUrl=${''}
|
|
1613
|
-
.searchService=${searchService}
|
|
1614
|
-
.enableSortOptionsSlot=${true}
|
|
1615
|
-
>
|
|
1653
|
+
const el = await fixture(html `<collection-browser
|
|
1654
|
+
.baseNavigationUrl=${''}
|
|
1655
|
+
.searchService=${searchService}
|
|
1656
|
+
.enableSortOptionsSlot=${true}
|
|
1657
|
+
>
|
|
1616
1658
|
</collection-browser>`);
|
|
1617
1659
|
el.baseQuery = 'collection:foo';
|
|
1618
1660
|
await el.updateComplete;
|
|
1619
1661
|
await aTimeout(10);
|
|
1620
|
-
const sortBar = el.shadowRoot
|
|
1621
|
-
expect(sortBar
|
|
1662
|
+
const sortBar = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('sort-filter-bar');
|
|
1663
|
+
expect(sortBar === null || sortBar === void 0 ? void 0 : sortBar.enableSortOptionsSlot, 'show loans in sort bar').to.be.true;
|
|
1622
1664
|
expect(el.enableSortOptionsSlot, 'collection browser is loans tab').to.be
|
|
1623
1665
|
.true;
|
|
1624
1666
|
const loansTabSlot = sortBar.querySelector('slot[name="sort-options"]');
|
|
1625
1667
|
expect(loansTabSlot).to.exist;
|
|
1626
1668
|
});
|
|
1627
1669
|
it('can suppress presence of result count', async () => {
|
|
1670
|
+
var _a;
|
|
1628
1671
|
const searchService = new MockSearchService();
|
|
1629
|
-
const el = await fixture(html `<collection-browser
|
|
1630
|
-
.searchService=${searchService}
|
|
1631
|
-
suppressResultCount
|
|
1672
|
+
const el = await fixture(html `<collection-browser
|
|
1673
|
+
.searchService=${searchService}
|
|
1674
|
+
suppressResultCount
|
|
1632
1675
|
></collection-browser>`);
|
|
1633
1676
|
el.baseQuery = 'collection:foo';
|
|
1634
1677
|
await el.updateComplete;
|
|
1635
1678
|
await el.initialSearchComplete;
|
|
1636
|
-
const resultCount = el.shadowRoot
|
|
1679
|
+
const resultCount = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#results-total');
|
|
1637
1680
|
expect(resultCount).not.to.exist;
|
|
1638
1681
|
});
|
|
1639
1682
|
it('can suppress presence of result tiles', async () => {
|
|
1683
|
+
var _a;
|
|
1640
1684
|
const searchService = new MockSearchService();
|
|
1641
|
-
const el = await fixture(html `<collection-browser
|
|
1642
|
-
.searchService=${searchService}
|
|
1643
|
-
suppressResultTiles
|
|
1685
|
+
const el = await fixture(html `<collection-browser
|
|
1686
|
+
.searchService=${searchService}
|
|
1687
|
+
suppressResultTiles
|
|
1644
1688
|
></collection-browser>`);
|
|
1645
1689
|
el.baseQuery = 'collection:foo';
|
|
1646
1690
|
await el.updateComplete;
|
|
1647
|
-
const infiniteScroller = el.shadowRoot
|
|
1691
|
+
const infiniteScroller = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('infinite-scroller');
|
|
1648
1692
|
expect(infiniteScroller).not.to.exist;
|
|
1649
1693
|
});
|
|
1650
1694
|
it('fetch larger result on search page for admin user to manage items', async () => {
|
|
@@ -1653,7 +1697,7 @@ describe('Collection Browser', () => {
|
|
|
1653
1697
|
asyncResponse: true,
|
|
1654
1698
|
resultsSpy,
|
|
1655
1699
|
});
|
|
1656
|
-
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1700
|
+
const el = await fixture(html `<collection-browser .searchService=${searchService}>
|
|
1657
1701
|
</collection-browser>`);
|
|
1658
1702
|
const numberOfPages = 15;
|
|
1659
1703
|
el.baseQuery = 'jack';
|