diff --git a/src/app/community-list-page/community-list/community-list.component.html b/src/app/community-list-page/community-list/community-list.component.html index efc1f086ae..5f940b4405 100644 --- a/src/app/community-list-page/community-list/community-list.component.html +++ b/src/app/community-list-page/community-list/community-list.component.html @@ -37,7 +37,7 @@ {{node.name}} - [{{node.payload.archivedItems}}] + [{{node.payload.archivedItems}}] diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.html b/src/app/shared/object-list/collection-list-element/collection-list-element.component.html index b1900908a5..1fdb97f17b 100644 --- a/src/app/shared/object-list/collection-list-element/collection-list-element.component.html +++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.html @@ -4,9 +4,7 @@ {{object.name}} - -[{{object.archivedItems}}] - +[{{object.archivedItems}}]
{{object.shortDescription}}
diff --git a/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts b/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts index c41d5a7314..c1d9665bc3 100644 --- a/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts +++ b/src/app/shared/object-list/collection-list-element/collection-list-element.component.spec.ts @@ -7,6 +7,29 @@ import { Collection } from '../../../core/shared/collection.model'; let collectionListElementComponent: CollectionListElementComponent; let fixture: ComponentFixture; +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(); + }); + }); });