mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-16 22:43:03 +00:00
Archived items moved outside initial span element(fix for tests). Tests added.
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
<a [routerLink]="node.route" class="lead">
|
||||
{{node.name}}
|
||||
</a>
|
||||
<span>[{{node.payload.archivedItems}}]</span>
|
||||
<span *ngIf="node.payload.archivedItems" class="archived-items-lead">[{{node.payload.archivedItems}}]</span>
|
||||
</h5>
|
||||
</div>
|
||||
<ds-truncatable [id]="node.id">
|
||||
|
@@ -4,9 +4,7 @@
|
||||
<span *ngIf="linkType == linkTypes.None" class="lead">
|
||||
{{object.name}}
|
||||
</span>
|
||||
|
||||
<span class="lead" *ngIf="object.archivedItems">[{{object.archivedItems}}]<span>
|
||||
|
||||
<span *ngIf="object.archivedItems" class="archived-items-lead">[{{object.archivedItems}}]<span>
|
||||
<div *ngIf="object.shortDescription" class="text-muted abstract-text">
|
||||
{{object.shortDescription}}
|
||||
</div>
|
||||
|
@@ -7,6 +7,29 @@ import { Collection } from '../../../core/shared/collection.model';
|
||||
let collectionListElementComponent: CollectionListElementComponent;
|
||||
let fixture: ComponentFixture<CollectionListElementComponent>;
|
||||
|
||||
const mockCollectionWithArchivedItems: Collection = Object.assign(new Collection(), {
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Test title'
|
||||
}
|
||||
]
|
||||
}, archivedItems: 1
|
||||
});
|
||||
|
||||
const mockCollectionWithoutArchivedItems: Collection = Object.assign(new Collection(), {
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Test title'
|
||||
}
|
||||
]
|
||||
}, archivedItems: 0
|
||||
});
|
||||
|
||||
|
||||
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
||||
metadata: {
|
||||
'dc.description.abstract': [
|
||||
@@ -15,7 +38,7 @@ const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
||||
value: 'Short description'
|
||||
}
|
||||
]
|
||||
}
|
||||
}, archivedItems: 1
|
||||
});
|
||||
|
||||
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
|
||||
@@ -26,7 +49,7 @@ const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection()
|
||||
value: 'Test title'
|
||||
}
|
||||
]
|
||||
}
|
||||
}, archivedItems: 1
|
||||
});
|
||||
|
||||
describe('CollectionListElementComponent', () => {
|
||||
@@ -71,4 +94,29 @@ describe('CollectionListElementComponent', () => {
|
||||
expect(collectionAbstractField).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('When the collection has archived items', () => {
|
||||
beforeEach(() => {
|
||||
collectionListElementComponent.object = mockCollectionWithArchivedItems;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the archived items paragraph', () => {
|
||||
const field = fixture.debugElement.query(By.css('span.archived-items-lead'));
|
||||
expect(field).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the collection has no archived items', () => {
|
||||
beforeEach(() => {
|
||||
collectionListElementComponent.object = mockCollectionWithoutArchivedItems;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should not show the archived items paragraph', () => {
|
||||
const field = fixture.debugElement.query(By.css('span.archived-items-lead'));
|
||||
expect(field).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user