mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23: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">
|
<a [routerLink]="node.route" class="lead">
|
||||||
{{node.name}}
|
{{node.name}}
|
||||||
</a>
|
</a>
|
||||||
<span>[{{node.payload.archivedItems}}]</span>
|
<span *ngIf="node.payload.archivedItems" class="archived-items-lead">[{{node.payload.archivedItems}}]</span>
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
<ds-truncatable [id]="node.id">
|
<ds-truncatable [id]="node.id">
|
||||||
|
@@ -4,9 +4,7 @@
|
|||||||
<span *ngIf="linkType == linkTypes.None" class="lead">
|
<span *ngIf="linkType == linkTypes.None" class="lead">
|
||||||
{{object.name}}
|
{{object.name}}
|
||||||
</span>
|
</span>
|
||||||
|
<span *ngIf="object.archivedItems" class="archived-items-lead">[{{object.archivedItems}}]<span>
|
||||||
<span class="lead" *ngIf="object.archivedItems">[{{object.archivedItems}}]<span>
|
|
||||||
|
|
||||||
<div *ngIf="object.shortDescription" class="text-muted abstract-text">
|
<div *ngIf="object.shortDescription" class="text-muted abstract-text">
|
||||||
{{object.shortDescription}}
|
{{object.shortDescription}}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -7,6 +7,29 @@ import { Collection } from '../../../core/shared/collection.model';
|
|||||||
let collectionListElementComponent: CollectionListElementComponent;
|
let collectionListElementComponent: CollectionListElementComponent;
|
||||||
let fixture: ComponentFixture<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(), {
|
const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
||||||
metadata: {
|
metadata: {
|
||||||
'dc.description.abstract': [
|
'dc.description.abstract': [
|
||||||
@@ -15,7 +38,7 @@ const mockCollectionWithAbstract: Collection = Object.assign(new Collection(), {
|
|||||||
value: 'Short description'
|
value: 'Short description'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}, archivedItems: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
|
const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection(), {
|
||||||
@@ -26,7 +49,7 @@ const mockCollectionWithoutAbstract: Collection = Object.assign(new Collection()
|
|||||||
value: 'Test title'
|
value: 'Test title'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}, archivedItems: 1
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('CollectionListElementComponent', () => {
|
describe('CollectionListElementComponent', () => {
|
||||||
@@ -71,4 +94,29 @@ describe('CollectionListElementComponent', () => {
|
|||||||
expect(collectionAbstractField).toBeNull();
|
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