From ee29a360579d999fd137524a81391e0831724bbe Mon Sep 17 00:00:00 2001
From: milanmajchrak
Date: Thu, 21 May 2026 12:21:28 +0200
Subject: [PATCH 1/2] Updated components to display `dc.description` instead of
`dc.description.abstract`
---
...-search-result-grid-element.component.html | 4 +-
...arch-result-grid-element.component.spec.ts | 80 ++++++++++++++++++-
...-search-result-list-element.component.html | 4 +-
...arch-result-list-element.component.spec.ts | 32 +++++++-
4 files changed, 110 insertions(+), 10 deletions(-)
diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html
index 9aa511cb415..7e2f093a32e 100644
--- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html
+++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.html
@@ -29,9 +29,9 @@
-
+
+ [innerHTML]="firstMetadataValue('dc.description')">
diff --git a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts
index 7665b7d64e3..06fff63d181 100644
--- a/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts
+++ b/src/app/shared/object-list/search-result-list-element/item-search-result/item-types/item/item-search-result-list-element.component.spec.ts
@@ -48,7 +48,7 @@ const mockItemWithMetadata: ItemSearchResult = Object.assign(new ItemSearchResul
value: '2015-06-26'
}
],
- 'dc.description.abstract': [
+ 'dc.description': [
{
language: 'en_US',
value: 'This is the abstract'
@@ -57,6 +57,20 @@ const mockItemWithMetadata: ItemSearchResult = Object.assign(new ItemSearchResul
}
})
});
+const mockItemWithAbstractOnly: ItemSearchResult = Object.assign(new ItemSearchResult(), {
+ indexableObject:
+ Object.assign(new Item(), {
+ bundles: observableOf({}),
+ metadata: {
+ 'dc.description.abstract': [
+ {
+ language: 'en_US',
+ value: 'Legacy abstract only'
+ }
+ ]
+ }
+ })
+});
const mockItemWithoutMetadata: ItemSearchResult = Object.assign(new ItemSearchResult(), {
indexableObject:
Object.assign(new Item(), {
@@ -99,7 +113,7 @@ const mockPerson: ItemSearchResult = Object.assign(new ItemSearchResult(), {
value: '2015-06-26'
}
],
- 'dc.description.abstract': [
+ 'dc.description': [
{
language: 'en_US',
value: 'This is the abstract'
@@ -153,7 +167,7 @@ const mockOrgUnit: ItemSearchResult = Object.assign(new ItemSearchResult(), {
value: '2015-06-26'
}
],
- 'dc.description.abstract': [
+ 'dc.description': [
{
language: 'en_US',
value: 'This is the abstract'
@@ -317,6 +331,18 @@ describe('ItemSearchResultListElementComponent', () => {
});
});
+ describe('When the item has only dc.description.abstract metadata', () => {
+ beforeEach(() => {
+ publicationListElementComponent.object = mockItemWithAbstractOnly;
+ fixture.detectChanges();
+ });
+
+ it('should not show the abstract span', () => {
+ const abstractField = fixture.debugElement.query(By.css('div.item-list-abstract'));
+ expect(abstractField).toBeNull();
+ });
+ });
+
describe('When the item has title', () => {
beforeEach(() => {
publicationListElementComponent.object = mockItemWithMetadata;
From 3ab85cc5ca72541c560bb57f6722536ed0f7ceb7 Mon Sep 17 00:00:00 2001
From: milanmajchrak
Date: Thu, 21 May 2026 13:10:59 +0200
Subject: [PATCH 2/2] fix(search-results): use dc.description for item
description + align tests
---
...arch-result-grid-element.component.spec.ts | 79 ++++++-------------
1 file changed, 22 insertions(+), 57 deletions(-)
diff --git a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts
index 2adeda3f850..92c057a3cd5 100644
--- a/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts
+++ b/src/app/shared/object-grid/search-result-grid-element/item-search-result/item/item-search-result-grid-element.component.spec.ts
@@ -205,62 +205,7 @@ mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), {
}
});
-describe('ItemGridElementComponent', getEntityGridElementTestComponent(ItemSearchResultGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['authors', 'date', 'abstract']));
-
-describe('ItemGridElementComponent with legacy abstract metadata', () => {
- let comp;
- let fixture;
-
- const truncatableServiceStub: any = {
- isCollapsed: () => observableOf(true),
- };
-
- const mockBitstreamDataService = {
- getThumbnailFor(): Observable> {
- return createSuccessfulRemoteDataObject$(new Bitstream());
- }
- };
-
- beforeEach(waitForAsync(() => {
- TestBed.configureTestingModule({
- imports: [
- NoopAnimationsModule,
- TranslateModule.forRoot()
- ],
- declarations: [ItemSearchResultGridElementComponent, TruncatePipe],
- providers: [
- { provide: TruncatableService, useValue: truncatableServiceStub },
- { provide: ObjectCacheService, useValue: {} },
- { provide: UUIDService, useValue: {} },
- { provide: Store, useValue: {} },
- { provide: RemoteDataBuildService, useValue: {} },
- { provide: CommunityDataService, useValue: {} },
- { provide: HALEndpointService, useValue: {} },
- { provide: HttpClient, useValue: {} },
- { provide: DSOChangeAnalyzer, useValue: {} },
- { provide: NotificationsService, useValue: {} },
- { provide: DefaultChangeAnalyzer, useValue: {} },
- { provide: BitstreamDataService, useValue: mockBitstreamDataService },
- ],
- schemas: [NO_ERRORS_SCHEMA]
- }).overrideComponent(ItemSearchResultGridElementComponent, {
- set: { changeDetection: ChangeDetectionStrategy.Default }
- }).compileComponents();
- }));
-
- beforeEach(waitForAsync(() => {
- fixture = TestBed.createComponent(ItemSearchResultGridElementComponent);
- comp = fixture.componentInstance;
- }));
-
- it('should not show abstract field when only dc.description.abstract is available', () => {
- comp.object = mockItemWithAbstractOnly;
- fixture.detectChanges();
-
- const abstractField = fixture.debugElement.query(By.css('.item-abstract'));
- expect(abstractField).toBeNull();
- });
-});
+describe('ItemGridElementComponent', getEntityGridElementTestComponent(ItemSearchResultGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['authors', 'date', 'abstract'], mockItemWithAbstractOnly));
/**
* Create test cases for a grid component of an entity.
@@ -271,7 +216,13 @@ describe('ItemGridElementComponent with legacy abstract metadata', () => {
* For example: If one of the fields to check is labeled "authors", the html template should contain at least one element with class ".item-authors" that's
* present when the author metadata is available.
*/
-export function getEntityGridElementTestComponent(component, searchResultWithMetadata: ItemSearchResult, searchResultWithoutMetadata: ItemSearchResult, fieldsToCheck: string[]) {
+export function getEntityGridElementTestComponent(
+ component,
+ searchResultWithMetadata: ItemSearchResult,
+ searchResultWithoutMetadata: ItemSearchResult,
+ fieldsToCheck: string[],
+ searchResultWithAbstractOnly?: ItemSearchResult,
+) {
return () => {
let comp;
let fixture;
@@ -318,6 +269,20 @@ export function getEntityGridElementTestComponent(component, searchResultWithMet
comp = fixture.componentInstance;
}));
+ if (searchResultWithAbstractOnly) {
+ describe('when the item has only dc.description.abstract metadata', () => {
+ beforeEach(() => {
+ comp.object = searchResultWithAbstractOnly;
+ fixture.detectChanges();
+ });
+
+ it('should not show abstract field', () => {
+ const abstractField = fixture.debugElement.query(By.css('.item-abstract'));
+ expect(abstractField).toBeNull();
+ });
+ });
+ }
+
fieldsToCheck.forEach((field) => {
describe(`when the item has "${field}" metadata`, () => {
beforeEach(() => {