display the entity type in myDSpace

This commit is contained in:
Ben Bosman
2020-01-07 18:26:26 +01:00
parent 4b67dbf10f
commit bb87bf5a0e
2 changed files with 30 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
<ng-container *ngIf="status"> <ng-container *ngIf="status">
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status> <ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
</ng-container> </ng-container>
<ds-item-type-badge [object]="item"></ds-item-type-badge>
<ds-truncatable [id]="item.id"> <ds-truncatable [id]="item.id">
<h3 [innerHTML]="item.firstMetadataValue('dc.title') || ('mydspace.results.no-title' | translate)" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3> <h3 [innerHTML]="item.firstMetadataValue('dc.title') || ('mydspace.results.no-title' | translate)" [ngClass]="{'lead': true,'text-muted': !item.firstMetadataValue('dc.title')}"></h3>
<div> <div>

View File

@@ -47,6 +47,23 @@ const mockItemWithoutAuthorAndDate: Item = Object.assign(new Item(), {
] ]
} }
}); });
const mockItemWithEntityType: Item = Object.assign(new Item(), {
bundles: observableOf({}),
metadata: {
'dc.title': [
{
language: 'en_US',
value: 'This is just another title'
}
],
'relationship.type': [
{
language: null,
value: 'Publication'
}
]
}
});
describe('ItemListPreviewComponent', () => { describe('ItemListPreviewComponent', () => {
beforeEach(async(() => { beforeEach(async(() => {
@@ -128,4 +145,16 @@ describe('ItemListPreviewComponent', () => {
expect(dateField).not.toBeNull(); expect(dateField).not.toBeNull();
}); });
}); });
describe('When the item has an entity type', () => {
beforeEach(() => {
component.item = mockItemWithEntityType;
fixture.detectChanges();
});
it('should show the entity type span', () => {
const entityField = fixture.debugElement.query(By.css('ds-item-type-badge'));
expect(entityField).not.toBeNull();
});
});
}); });