diff --git a/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts b/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts index 611ac7e23f0..a40ffde2263 100644 --- a/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts +++ b/src/app/browse-by/browse-by-date/browse-by-date.component.spec.ts @@ -95,8 +95,8 @@ describe('BrowseByDateComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity), }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: of({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'dateissued' }), { + params: of({ id: 'dateissued' }), queryParams: of({}), data: of({ metadata: 'dateissued', metadataField: 'dc.date.issued' }), }); @@ -151,9 +151,8 @@ describe('BrowseByDateComponent', () => { fixture = TestBed.createComponent(BrowseByDateComponent); const browseService = fixture.debugElement.injector.get(BrowseService); spyOn(browseService, 'getFirstItemFor') - // ok to expect the default browse as first param since we just need the mock items obtained via sort direction. - .withArgs('author', undefined, SortDirection.ASC).and.returnValue(createSuccessfulRemoteDataObject$(firstItem)) - .withArgs('author', undefined, SortDirection.DESC).and.returnValue(createSuccessfulRemoteDataObject$(lastItem)); + .withArgs('dateissued', undefined, SortDirection.ASC).and.returnValue(createSuccessfulRemoteDataObject$(firstItem)) + .withArgs('dateissued', undefined, SortDirection.DESC).and.returnValue(createSuccessfulRemoteDataObject$(lastItem)); comp = fixture.componentInstance; route = (comp as any).route; fixture.detectChanges(); diff --git a/src/app/browse-by/browse-by-date/browse-by-date.component.ts b/src/app/browse-by/browse-by-date/browse-by-date.component.ts index 3cd3daa752f..0e11c765156 100644 --- a/src/app/browse-by/browse-by-date/browse-by-date.component.ts +++ b/src/app/browse-by/browse-by-date/browse-by-date.component.ts @@ -115,7 +115,7 @@ export class BrowseByDateComponent extends BrowseByMetadataComponent implements this.currentSort$, ]).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => { const metadataKeys = params.browseDefinition ? params.browseDefinition.metadataKeys : this.defaultMetadataKeys; - this.browseId = params.id || this.defaultBrowseId; + this.browseId = params.id; this.startsWith = +params.startsWith || params.startsWith; const searchOptions = browseParamsToOptions(params, scope, currentPage, currentSort, this.browseId, this.fetchThumbnails); this.updatePageWithItems(searchOptions, this.value, undefined); diff --git a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts index fc892c67e7e..46df8b1c0c3 100644 --- a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts +++ b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.spec.ts @@ -123,8 +123,8 @@ describe('BrowseByMetadataComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity), }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: of({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'author' }), { + params: of({ id: 'author' }), }); paginationService = new PaginationServiceStub(); diff --git a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts index 006a0971e83..6f627b2da37 100644 --- a/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts +++ b/src/app/browse-by/browse-by-metadata/browse-by-metadata.component.ts @@ -137,16 +137,10 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy { * List of subscriptions */ subs: Subscription[] = []; - - /** - * The default browse id to resort to when none is provided - */ - defaultBrowseId = 'author'; - /** * The current browse id */ - browseId = this.defaultBrowseId; + browseId: string; /** * The type of StartsWith options to render @@ -232,7 +226,7 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, OnDestroy { this.currentPagination$, this.currentSort$, ]).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => { - this.browseId = params.id || this.defaultBrowseId; + this.browseId = params.id; this.authority = params.authority; if (typeof params.value === 'string') { diff --git a/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts b/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts index f60a142ade9..dbcb70f5176 100644 --- a/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts +++ b/src/app/browse-by/browse-by-title/browse-by-title.component.spec.ts @@ -82,8 +82,8 @@ describe('BrowseByTitleComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity), }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: of({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'title' }), { + params: of({ id: 'title' }), queryParams: of({}), data: of({ metadata: 'title' }), }); diff --git a/src/app/browse-by/browse-by-title/browse-by-title.component.ts b/src/app/browse-by/browse-by-title/browse-by-title.component.ts index 1563b851c2f..cddc98d385f 100644 --- a/src/app/browse-by/browse-by-title/browse-by-title.component.ts +++ b/src/app/browse-by/browse-by-title/browse-by-title.component.ts @@ -70,7 +70,7 @@ export class BrowseByTitleComponent extends BrowseByMetadataComponent implements this.currentSort$, ]).subscribe(([params, scope, currentPage, currentSort]: [Params, string, PaginationComponentOptions, SortOptions]) => { this.startsWith = +params.startsWith || params.startsWith; - this.browseId = params.id || this.defaultBrowseId; + this.browseId = params.id; this.updatePageWithItems(browseParamsToOptions(params, scope, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined); })); this.updateStartsWithTextOptions();