Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,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' }),
});
Expand Down Expand Up @@ -152,9 +152,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class BrowseByDateComponent extends BrowseByMetadataComponent implements
})).subscribe(({ params, scope, currentPage, currentSort }) => {
const metadataKeys = params.browseDefinition ? params.browseDefinition.metadataKeys : this.defaultMetadataKeys;
this.startsWith = +params.startsWith || params.startsWith;
this.browseId = params.id || this.defaultBrowseId;
this.browseId = params.id;
const searchOptions = browseParamsToOptions(params, scope, currentPage, currentSort, this.browseId, this.fetchThumbnails);
this.updatePageWithItems(searchOptions, this.value, undefined);
this.updateStartsWithOptions(this.browseId, metadataKeys, params.scope);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,10 @@ export class BrowseByMetadataComponent implements OnInit, OnChanges, 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,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' }),
});
Expand Down
Loading