Merge pull request #564 from atmire/mydspace-display-entity-type

Display the entity type in MyDSpace
This commit is contained in:
benbosman
2020-01-23 14:44:41 +01:00
committed by GitHub
2 changed files with 30 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
<ng-container *ngIf="status">
<ds-mydspace-item-status [status]="status"></ds-mydspace-item-status>
</ng-container>
<ds-item-type-badge [object]="item"></ds-item-type-badge>
<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>
<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', () => {
beforeEach(async(() => {
@@ -128,4 +145,16 @@ describe('ItemListPreviewComponent', () => {
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();
});
});
});