mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-13 13:03:04 +00:00
[CST-7604] fixed as per tom comment to highlight Journal, Project, OrgUnit or Person) or is a Community or Collection
This commit is contained in:
@@ -28,13 +28,14 @@ import { ItemSearchResultGridElementComponent } from './item-search-result-grid-
|
||||
|
||||
const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult();
|
||||
mockItemWithMetadata.hitHighlights = {};
|
||||
const dcTitle = 'This is just another <em>title</em>';
|
||||
mockItemWithMetadata.indexableObject = Object.assign(new Item(), {
|
||||
bundles: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])),
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is just another title'
|
||||
value: dcTitle
|
||||
}
|
||||
],
|
||||
'dc.contributor.author': [
|
||||
@@ -154,6 +155,17 @@ export function getEntityGridElementTestComponent(component, searchResultWithMet
|
||||
expect(itemAuthorField).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item has title', () => {
|
||||
beforeEach(() => {
|
||||
comp.object = mockItemWithMetadata;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
it('should show highlighted title', () => {
|
||||
const titleField = fixture.debugElement.query(By.css('.card-title'));
|
||||
expect(titleField.nativeNode.innerHTML).toEqual(dcTitle);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@@ -42,6 +42,7 @@ export class ItemSearchResultGridElementComponent extends SearchResultGridElemen
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.itemPageRoute = getItemPageRoute(this.dso);
|
||||
this.dsoTitle = this.dsoNameService.getName(this.dso);
|
||||
this.dsoTitle = this.firstMetadataValue('dc.title') ??
|
||||
(this.dso ? this.dsoNameService.getName(this.dso) : undefined);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user