mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
77472: Fix unclickable titles in search lists
This commit is contained in:
@@ -11,6 +11,8 @@ import { Collection } from '../../../../../core/shared/collection.model';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { getCollectionEditRoute } from '../../../../../+collection-page/collection-page-routing-paths';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||
let component: CollectionAdminSearchResultListElementComponent;
|
||||
@@ -33,7 +35,8 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||
RouterTestingModule.withRoutes([])
|
||||
],
|
||||
declarations: [CollectionAdminSearchResultListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
providers: [{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -11,6 +11,8 @@ import { CommunityAdminSearchResultListElementComponent } from './community-admi
|
||||
import { CommunitySearchResult } from '../../../../../shared/object-collection/shared/community-search-result.model';
|
||||
import { Community } from '../../../../../core/shared/community.model';
|
||||
import { getCommunityEditRoute } from '../../../../../+community-page/community-page-routing-paths';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||
let component: CommunityAdminSearchResultListElementComponent;
|
||||
@@ -33,7 +35,8 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||
RouterTestingModule.withRoutes([])
|
||||
],
|
||||
declarations: [CommunityAdminSearchResultListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
providers: [{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -8,6 +8,8 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { ItemAdminSearchResultListElementComponent } from './item-admin-search-result-list-element.component';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
let component: ItemAdminSearchResultListElementComponent;
|
||||
@@ -30,7 +32,8 @@ describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
RouterTestingModule.withRoutes([])
|
||||
],
|
||||
declarations: [ItemAdminSearchResultListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} }],
|
||||
providers: [{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -16,6 +16,8 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
describe('WorkflowItemAdminWorkflowListElementComponent', () => {
|
||||
let component: WorkflowItemSearchResultAdminWorkflowListElementComponent;
|
||||
@@ -49,6 +51,7 @@ describe('WorkflowItemAdminWorkflowListElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
})
|
||||
|
@@ -12,6 +12,7 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { SearchResultListElementComponent } from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@listableObjectComponent(WorkflowItemSearchResult, ViewMode.ListElement, Context.AdminWorkflowSearch)
|
||||
@Component({
|
||||
@@ -29,8 +30,11 @@ export class WorkflowItemSearchResultAdminWorkflowListElementComponent extends S
|
||||
*/
|
||||
public item$: Observable<Item>;
|
||||
|
||||
constructor(private linkService: LinkService, protected truncatableService: TruncatableService) {
|
||||
super(truncatableService);
|
||||
constructor(private linkService: LinkService,
|
||||
protected truncatableService: TruncatableService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -45,7 +45,7 @@ describe(`DSONameService`, () => {
|
||||
}
|
||||
});
|
||||
|
||||
service = new DSONameService();
|
||||
service = new DSONameService({ instant: (a) => a } as any);
|
||||
});
|
||||
|
||||
describe(`getName`, () => {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
/**
|
||||
* Returns a name for a {@link DSpaceObject} based
|
||||
@@ -11,6 +12,10 @@ import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
})
|
||||
export class DSONameService {
|
||||
|
||||
constructor(private translateService: TranslateService) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions to generate the specific names.
|
||||
*
|
||||
@@ -29,7 +34,7 @@ export class DSONameService {
|
||||
},
|
||||
Default: (dso: DSpaceObject): string => {
|
||||
// If object doesn't have dc.title metadata use name property
|
||||
return dso.firstMetadataValue('dc.title') || dso.name;
|
||||
return dso.firstMetadataValue('dc.title') || dso.name || this.translateService.instant('dso.name.untitled');
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -7,6 +7,8 @@ import { JournalIssueSearchResultListElementComponent } from './journal-issue-se
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<JournalIssueSearchResultListElementComponent>;
|
||||
@@ -60,7 +62,8 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [JournalIssueSearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} }
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -7,6 +7,8 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { JournalVolumeSearchResultListElementComponent } from './journal-volume-search-result-list-element.component';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<JournalVolumeSearchResultListElementComponent>;
|
||||
@@ -59,7 +61,8 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [JournalVolumeSearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} }
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -7,6 +7,8 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
let journalListElementComponent: JournalSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<JournalSearchResultListElementComponent>;
|
||||
@@ -55,7 +57,8 @@ describe('JournalSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [JournalSearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} }
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -7,6 +7,8 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
|
||||
@@ -53,7 +55,8 @@ describe('OrgUnitSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} }
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
|
@@ -7,6 +7,8 @@ import { PersonSearchResultListElementComponent } from './person-search-result-l
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
let personListElementComponent: PersonSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<PersonSearchResultListElementComponent>;
|
||||
@@ -53,7 +55,8 @@ describe('PersonSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [PersonSearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} }
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -6,6 +6,8 @@ import { ProjectSearchResultListElementComponent } from './project-search-result
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
let projectListElementComponent: ProjectSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ProjectSearchResultListElementComponent>;
|
||||
@@ -53,7 +55,8 @@ describe('ProjectSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ProjectSearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} }
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -9,6 +9,7 @@ import { isNotEmpty } from '../../../../../shared/empty.util';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModal)
|
||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent)
|
||||
@@ -23,8 +24,10 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
export class PersonSidebarSearchListElementComponent extends SidebarSearchListElementComponent<ItemSearchResult, Item> {
|
||||
constructor(protected truncatableService: TruncatableService,
|
||||
protected linkService: LinkService,
|
||||
protected translateService: TranslateService) {
|
||||
super(truncatableService, linkService);
|
||||
protected translateService: TranslateService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService, linkService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -27,6 +27,8 @@ import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { OrgUnitSearchResultListSubmissionElementComponent } from './org-unit-search-result-list-submission-element.component';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../../shared/mocks/dso-name.service.mock';
|
||||
|
||||
let personListElementComponent: OrgUnitSearchResultListSubmissionElementComponent;
|
||||
let fixture: ComponentFixture<OrgUnitSearchResultListSubmissionElementComponent>;
|
||||
@@ -115,6 +117,7 @@ describe('OrgUnitSearchResultListSubmissionElementComponent', () => {
|
||||
{ provide: DSOChangeAnalyzer, useValue: {} },
|
||||
{ provide: DefaultChangeAnalyzer, useValue: {} },
|
||||
{ provide: BitstreamDataService, useValue: mockBitstreamDataService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -19,6 +19,8 @@ import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
import { ItemDataService } from '../../../../../core/data/item-data.service';
|
||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { NameVariantModalComponent } from '../../name-variant-modal/name-variant-modal.component';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModal)
|
||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
||||
@@ -44,8 +46,10 @@ export class OrgUnitSearchResultListSubmissionElementComponent extends SearchRes
|
||||
private modalService: NgbModal,
|
||||
private itemDataService: ItemDataService,
|
||||
private bitstreamDataService: BitstreamDataService,
|
||||
private selectableListService: SelectableListService) {
|
||||
super(truncatableService);
|
||||
private selectableListService: SelectableListService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@@ -19,6 +19,8 @@ import { NameVariantModalComponent } from '../../name-variant-modal/name-variant
|
||||
import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
import { ItemDataService } from '../../../../../core/data/item-data.service';
|
||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
|
||||
@Component({
|
||||
@@ -42,8 +44,10 @@ export class PersonSearchResultListSubmissionElementComponent extends SearchResu
|
||||
private modalService: NgbModal,
|
||||
private itemDataService: ItemDataService,
|
||||
private bitstreamDataService: BitstreamDataService,
|
||||
private selectableListService: SelectableListService) {
|
||||
super(truncatableService);
|
||||
private selectableListService: SelectableListService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
9
src/app/shared/mocks/dso-name.service.mock.ts
Normal file
9
src/app/shared/mocks/dso-name.service.mock.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
|
||||
export const UNDEFINED_NAME = 'Undefined';
|
||||
|
||||
export class DSONameServiceMock {
|
||||
public getName(dso: DSpaceObject) {
|
||||
return UNDEFINED_NAME;
|
||||
}
|
||||
}
|
@@ -15,6 +15,8 @@ import { VarDirective } from '../../../utils/var.directive';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: PoolSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<PoolSearchResultDetailElementComponent>;
|
||||
@@ -67,7 +69,8 @@ describe('PoolSearchResultDetailElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: 'objectElementProvider', useValue: (mockResultObject) },
|
||||
{ provide: 'indexElementProvider', useValue: (compIndex) },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PoolSearchResultDetailElementComponent, {
|
||||
|
@@ -12,6 +12,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: WorkflowItemSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<WorkflowItemSearchResultDetailElementComponent>;
|
||||
@@ -62,7 +64,8 @@ describe('WorkflowItemSearchResultDetailElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: 'objectElementProvider', useValue: (mockResultObject) },
|
||||
{ provide: 'indexElementProvider', useValue: (compIndex) },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(WorkflowItemSearchResultDetailElementComponent, {
|
||||
|
@@ -12,6 +12,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: WorkspaceItemSearchResultDetailElementComponent;
|
||||
let fixture: ComponentFixture<WorkspaceItemSearchResultDetailElementComponent>;
|
||||
@@ -62,7 +64,8 @@ describe('WorkspaceItemSearchResultDetailElementComponent', () => {
|
||||
providers: [
|
||||
{ provide: 'objectElementProvider', useValue: (mockResultObject) },
|
||||
{ provide: 'indexElementProvider', useValue: (compIndex) },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(WorkspaceItemSearchResultDetailElementComponent, {
|
||||
|
@@ -15,6 +15,8 @@ import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||
import { ClaimedApprovedTaskSearchResult } from '../../../../object-collection/shared/claimed-approved-task-search-result.model';
|
||||
import { ClaimedApprovedSearchResultListElementComponent } from './claimed-approved-search-result-list-element.component';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: ClaimedApprovedSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ClaimedApprovedSearchResultListElementComponent>;
|
||||
@@ -64,7 +66,8 @@ describe('ClaimedApprovedSearchResultListElementComponent', () => {
|
||||
declarations: [ClaimedApprovedSearchResultListElementComponent, VarDirective],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ClaimedApprovedSearchResultListElementComponent, {
|
||||
|
@@ -12,6 +12,7 @@ import { followLink } from '../../../../utils/follow-link-config.model';
|
||||
import { SearchResultListElementComponent } from '../../../search-result-list-element/search-result-list-element.component';
|
||||
import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/claimed-task-search-result.model';
|
||||
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
/**
|
||||
* This component renders claimed task approved object for the search result in the list view.
|
||||
@@ -41,9 +42,10 @@ export class ClaimedApprovedSearchResultListElementComponent extends SearchResul
|
||||
|
||||
public constructor(
|
||||
protected linkService: LinkService,
|
||||
protected truncatableService: TruncatableService
|
||||
protected truncatableService: TruncatableService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService);
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,6 +15,8 @@ import { VarDirective } from '../../../../utils/var.directive';
|
||||
import { TruncatableService } from '../../../../truncatable/truncatable.service';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { MyDspaceItemStatusType } from '../../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: ClaimedDeclinedSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ClaimedDeclinedSearchResultListElementComponent>;
|
||||
@@ -64,7 +66,8 @@ describe('ClaimedDeclinedSearchResultListElementComponent', () => {
|
||||
declarations: [ClaimedDeclinedSearchResultListElementComponent, VarDirective],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ClaimedDeclinedSearchResultListElementComponent, {
|
||||
|
@@ -13,6 +13,7 @@ import { followLink } from '../../../../utils/follow-link-config.model';
|
||||
import { SearchResultListElementComponent } from '../../../search-result-list-element/search-result-list-element.component';
|
||||
import { ClaimedTaskSearchResult } from '../../../../object-collection/shared/claimed-task-search-result.model';
|
||||
import { ClaimedTask } from '../../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
/**
|
||||
* This component renders claimed task declined object for the search result in the list view.
|
||||
@@ -42,9 +43,10 @@ export class ClaimedDeclinedSearchResultListElementComponent extends SearchResul
|
||||
|
||||
public constructor(
|
||||
protected linkService: LinkService,
|
||||
protected truncatableService: TruncatableService
|
||||
protected truncatableService: TruncatableService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService);
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@ import { VarDirective } from '../../../utils/var.directive';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: ClaimedSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ClaimedSearchResultListElementComponent>;
|
||||
@@ -65,7 +67,8 @@ describe('ClaimedSearchResultListElementComponent', () => {
|
||||
declarations: [ClaimedSearchResultListElementComponent, VarDirective],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ClaimedSearchResultListElementComponent, {
|
||||
|
@@ -12,6 +12,7 @@ import { WorkflowItem } from '../../../../core/submission/models/workflowitem.mo
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||
import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-claimed-search-result-list-element',
|
||||
@@ -38,9 +39,10 @@ export class ClaimedSearchResultListElementComponent extends SearchResultListEle
|
||||
|
||||
public constructor(
|
||||
protected linkService: LinkService,
|
||||
protected truncatableService: TruncatableService
|
||||
protected truncatableService: TruncatableService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService);
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -10,6 +10,8 @@ import { ItemSearchResult } from '../../../object-collection/shared/item-search-
|
||||
import { ItemSearchResultListElementSubmissionComponent } from './item-search-result-list-element-submission.component';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: ItemSearchResultListElementSubmissionComponent;
|
||||
let fixture: ComponentFixture<ItemSearchResultListElementSubmissionComponent>;
|
||||
@@ -54,6 +56,7 @@ describe('ItemMyDSpaceResultListElementComponent', () => {
|
||||
declarations: [ItemSearchResultListElementSubmissionComponent],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(ItemSearchResultListElementSubmissionComponent, {
|
||||
|
@@ -16,6 +16,8 @@ import { VarDirective } from '../../../utils/var.directive';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { getMockLinkService } from '../../../mocks/link-service.mock';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: PoolSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<PoolSearchResultListElementComponent>;
|
||||
@@ -65,7 +67,8 @@ describe('PoolSearchResultListElementComponent', () => {
|
||||
declarations: [PoolSearchResultListElementComponent, VarDirective],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService }
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(PoolSearchResultListElementComponent, {
|
||||
|
@@ -13,6 +13,7 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { LinkService } from '../../../../core/cache/builders/link.service';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
/**
|
||||
* This component renders pool task object for the search result in the list view.
|
||||
@@ -48,9 +49,10 @@ export class PoolSearchResultListElementComponent extends SearchResultListElemen
|
||||
|
||||
constructor(
|
||||
protected linkService: LinkService,
|
||||
protected truncatableService: TruncatableService
|
||||
protected truncatableService: TruncatableService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService);
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { WorkflowItemSearchResultListElementComponent } from './workflow-item-search-result-list-element.component';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: WorkflowItemSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<WorkflowItemSearchResultListElementComponent>;
|
||||
@@ -67,6 +69,7 @@ describe('WorkflowItemSearchResultListElementComponent', () => {
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: ItemDataService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(WorkflowItemSearchResultListElementComponent, {
|
||||
|
@@ -15,6 +15,7 @@ import { WorkflowItemSearchResult } from '../../../object-collection/shared/work
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
/**
|
||||
* This component renders workflowitem object for the search result in the list view.
|
||||
@@ -40,9 +41,10 @@ export class WorkflowItemSearchResultListElementComponent extends SearchResultLi
|
||||
|
||||
constructor(
|
||||
protected truncatableService: TruncatableService,
|
||||
protected linkService: LinkService
|
||||
protected linkService: LinkService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService);
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -16,6 +16,8 @@ import { createSuccessfulRemoteDataObject } from '../../../remote-data.utils';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { WorkspaceItemSearchResultListElementComponent } from './workspace-item-search-result-list-element.component';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let component: WorkspaceItemSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<WorkspaceItemSearchResultListElementComponent>;
|
||||
@@ -66,6 +68,7 @@ describe('WorkspaceItemSearchResultListElementComponent', () => {
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: ItemDataService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(WorkspaceItemSearchResultListElementComponent, {
|
||||
|
@@ -15,6 +15,7 @@ import { WorkspaceItemSearchResult } from '../../../object-collection/shared/wor
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { followLink } from '../../../utils/follow-link-config.model';
|
||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
/**
|
||||
* This component renders workspaceitem object for the search result in the list view.
|
||||
@@ -40,9 +41,10 @@ export class WorkspaceItemSearchResultListElementComponent extends SearchResultL
|
||||
|
||||
constructor(
|
||||
protected truncatableService: TruncatableService,
|
||||
protected linkService: LinkService
|
||||
protected linkService: LinkService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService);
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/' + dso.id]" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></span>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/collections/' + dso.id]" class="lead" [innerHTML]="dsoTitle"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
|
||||
<div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div>
|
||||
|
@@ -7,6 +7,8 @@ import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||
import { Collection } from '../../../../core/shared/collection.model';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { CollectionSearchResult } from '../../../object-collection/shared/collection-search-result.model';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let collectionSearchResultListElementComponent: CollectionSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<CollectionSearchResultListElementComponent>;
|
||||
@@ -47,6 +49,7 @@ describe('CollectionSearchResultListElementComponent', () => {
|
||||
declarations: [CollectionSearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
}).overrideComponent(CollectionSearchResultListElementComponent, {
|
||||
|
@@ -1,4 +1,4 @@
|
||||
<ds-type-badge *ngIf="showLabel" [object]="dso"></ds-type-badge>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/' + dso.id]" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="firstMetadataValue('dc.title')"></span>
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer" [routerLink]="['/communities/' + dso.id]" class="lead" [innerHTML]="dsoTitle"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead" [innerHTML]="dsoTitle"></span>
|
||||
<div *ngIf="dso.shortDescription" class="text-muted abstract-text" [innerHTML]="firstMetadataValue('dc.description.abstract')"></div>
|
||||
|
@@ -7,6 +7,8 @@ import { TruncatePipe } from '../../../utils/truncate.pipe';
|
||||
import { Community } from '../../../../core/shared/community.model';
|
||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||
import { CommunitySearchResult } from '../../../object-collection/shared/community-search-result.model';
|
||||
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../../mocks/dso-name.service.mock';
|
||||
|
||||
let communitySearchResultListElementComponent: CommunitySearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<CommunitySearchResultListElementComponent>;
|
||||
@@ -47,6 +49,7 @@ describe('CommunitySearchResultListElementComponent', () => {
|
||||
declarations: [CommunitySearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -2,10 +2,10 @@
|
||||
|
||||
<ds-truncatable [id]="dso.id" *ngIf="object !== undefined && object !== null">
|
||||
<a *ngIf="linkType != linkTypes.None" [target]="(linkType == linkTypes.ExternalLink) ? '_blank' : '_self'" rel="noopener noreferrer"
|
||||
[routerLink]="[itemPageRoute]" class="lead"
|
||||
[innerHTML]="firstMetadataValue('dc.title')"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead"
|
||||
[innerHTML]="firstMetadataValue('dc.title')"></span>
|
||||
[routerLink]="[itemPageRoute]" class="lead item-list-title"
|
||||
[innerHTML]="dsoTitle"></a>
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead item-list-title"
|
||||
[innerHTML]="dsoTitle"></span>
|
||||
<span class="text-muted">
|
||||
<ds-truncatable-part [id]="dso.id" [minLines]="1">
|
||||
<ng-container *ngIf="dso.firstMetadataValue('dc.publisher') || dso.firstMetadataValue('dc.date.issued')">
|
||||
|
@@ -7,6 +7,8 @@ import { Item } from '../../../../../../core/shared/item.model';
|
||||
import { TruncatePipe } from '../../../../../utils/truncate.pipe';
|
||||
import { TruncatableService } from '../../../../../truncatable/truncatable.service';
|
||||
import { ItemSearchResult } from '../../../../../object-collection/shared/item-search-result.model';
|
||||
import { DSONameService } from '../../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock, UNDEFINED_NAME } from '../../../../../mocks/dso-name.service.mock';
|
||||
|
||||
let publicationListElementComponent: ItemSearchResultListElementComponent;
|
||||
let fixture: ComponentFixture<ItemSearchResultListElementComponent>;
|
||||
@@ -53,23 +55,18 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(new ItemSearchRe
|
||||
indexableObject:
|
||||
Object.assign(new Item(), {
|
||||
bundles: observableOf({}),
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is just another title'
|
||||
}
|
||||
]
|
||||
}
|
||||
metadata: {}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
describe('ItemListElementComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ItemSearchResultListElementComponent, TruncatePipe],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} }
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock }
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
@@ -179,4 +176,16 @@ describe('ItemListElementComponent', () => {
|
||||
expect(abstractField).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item has no title', () => {
|
||||
beforeEach(() => {
|
||||
publicationListElementComponent.object = mockItemWithoutMetadata;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the fallback untitled translation', () => {
|
||||
const titleField = fixture.debugElement.query(By.css('.item-list-title'));
|
||||
expect(titleField.nativeElement.textContent.trim()).toEqual(UNDEFINED_NAME);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -7,6 +7,7 @@ import { hasValue } from '../../empty.util';
|
||||
import { AbstractListableElementComponent } from '../../object-collection/shared/object-collection-element/abstract-listable-element.component';
|
||||
import { TruncatableService } from '../../truncatable/truncatable.service';
|
||||
import { Metadata } from '../../../core/shared/metadata.utils';
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-search-result-list-element',
|
||||
@@ -17,8 +18,9 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
||||
* The DSpaceObject of the search result
|
||||
*/
|
||||
dso: K;
|
||||
dsoTitle: string;
|
||||
|
||||
public constructor(protected truncatableService: TruncatableService) {
|
||||
public constructor(protected truncatableService: TruncatableService, protected dsoNameService: DSONameService) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -28,6 +30,7 @@ export class SearchResultListElementComponent<T extends SearchResult<K>, K exten
|
||||
ngOnInit(): void {
|
||||
if (hasValue(this.object)) {
|
||||
this.dso = this.object.indexableObject;
|
||||
this.dsoTitle = this.dsoNameService.getName(this.dso);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -10,6 +10,8 @@ import { LinkService } from '../../../core/cache/builders/link.service';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../remote-data.utils';
|
||||
import { HALResource } from '../../../core/shared/hal-resource.model';
|
||||
import { ChildHALResource } from '../../../core/shared/child-hal-resource.model';
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
import { DSONameServiceMock } from '../../mocks/dso-name.service.mock';
|
||||
|
||||
export function createSidebarSearchListElementTests(
|
||||
componentClass: any,
|
||||
@@ -38,6 +40,7 @@ export function createSidebarSearchListElementTests(
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
...extraProviders
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -12,6 +12,7 @@ import { followLink } from '../../utils/follow-link-config.model';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { Context } from '../../../core/shared/context.model';
|
||||
import { DSONameService } from '../../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-sidebar-search-list-element',
|
||||
@@ -39,8 +40,10 @@ export class SidebarSearchListElementComponent<T extends SearchResult<K>, K exte
|
||||
description: string;
|
||||
|
||||
public constructor(protected truncatableService: TruncatableService,
|
||||
protected linkService: LinkService) {
|
||||
super(truncatableService);
|
||||
protected linkService: LinkService,
|
||||
protected dsoNameService: DSONameService
|
||||
) {
|
||||
super(truncatableService, dsoNameService);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -1098,6 +1098,10 @@
|
||||
|
||||
|
||||
|
||||
"dso.name.untitled": "Untitled",
|
||||
|
||||
|
||||
|
||||
"dso-selector.create.collection.head": "New collection",
|
||||
|
||||
"dso-selector.create.collection.sub-level": "Create a new collection in",
|
||||
|
Reference in New Issue
Block a user