@internetarchive/collection-browser 2.2.3-alpha.6 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "2.2.3-alpha.6",
6
+ "version": "2.3.0",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -1153,8 +1153,6 @@ export class CollectionBrowser
1153
1153
  }
1154
1154
 
1155
1155
  updated(changed: PropertyValues) {
1156
- console.log('updated', '\n' + [...changed.entries()].map(([k,v]) => `${String(k)}: ${v} -> ${this[k as keyof this]}`).join('\n'));
1157
-
1158
1156
  if (changed.has('placeholderType') && this.placeholderType === null) {
1159
1157
  if (!this.leftColIntersectionObserver) {
1160
1158
  this.setupLeftColumnScrollListeners();
@@ -1617,7 +1615,6 @@ export class CollectionBrowser
1617
1615
 
1618
1616
  private restoreState() {
1619
1617
  const restorationState = this.restorationStateHandler.getRestorationState();
1620
- console.log('restoring state:', restorationState);
1621
1618
  this.displayMode = restorationState.displayMode;
1622
1619
  if (restorationState.searchType != null)
1623
1620
  this.searchType = restorationState.searchType;
@@ -1651,7 +1648,6 @@ export class CollectionBrowser
1651
1648
  selectedTitleFilter: this.selectedTitleFilter ?? undefined,
1652
1649
  selectedCreatorFilter: this.selectedCreatorFilter ?? undefined,
1653
1650
  };
1654
- console.log('persisting state:', restorationState);
1655
1651
  this.restorationStateHandler.persistState(
1656
1652
  restorationState,
1657
1653
  this.dataSourceInstallInProgress
@@ -186,7 +186,6 @@ export class CollectionBrowserDataSource
186
186
  }
187
187
 
188
188
  hostUpdate(): void {
189
- console.log('host updated');
190
189
  // This reactive controller hook is run whenever the host component (collection-browser) performs an update.
191
190
  // We check whether the host's state has changed in a way which should trigger a reset & new results fetch.
192
191
 
@@ -379,7 +378,6 @@ export class CollectionBrowserDataSource
379
378
  async handleQueryChange(): Promise<void> {
380
379
  // Don't react to the change if fetches are suppressed for this data source
381
380
  if (this.suppressFetches) return;
382
- console.log('resetting data source & handling query change');
383
381
 
384
382
  this.reset();
385
383
 
@@ -403,7 +401,6 @@ export class CollectionBrowserDataSource
403
401
  * @inheritdoc
404
402
  */
405
403
  async handleFacetReadinessChange(ready: boolean): Promise<void> {
406
- console.log('handling facet readiness change:', ready);
407
404
  const facetsBecameReady = !this.facetsReadyToLoad && ready;
408
405
  this.facetsReadyToLoad = ready;
409
406
 
@@ -595,7 +592,6 @@ export class CollectionBrowserDataSource
595
592
  * Sets the state for whether the facets for a query is loading
596
593
  */
597
594
  private setFacetsLoading(loading: boolean): void {
598
- console.log('setFacetsLoading', loading);
599
595
  this.facetsLoading = loading;
600
596
  if (this.activeOnHost) {
601
597
  this.host.setFacetsLoading(loading);
@@ -924,7 +920,6 @@ export class CollectionBrowserDataSource
924
920
  if (this.fetchesInProgress.has(facetFetchQueryKey)) return;
925
921
  this.fetchesInProgress.add(facetFetchQueryKey);
926
922
 
927
- console.log('fetching facets', this.filterMap);
928
923
  this.setFacetsLoading(true);
929
924
 
930
925
  const sortParams = this.host.sortParam ? [this.host.sortParam] : [];
@@ -1659,10 +1659,33 @@ describe('Collection Browser', () => {
1659
1659
  ).to.equal(1);
1660
1660
  });
1661
1661
 
1662
+ it('shows dropdown accordion in facet sidebar when opt-in strategy is specified', async () => {
1663
+ const searchService = new MockSearchService();
1664
+ const el = await fixture<CollectionBrowser>(
1665
+ html`<collection-browser
1666
+ .searchService=${searchService}
1667
+ facetLoadStrategy=${'opt-in'}
1668
+ >
1669
+ </collection-browser>`
1670
+ );
1671
+
1672
+ el.baseQuery = 'foo';
1673
+ await el.updateComplete;
1674
+ await el.initialSearchComplete;
1675
+
1676
+ const facetsDropdown = el.shadowRoot?.querySelector(
1677
+ '.desktop-facets-dropdown'
1678
+ );
1679
+ expect(facetsDropdown).to.exist;
1680
+ });
1681
+
1662
1682
  it('shows temporarily unavailable message when facets suppressed', async () => {
1663
1683
  const searchService = new MockSearchService();
1664
1684
  const el = await fixture<CollectionBrowser>(
1665
- html`<collection-browser .searchService=${searchService} suppressFacets>
1685
+ html`<collection-browser
1686
+ .searchService=${searchService}
1687
+ facetLoadStrategy=${'off'}
1688
+ >
1666
1689
  </collection-browser>`
1667
1690
  );
1668
1691