diff --git a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts index f64091e41f4..dab1d1601fa 100644 --- a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts +++ b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.spec.ts @@ -74,8 +74,8 @@ describe('BrowseByDatePageComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity) }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: observableOf({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'dateissued' }), { + params: observableOf({ id: 'dateissued' }), queryParams: observableOf({}), data: observableOf({ metadata: 'dateissued', metadataField: 'dc.date.issued' }) }); @@ -110,9 +110,8 @@ describe('BrowseByDatePageComponent', () => { fixture = TestBed.createComponent(BrowseByDatePageComponent); 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-page/browse-by-date-page.component.ts b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts index cca56647d81..bf64b835619 100644 --- a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts +++ b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts @@ -75,7 +75,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent { this.currentSort$, ]).subscribe(([params, currentPage, currentSort]: [Params, 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, currentPage, currentSort, this.browseId, this.fetchThumbnails); this.updatePageWithItems(searchOptions, this.value, undefined); diff --git a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts index 4ea68eaa0c7..8d3dbdc3774 100644 --- a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts +++ b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.spec.ts @@ -95,8 +95,8 @@ describe('BrowseByMetadataPageComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity) }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: observableOf({}) + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'author' }), { + params: observableOf({ id: 'author' }), }); paginationService = new PaginationServiceStub(); diff --git a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts index aaba0c44399..02f885c3066 100644 --- a/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts +++ b/src/app/browse-by/browse-by-metadata-page/browse-by-metadata-page.component.ts @@ -83,15 +83,10 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy { */ 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 @@ -177,7 +172,7 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy { this.currentPagination$, this.currentSort$, ]).subscribe(([params, currentPage, currentSort]: [Params, 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-page/browse-by-title-page.component.spec.ts b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts index 1b8eb352a39..3e7a2c6fe1f 100644 --- a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts +++ b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.spec.ts @@ -62,8 +62,8 @@ describe('BrowseByTitlePageComponent', () => { findById: () => createSuccessfulRemoteDataObject$(mockCommunity) }; - const activatedRouteStub = Object.assign(new ActivatedRouteStub(), { - params: observableOf({}), + const activatedRouteStub = Object.assign(new ActivatedRouteStub({ id: 'title' }), { + params: observableOf({ id: 'title' }), queryParams: observableOf({}), data: observableOf({ metadata: 'title' }), }); diff --git a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts index 10968d265ff..5e498951f27 100644 --- a/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts +++ b/src/app/browse-by/browse-by-title-page/browse-by-title-page.component.ts @@ -62,7 +62,7 @@ export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent { this.currentSort$, ]).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => { this.startsWith = +params.startsWith || params.startsWith; - this.browseId = params.id || this.defaultBrowseId; + this.browseId = params.id; this.updatePageWithItems(browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), undefined, undefined); this.updateParent(params.scope); this.updateLogo();