mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
Merge remote-tracking branch 'upstream/main' into retrieve-name-with-dsonameservice-7.4
# Conflicts: # src/app/access-control/epeople-registry/epeople-registry.component.html # src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts # src/app/access-control/group-registry/group-form/group-form.component.spec.ts # src/app/access-control/group-registry/group-form/group-form.component.ts # src/app/access-control/group-registry/group-form/members-list/members-list.component.html # src/app/access-control/group-registry/group-form/members-list/members-list.component.ts # src/app/collection-page/edit-item-template-page/edit-item-template-page.component.html # src/app/item-page/full/field-components/file-section/full-file-section.component.ts # src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts # src/app/item-page/simple/field-components/file-section/file-section.component.html # src/app/item-page/simple/field-components/file-section/file-section.component.ts # src/app/item-page/versions/item-versions.component.ts # src/app/shared/auth-nav-menu/user-menu/user-menu.component.html # src/app/shared/auth-nav-menu/user-menu/user-menu.component.ts # src/app/shared/object-collection/shared/mydspace-item-submitter/item-submitter.component.html
This commit is contained in:
@@ -28,13 +28,19 @@ 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(), {
|
||||
hitHighlights: {
|
||||
'dc.title': [{
|
||||
value: dcTitle
|
||||
}],
|
||||
},
|
||||
bundles: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])),
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is just another title'
|
||||
value: dcTitle
|
||||
}
|
||||
],
|
||||
'dc.contributor.author': [
|
||||
@@ -57,6 +63,114 @@ mockItemWithMetadata.indexableObject = Object.assign(new Item(), {
|
||||
]
|
||||
}
|
||||
});
|
||||
const mockPerson: ItemSearchResult = Object.assign(new ItemSearchResult(), {
|
||||
hitHighlights: {
|
||||
'person.familyName': [{
|
||||
value: '<em>Michel</em>'
|
||||
}],
|
||||
},
|
||||
indexableObject:
|
||||
Object.assign(new Item(), {
|
||||
bundles: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])),
|
||||
entityType: 'Person',
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is just another title'
|
||||
}
|
||||
],
|
||||
'dc.contributor.author': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Smith, Donald'
|
||||
}
|
||||
],
|
||||
'dc.publisher': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'a publisher'
|
||||
}
|
||||
],
|
||||
'dc.date.issued': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: '2015-06-26'
|
||||
}
|
||||
],
|
||||
'dc.description.abstract': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is the abstract'
|
||||
}
|
||||
],
|
||||
'dspace.entity.type': [
|
||||
{
|
||||
value: 'Person'
|
||||
}
|
||||
],
|
||||
'person.familyName': [
|
||||
{
|
||||
value: 'Michel'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
});
|
||||
const mockOrgUnit: ItemSearchResult = Object.assign(new ItemSearchResult(), {
|
||||
hitHighlights: {
|
||||
'organization.legalName': [{
|
||||
value: '<em>Science</em>'
|
||||
}],
|
||||
},
|
||||
indexableObject:
|
||||
Object.assign(new Item(), {
|
||||
bundles: createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [])),
|
||||
entityType: 'OrgUnit',
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is just another title'
|
||||
}
|
||||
],
|
||||
'dc.contributor.author': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Smith, Donald'
|
||||
}
|
||||
],
|
||||
'dc.publisher': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'a publisher'
|
||||
}
|
||||
],
|
||||
'dc.date.issued': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: '2015-06-26'
|
||||
}
|
||||
],
|
||||
'dc.description.abstract': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is the abstract'
|
||||
}
|
||||
],
|
||||
'organization.legalName': [
|
||||
{
|
||||
value: 'Science'
|
||||
}
|
||||
],
|
||||
'dspace.entity.type': [
|
||||
{
|
||||
value: 'OrgUnit'
|
||||
}
|
||||
]
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const mockItemWithoutMetadata: ItemSearchResult = new ItemSearchResult();
|
||||
mockItemWithoutMetadata.hitHighlights = {};
|
||||
@@ -154,6 +268,41 @@ 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);
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item is Person and has title', () => {
|
||||
beforeEach(() => {
|
||||
comp.object = mockPerson;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show highlighted title', () => {
|
||||
const titleField = fixture.debugElement.query(By.css('.card-title'));
|
||||
expect(titleField.nativeNode.innerHTML).toEqual('<em>Michel</em>');
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item is orgUnit and has title', () => {
|
||||
beforeEach(() => {
|
||||
comp.object = mockOrgUnit;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show highlighted title', () => {
|
||||
const titleField = fixture.debugElement.query(By.css('.card-title'));
|
||||
expect(titleField.nativeNode.innerHTML).toEqual('<em>Science</em>');
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@@ -42,6 +42,6 @@ export class ItemSearchResultGridElementComponent extends SearchResultGridElemen
|
||||
ngOnInit(): void {
|
||||
super.ngOnInit();
|
||||
this.itemPageRoute = getItemPageRoute(this.dso);
|
||||
this.dsoTitle = this.dsoNameService.getName(this.dso);
|
||||
this.dsoTitle = this.dsoNameService.getHitHighlights(this.object, this.dso);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user