@internetarchive/collection-browser
Advanced tools
Comparing version 0.1.2 to 0.1.3-alpha.1
@@ -321,3 +321,5 @@ import { __decorate } from "tslib"; | ||
updated(changed) { | ||
if (changed.has('displayMode') || changed.has('baseNavigationUrl')) { | ||
if (changed.has('displayMode') || | ||
changed.has('baseNavigationUrl') || | ||
changed.has('baseImageUrl')) { | ||
this.infiniteScroller.reload(); | ||
@@ -324,0 +326,0 @@ } |
@@ -5,2 +5,4 @@ /* eslint-disable import/no-duplicates */ | ||
import '../src/collection-browser'; | ||
import { MockSearchService } from './mocks/mock-search-service'; | ||
import { MockCollectionNameCache } from './mocks/mock-collection-name-cache'; | ||
describe('Collection Browser', () => { | ||
@@ -17,3 +19,29 @@ it('should render with a sort bar, facets, and infinite scroller', async () => { | ||
}); | ||
it('queries the search service when given a base query', async () => { | ||
var _a; | ||
const searchService = new MockSearchService(); | ||
const el = await fixture(html `<collection-browser | ||
.searchService=${searchService} | ||
></collection-browser>`); | ||
el.baseQuery = 'collection:foo'; | ||
await el.updateComplete; | ||
expect((_a = searchService.searchParams) === null || _a === void 0 ? void 0 : _a.query).to.equal('collection:foo'); | ||
}); | ||
it('queries for collection names after a fetch', async () => { | ||
const searchService = new MockSearchService(); | ||
const collectionNameCache = new MockCollectionNameCache(); | ||
const el = await fixture(html `<collection-browser | ||
.searchService=${searchService} | ||
.collectionNameCache=${collectionNameCache} | ||
></collection-browser>`); | ||
el.baseQuery = 'blahblah'; | ||
await el.updateComplete; | ||
expect(collectionNameCache.preloadIdentifiersRequested).to.deep.equal([ | ||
'foo', | ||
'bar', | ||
'baz', | ||
'boop', | ||
]); | ||
}); | ||
}); | ||
//# sourceMappingURL=collection-browser.test.js.map |
@@ -6,3 +6,3 @@ { | ||
"author": "Internet Archive", | ||
"version": "0.1.2", | ||
"version": "0.1.3-alpha.1", | ||
"main": "dist/index.js", | ||
@@ -22,3 +22,3 @@ "module": "dist/index.js", | ||
"dependencies": { | ||
"@internetarchive/collection-name-cache": "^0.1.2", | ||
"@internetarchive/collection-name-cache": "^0.1.4", | ||
"@internetarchive/feature-feedback": "^0.1.2", | ||
@@ -28,3 +28,3 @@ "@internetarchive/field-parsers": "^0.1.3", | ||
"@internetarchive/infinite-scroller": "^0.1.0", | ||
"@internetarchive/search-service": "^0.3.2", | ||
"@internetarchive/search-service": "^0.3.4", | ||
"@internetarchive/shared-resize-observer": "^0.2.0", | ||
@@ -31,0 +31,0 @@ "@lit/localize": "^0.11.2", |
@@ -452,3 +452,7 @@ /* eslint-disable import/no-duplicates */ | ||
updated(changed: PropertyValues) { | ||
if (changed.has('displayMode') || changed.has('baseNavigationUrl')) { | ||
if ( | ||
changed.has('displayMode') || | ||
changed.has('baseNavigationUrl') || | ||
changed.has('baseImageUrl') | ||
) { | ||
this.infiniteScroller.reload(); | ||
@@ -455,0 +459,0 @@ } |
@@ -6,3 +6,3 @@ /* | ||
export type DateFormat = | ||
| 'short' // 12/20 | ||
| 'short' // Dec 2020 | ||
| 'long'; // Dec 20, 2020 | ||
@@ -9,0 +9,0 @@ |
@@ -6,2 +6,4 @@ /* eslint-disable import/no-duplicates */ | ||
import '../src/collection-browser'; | ||
import { MockSearchService } from './mocks/mock-search-service'; | ||
import { MockCollectionNameCache } from './mocks/mock-collection-name-cache'; | ||
@@ -21,2 +23,39 @@ describe('Collection Browser', () => { | ||
}); | ||
it('queries the search service when given a base query', async () => { | ||
const searchService = new MockSearchService(); | ||
const el = await fixture<CollectionBrowser>( | ||
html`<collection-browser | ||
.searchService=${searchService} | ||
></collection-browser>` | ||
); | ||
el.baseQuery = 'collection:foo'; | ||
await el.updateComplete; | ||
expect(searchService.searchParams?.query).to.equal('collection:foo'); | ||
}); | ||
it('queries for collection names after a fetch', async () => { | ||
const searchService = new MockSearchService(); | ||
const collectionNameCache = new MockCollectionNameCache(); | ||
const el = await fixture<CollectionBrowser>( | ||
html`<collection-browser | ||
.searchService=${searchService} | ||
.collectionNameCache=${collectionNameCache} | ||
></collection-browser>` | ||
); | ||
el.baseQuery = 'blahblah'; | ||
await el.updateComplete; | ||
expect(collectionNameCache.preloadIdentifiersRequested).to.deep.equal([ | ||
'foo', | ||
'bar', | ||
'baz', | ||
'boop', | ||
]); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
880001
244
12965