mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 18:14:17 +00:00
renaming fixes, new tests
This commit is contained in:
@@ -0,0 +1 @@
|
|||||||
|
<ds-org-unit-search-result-grid-element [object]="{ indexableObject: object, hitHighlights: {} }" [linkType]="linkType"></ds-org-unit-search-result-grid-element>
|
@@ -1,6 +1,6 @@
|
|||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { of as observableOf } from 'rxjs/internal/observable/of';
|
import { of as observableOf } from 'rxjs/internal/observable/of';
|
||||||
import { OrgunitGridElementComponent } from './orgunit-grid-element.component';
|
import { OrgUnitGridElementComponent } from './org-unit-grid-element.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
@@ -41,7 +41,7 @@ const mockItem = Object.assign(new Item(), {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OrgunitGridElementComponent', () => {
|
describe('OrgUnitGridElementComponent', () => {
|
||||||
let comp;
|
let comp;
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
@@ -52,18 +52,18 @@ describe('OrgunitGridElementComponent', () => {
|
|||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [NoopAnimationsModule],
|
imports: [NoopAnimationsModule],
|
||||||
declarations: [OrgunitGridElementComponent, TruncatePipe],
|
declarations: [OrgUnitGridElementComponent, TruncatePipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
{ provide: TruncatableService, useValue: truncatableServiceStub },
|
||||||
],
|
],
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
}).overrideComponent(OrgunitGridElementComponent, {
|
}).overrideComponent(OrgUnitGridElementComponent, {
|
||||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
fixture = TestBed.createComponent(OrgunitGridElementComponent);
|
fixture = TestBed.createComponent(OrgUnitGridElementComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -73,9 +73,9 @@ describe('OrgunitGridElementComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should contain a OrgunitGridElementComponent`, () => {
|
it(`should contain a OrgUnitGridElementComponent`, () => {
|
||||||
const orgunitGridElement = fixture.debugElement.query(By.css(`ds-orgunit-search-result-grid-element`));
|
const orgUnitGridElement = fixture.debugElement.query(By.css(`ds-org-unit-search-result-grid-element`));
|
||||||
expect(orgunitGridElement).not.toBeNull();
|
expect(orgUnitGridElement).not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@@ -6,12 +6,12 @@ import { Item } from '../../../../core/shared/item.model';
|
|||||||
|
|
||||||
@listableObjectComponent('OrgUnit', ViewMode.GridElement)
|
@listableObjectComponent('OrgUnit', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit-grid-element',
|
selector: 'ds-org-unit-grid-element',
|
||||||
styleUrls: ['./orgunit-grid-element.component.scss'],
|
styleUrls: ['./org-unit-grid-element.component.scss'],
|
||||||
templateUrl: './orgunit-grid-element.component.html',
|
templateUrl: './org-unit-grid-element.component.html',
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The component for displaying a grid element for an item of the type Organisation Unit
|
* The component for displaying a grid element for an item of the type Organisation Unit
|
||||||
*/
|
*/
|
||||||
export class OrgunitGridElementComponent extends AbstractListableElementComponent<Item> {
|
export class OrgUnitGridElementComponent extends AbstractListableElementComponent<Item> {
|
||||||
}
|
}
|
@@ -1 +0,0 @@
|
|||||||
<ds-orgunit-search-result-grid-element [object]="{ indexableObject: object, hitHighlights: {} }" [linkType]="linkType"></ds-orgunit-search-result-grid-element>
|
|
@@ -3,7 +3,7 @@ import { Item } from '../../../../../core/shared/item.model';
|
|||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/testing/utils';
|
||||||
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../../core/shared/page-info.model';
|
||||||
import { OrgunitSearchResultGridElementComponent } from './orgunit-search-result-grid-element.component';
|
import { OrgUnitSearchResultGridElementComponent } from './org-unit-search-result-grid-element.component';
|
||||||
import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec';
|
import { getEntityGridElementTestComponent } from '../../../../../shared/object-grid/search-result-grid-element/item-search-result/publication/publication-search-result-grid-element.component.spec';
|
||||||
|
|
||||||
const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult();
|
const mockItemWithMetadata: ItemSearchResult = new ItemSearchResult();
|
||||||
@@ -52,4 +52,4 @@ mockItemWithoutMetadata.indexableObject = Object.assign(new Item(), {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OrgunitSearchResultGridElementComponent', getEntityGridElementTestComponent(OrgunitSearchResultGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['date', 'country', 'city']));
|
describe('OrgUnitSearchResultGridElementComponent', getEntityGridElementTestComponent(OrgUnitSearchResultGridElementComponent, mockItemWithMetadata, mockItemWithoutMetadata, ['date', 'country', 'city']));
|
@@ -8,13 +8,13 @@ import { Item } from '../../../../../core/shared/item.model';
|
|||||||
|
|
||||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.GridElement)
|
@listableObjectComponent('OrgUnitSearchResult', ViewMode.GridElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit-search-result-grid-element',
|
selector: 'ds-org-unit-search-result-grid-element',
|
||||||
styleUrls: ['./orgunit-search-result-grid-element.component.scss'],
|
styleUrls: ['./org-unit-search-result-grid-element.component.scss'],
|
||||||
templateUrl: './orgunit-search-result-grid-element.component.html',
|
templateUrl: './org-unit-search-result-grid-element.component.html',
|
||||||
animations: [focusShadow]
|
animations: [focusShadow]
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The component for displaying a grid element for an item search result of the type Organisation Unit
|
* The component for displaying a grid element for an item search result of the type Organisation Unit
|
||||||
*/
|
*/
|
||||||
export class OrgunitSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> {
|
export class OrgUnitSearchResultGridElementComponent extends SearchResultGridElementComponent<ItemSearchResult, Item> {
|
||||||
}
|
}
|
@@ -0,0 +1 @@
|
|||||||
|
<ds-org-unit-search-result-list-element [object]="{ indexableObject: object, hitHighlights: {} }" [linkType]="linkType"></ds-org-unit-search-result-list-element>
|
@@ -1,7 +1,7 @@
|
|||||||
import { async, TestBed } from '@angular/core/testing';
|
import { async, TestBed } from '@angular/core/testing';
|
||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { OrgUnitListElementComponent } from './orgunit-list-element.component';
|
import { OrgUnitListElementComponent } from './org-unit-list-element.component';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
|
||||||
@@ -25,7 +25,7 @@ const mockItem: Item = Object.assign(new Item(), {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OrgunitListElementComponent', () => {
|
describe('OrgUnitListElementComponent', () => {
|
||||||
let comp;
|
let comp;
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
@@ -50,15 +50,15 @@ describe('OrgunitListElementComponent', () => {
|
|||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe(`when the orgunit is rendered`, () => {
|
describe(`when the org unit is rendered`, () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
comp.object = mockItem;
|
comp.object = mockItem;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should contain a OrgUnitListElementComponent`, () => {
|
it(`should contain a OrgUnitListElementComponent`, () => {
|
||||||
const orgunitListElement = fixture.debugElement.query(By.css(`ds-orgunit-search-result-list-element`));
|
const orgUnitListElement = fixture.debugElement.query(By.css(`ds-org-unit-search-result-list-element`));
|
||||||
expect(orgunitListElement).not.toBeNull();
|
expect(orgUnitListElement).not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@@ -6,9 +6,9 @@ import { Item } from '../../../../core/shared/item.model';
|
|||||||
|
|
||||||
@listableObjectComponent('OrgUnit', ViewMode.ListElement)
|
@listableObjectComponent('OrgUnit', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit-list-element',
|
selector: 'ds-org-unit-list-element',
|
||||||
styleUrls: ['./orgunit-list-element.component.scss'],
|
styleUrls: ['./org-unit-list-element.component.scss'],
|
||||||
templateUrl: './orgunit-list-element.component.html'
|
templateUrl: './org-unit-list-element.component.html'
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The component for displaying a list element for an item of the type Organisation Unit
|
* The component for displaying a list element for an item of the type Organisation Unit
|
@@ -1 +0,0 @@
|
|||||||
<ds-orgunit-search-result-list-element [object]="{ indexableObject: object, hitHighlights: {} }" [linkType]="linkType"></ds-orgunit-search-result-list-element>
|
|
@@ -2,14 +2,14 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { OrgunitSearchResultListElementComponent } from './orgunit-search-result-list-element.component';
|
import { OrgUnitSearchResultListElementComponent } from './org-unit-search-result-list-element.component';
|
||||||
import { Item } from '../../../../../core/shared/item.model';
|
import { Item } from '../../../../../core/shared/item.model';
|
||||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||||
|
|
||||||
let orgUnitListElementComponent: OrgunitSearchResultListElementComponent;
|
let orgUnitListElementComponent: OrgUnitSearchResultListElementComponent;
|
||||||
let fixture: ComponentFixture<OrgunitSearchResultListElementComponent>;
|
let fixture: ComponentFixture<OrgUnitSearchResultListElementComponent>;
|
||||||
|
|
||||||
const mockItemWithMetadata: ItemSearchResult = Object.assign(
|
const mockItemWithMetadata: ItemSearchResult = Object.assign(
|
||||||
new ItemSearchResult(),
|
new ItemSearchResult(),
|
||||||
@@ -51,44 +51,44 @@ const mockItemWithoutMetadata: ItemSearchResult = Object.assign(
|
|||||||
describe('OrgUnitSearchResultListElementComponent', () => {
|
describe('OrgUnitSearchResultListElementComponent', () => {
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
declarations: [ OrgunitSearchResultListElementComponent , TruncatePipe],
|
declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TruncatableService, useValue: {} }
|
{ provide: TruncatableService, useValue: {} }
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
}).overrideComponent(OrgunitSearchResultListElementComponent, {
|
}).overrideComponent(OrgUnitSearchResultListElementComponent, {
|
||||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||||
}).compileComponents();
|
}).compileComponents();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
fixture = TestBed.createComponent(OrgunitSearchResultListElementComponent);
|
fixture = TestBed.createComponent(OrgUnitSearchResultListElementComponent);
|
||||||
orgUnitListElementComponent = fixture.componentInstance;
|
orgUnitListElementComponent = fixture.componentInstance;
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('When the item has an orgunit description', () => {
|
describe('When the item has an org unit description', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
orgUnitListElementComponent.object = mockItemWithMetadata;
|
orgUnitListElementComponent.object = mockItemWithMetadata;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show the description span', () => {
|
it('should show the description span', () => {
|
||||||
const orgunitDescriptionField = fixture.debugElement.query(By.css('span.item-list-orgunit-description'));
|
const orgUnitDescriptionField = fixture.debugElement.query(By.css('span.item-list-org-unit-description'));
|
||||||
expect(orgunitDescriptionField).not.toBeNull();
|
expect(orgUnitDescriptionField).not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('When the item has no orgunit description', () => {
|
describe('When the item has no org unit description', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
orgUnitListElementComponent.object = mockItemWithoutMetadata;
|
orgUnitListElementComponent.object = mockItemWithoutMetadata;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not show the description span', () => {
|
it('should not show the description span', () => {
|
||||||
const orgunitDescriptionField = fixture.debugElement.query(By.css('span.item-list-orgunit-description'));
|
const orgUnitDescriptionField = fixture.debugElement.query(By.css('span.item-list-org-unit-description'));
|
||||||
expect(orgunitDescriptionField).toBeNull();
|
expect(orgUnitDescriptionField).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@@ -7,12 +7,12 @@ import { Item } from '../../../../../core/shared/item.model';
|
|||||||
|
|
||||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement)
|
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit-search-result-list-element',
|
selector: 'ds-org-unit-search-result-list-element',
|
||||||
styleUrls: ['./orgunit-search-result-list-element.component.scss'],
|
styleUrls: ['./org-unit-search-result-list-element.component.scss'],
|
||||||
templateUrl: './orgunit-search-result-list-element.component.html'
|
templateUrl: './org-unit-search-result-list-element.component.html'
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The component for displaying a list element for an item search result of the type Organisation Unit
|
* The component for displaying a list element for an item search result of the type Organisation Unit
|
||||||
*/
|
*/
|
||||||
export class OrgunitSearchResultListElementComponent extends SearchResultListElementComponent<ItemSearchResult, Item> {
|
export class OrgUnitSearchResultListElementComponent extends SearchResultListElementComponent<ItemSearchResult, Item> {
|
||||||
}
|
}
|
@@ -2,7 +2,7 @@ import { Item } from '../../../../core/shared/item.model';
|
|||||||
import { RemoteData } from '../../../../core/data/remote-data';
|
import { RemoteData } from '../../../../core/data/remote-data';
|
||||||
import { PaginatedList } from '../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../core/data/paginated-list';
|
||||||
import { PageInfo } from '../../../../core/shared/page-info.model';
|
import { PageInfo } from '../../../../core/shared/page-info.model';
|
||||||
import { OrgunitComponent } from './orgunit.component';
|
import { OrgUnitComponent } from './org-unit.component';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import {
|
import {
|
||||||
createRelationshipsObservable,
|
createRelationshipsObservable,
|
||||||
@@ -47,4 +47,4 @@ const mockItem: Item = Object.assign(new Item(), {
|
|||||||
relationships: createRelationshipsObservable()
|
relationships: createRelationshipsObservable()
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OrgUnitComponent', getItemPageFieldsTest(mockItem, OrgunitComponent));
|
describe('OrgUnitComponent', getItemPageFieldsTest(mockItem, OrgUnitComponent));
|
@@ -9,14 +9,14 @@ import { listableObjectComponent } from '../../../../shared/object-collection/sh
|
|||||||
|
|
||||||
@listableObjectComponent('OrgUnit', ViewMode.StandalonePage)
|
@listableObjectComponent('OrgUnit', ViewMode.StandalonePage)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit',
|
selector: 'ds-org-unit',
|
||||||
styleUrls: ['./orgunit.component.scss'],
|
styleUrls: ['./org-unit.component.scss'],
|
||||||
templateUrl: './orgunit.component.html'
|
templateUrl: './org-unit.component.html'
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The component for displaying metadata and relations of an item of the type Organisation Unit
|
* The component for displaying metadata and relations of an item of the type Organisation Unit
|
||||||
*/
|
*/
|
||||||
export class OrgunitComponent extends ItemComponent implements OnInit {
|
export class OrgUnitComponent extends ItemComponent implements OnInit {
|
||||||
/**
|
/**
|
||||||
* The people related to this organisation unit
|
* The people related to this organisation unit
|
||||||
*/
|
*/
|
@@ -0,0 +1,47 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
|
||||||
|
import { OrgUnitItemMetadataListElementComponent } from './org-unit-item-metadata-list-element.component';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { TooltipModule } from 'ngx-bootstrap';
|
||||||
|
|
||||||
|
const description = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.';
|
||||||
|
const organisation = 'Anonymous';
|
||||||
|
const mockItem = Object.assign(new Item(), { metadata: { 'dc.description': [{ value: description }], 'organization.legalName': [{ value: organisation }] } });
|
||||||
|
const mockItemMetadataRepresentation = Object.assign(new ItemMetadataRepresentation(), mockItem);
|
||||||
|
|
||||||
|
describe('OrgUnitItemMetadataListElementComponent', () => {
|
||||||
|
let comp: OrgUnitItemMetadataListElementComponent;
|
||||||
|
let fixture: ComponentFixture<OrgUnitItemMetadataListElementComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [TooltipModule.forRoot()],
|
||||||
|
declarations: [OrgUnitItemMetadataListElementComponent],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(OrgUnitItemMetadataListElementComponent, {
|
||||||
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
fixture = TestBed.createComponent(OrgUnitItemMetadataListElementComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
comp.metadataRepresentation = mockItemMetadataRepresentation;
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should show the name of the organisation as a link', () => {
|
||||||
|
const linkText = fixture.debugElement.query(By.css('a')).nativeElement.textContent;
|
||||||
|
expect(linkText).toBe(organisation);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the description on hover over the link in a tooltip', () => {
|
||||||
|
const link = fixture.debugElement.query(By.css('a'));
|
||||||
|
link.triggerEventHandler('mouseover', null);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const tooltip = fixture.debugElement.query(By.css('.item-list-job-title')).nativeElement.textContent;
|
||||||
|
expect(tooltip).toBe(description);
|
||||||
|
});
|
||||||
|
});
|
@@ -5,12 +5,12 @@ import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-rep
|
|||||||
|
|
||||||
@metadataRepresentationComponent('OrgUnit', MetadataRepresentationType.Item)
|
@metadataRepresentationComponent('OrgUnit', MetadataRepresentationType.Item)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-orgunit-item-page-list-element',
|
selector: 'ds-org-unit-item-metadata-list-element',
|
||||||
templateUrl: './orgunit-item-page-list-element.component.html'
|
templateUrl: './org-unit-item-metadata-list-element.component.html'
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The component for displaying an item of the type OrgUnit as a metadata field
|
* The component for displaying an item of the type OrgUnit as a metadata field
|
||||||
*/
|
*/
|
||||||
export class OrgunitItemPageListElementComponent {
|
export class OrgUnitItemMetadataListElementComponent {
|
||||||
metadataRepresentation: ItemMetadataRepresentation;
|
metadataRepresentation: ItemMetadataRepresentation;
|
||||||
}
|
}
|
@@ -0,0 +1,48 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { By } from '@angular/platform-browser';
|
||||||
|
import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
|
||||||
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
|
import { PersonItemMetadataListElementComponent } from './person-item-metadata-list-element.component';
|
||||||
|
import { TooltipModule } from 'ngx-bootstrap';
|
||||||
|
|
||||||
|
const jobTitle ='Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.';
|
||||||
|
const firstName = 'Joe';
|
||||||
|
const lastName = 'Anonymous';
|
||||||
|
const mockItem = Object.assign(new Item(), { metadata: { 'person.jobTitle': [{ value: jobTitle }], 'person.givenName': [{ value: firstName }], 'person.familyName': [{ value: lastName }] } });
|
||||||
|
const mockItemMetadataRepresentation = Object.assign(new ItemMetadataRepresentation(), mockItem);
|
||||||
|
|
||||||
|
describe('PersonItemMetadataListElementComponent', () => {
|
||||||
|
let comp: PersonItemMetadataListElementComponent;
|
||||||
|
let fixture: ComponentFixture<PersonItemMetadataListElementComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [TooltipModule.forRoot()],
|
||||||
|
declarations: [PersonItemMetadataListElementComponent],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
}).overrideComponent(PersonItemMetadataListElementComponent, {
|
||||||
|
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
fixture = TestBed.createComponent(PersonItemMetadataListElementComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
comp.metadataRepresentation = mockItemMetadataRepresentation;
|
||||||
|
fixture.detectChanges();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should show the person\'s name as a link', () => {
|
||||||
|
const linkText = fixture.debugElement.query(By.css('a')).nativeElement.textContent;
|
||||||
|
expect(linkText).toBe(lastName + ', ' + firstName);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should show the description on hover over the link in a tooltip', () => {
|
||||||
|
const link = fixture.debugElement.query(By.css('a'));
|
||||||
|
link.triggerEventHandler('mouseover', null);
|
||||||
|
fixture.detectChanges();
|
||||||
|
const tooltip = fixture.debugElement.query(By.css('.item-list-job-title')).nativeElement.textContent;
|
||||||
|
expect(tooltip).toBe(jobTitle);
|
||||||
|
});
|
||||||
|
});
|
@@ -1,19 +1,16 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { AbstractListableElementComponent } from '../../../../shared/object-collection/shared/object-collection-element/abstract-listable-element.component';
|
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
|
||||||
import { metadataRepresentationComponent } from '../../../../shared/metadata-representation/metadata-representation.decorator';
|
import { metadataRepresentationComponent } from '../../../../shared/metadata-representation/metadata-representation.decorator';
|
||||||
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
import { MetadataRepresentationType } from '../../../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
import { MetadataRepresentationListElementComponent } from '../../../../shared/object-list/metadata-representation-list-element/metadata-representation-list-element.component';
|
|
||||||
import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
|
import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
|
||||||
|
|
||||||
@metadataRepresentationComponent('Person', MetadataRepresentationType.Item)
|
@metadataRepresentationComponent('Person', MetadataRepresentationType.Item)
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-person-item-page-list-element',
|
selector: 'ds-person-item-metadata-list-element',
|
||||||
templateUrl: './person-item-page-list-element.component.html'
|
templateUrl: './person-item-metadata-list-element.component.html'
|
||||||
})
|
})
|
||||||
/**
|
/**
|
||||||
* The component for displaying an item of the type Person as a metadata field
|
* The component for displaying an item of the type Person as a metadata field
|
||||||
*/
|
*/
|
||||||
export class PersonItemPageListElementComponent {
|
export class PersonItemMetadataListElementComponent {
|
||||||
metadataRepresentation: ItemMetadataRepresentation;
|
metadataRepresentation: ItemMetadataRepresentation;
|
||||||
}
|
}
|
@@ -2,42 +2,42 @@ import { NgModule } from '@angular/core';
|
|||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { SharedModule } from '../../shared/shared.module';
|
import { SharedModule } from '../../shared/shared.module';
|
||||||
import { ItemPageModule } from '../../+item-page/item-page.module';
|
import { ItemPageModule } from '../../+item-page/item-page.module';
|
||||||
import { OrgunitComponent } from './item-pages/orgunit/orgunit.component';
|
import { OrgUnitComponent } from './item-pages/org-unit/org-unit.component';
|
||||||
import { PersonComponent } from './item-pages/person/person.component';
|
import { PersonComponent } from './item-pages/person/person.component';
|
||||||
import { ProjectComponent } from './item-pages/project/project.component';
|
import { ProjectComponent } from './item-pages/project/project.component';
|
||||||
import { OrgUnitListElementComponent } from './item-list-elements/orgunit/orgunit-list-element.component';
|
import { OrgUnitListElementComponent } from './item-list-elements/org-unit/org-unit-list-element.component';
|
||||||
import { OrgunitItemPageListElementComponent } from './item-list-elements/orgunit/orgunit-item-page-list-element.component';
|
|
||||||
import { PersonItemPageListElementComponent } from './item-list-elements/person/person-item-page-list-element.component';
|
|
||||||
import { PersonListElementComponent } from './item-list-elements/person/person-list-element.component';
|
import { PersonListElementComponent } from './item-list-elements/person/person-list-element.component';
|
||||||
import { ProjectListElementComponent } from './item-list-elements/project/project-list-element.component';
|
import { ProjectListElementComponent } from './item-list-elements/project/project-list-element.component';
|
||||||
import { TooltipModule } from 'ngx-bootstrap';
|
import { TooltipModule } from 'ngx-bootstrap';
|
||||||
import { PersonGridElementComponent } from './item-grid-elements/person/person-grid-element.component';
|
import { PersonGridElementComponent } from './item-grid-elements/person/person-grid-element.component';
|
||||||
import { OrgunitGridElementComponent } from './item-grid-elements/orgunit/orgunit-grid-element.component';
|
import { OrgUnitGridElementComponent } from './item-grid-elements/org-unit/org-unit-grid-element.component';
|
||||||
import { ProjectGridElementComponent } from './item-grid-elements/project/project-grid-element.component';
|
import { ProjectGridElementComponent } from './item-grid-elements/project/project-grid-element.component';
|
||||||
import { OrgunitSearchResultListElementComponent } from './item-list-elements/search-result-list-elements/orgunit/orgunit-search-result-list-element.component';
|
import { OrgUnitSearchResultListElementComponent } from './item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component';
|
||||||
import { PersonSearchResultListElementComponent } from './item-list-elements/search-result-list-elements/person/person-search-result-list-element.component';
|
import { PersonSearchResultListElementComponent } from './item-list-elements/search-result-list-elements/person/person-search-result-list-element.component';
|
||||||
import { ProjectSearchResultListElementComponent } from './item-list-elements/search-result-list-elements/project/project-search-result-list-element.component';
|
import { ProjectSearchResultListElementComponent } from './item-list-elements/search-result-list-elements/project/project-search-result-list-element.component';
|
||||||
import { PersonSearchResultGridElementComponent } from './item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component';
|
import { PersonSearchResultGridElementComponent } from './item-grid-elements/search-result-grid-elements/person/person-search-result-grid-element.component';
|
||||||
import { OrgunitSearchResultGridElementComponent } from './item-grid-elements/search-result-grid-elements/orgunit/orgunit-search-result-grid-element.component';
|
import { OrgUnitSearchResultGridElementComponent } from './item-grid-elements/search-result-grid-elements/org-unit/org-unit-search-result-grid-element.component';
|
||||||
import { ProjectSearchResultGridElementComponent } from './item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component';
|
import { ProjectSearchResultGridElementComponent } from './item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component';
|
||||||
|
import { PersonItemMetadataListElementComponent } from './metadata-representations/person/person-item-metadata-list-element.component';
|
||||||
|
import { OrgUnitItemMetadataListElementComponent } from './metadata-representations/org-unit/org-unit-item-metadata-list-element.component';
|
||||||
|
|
||||||
const ENTRY_COMPONENTS = [
|
const ENTRY_COMPONENTS = [
|
||||||
OrgunitComponent,
|
OrgUnitComponent,
|
||||||
PersonComponent,
|
PersonComponent,
|
||||||
ProjectComponent,
|
ProjectComponent,
|
||||||
OrgUnitListElementComponent,
|
OrgUnitListElementComponent,
|
||||||
OrgunitItemPageListElementComponent,
|
OrgUnitItemMetadataListElementComponent,
|
||||||
PersonListElementComponent,
|
PersonListElementComponent,
|
||||||
PersonItemPageListElementComponent,
|
PersonItemMetadataListElementComponent,
|
||||||
ProjectListElementComponent,
|
ProjectListElementComponent,
|
||||||
PersonGridElementComponent,
|
PersonGridElementComponent,
|
||||||
OrgunitGridElementComponent,
|
OrgUnitGridElementComponent,
|
||||||
ProjectGridElementComponent,
|
ProjectGridElementComponent,
|
||||||
OrgunitSearchResultListElementComponent,
|
OrgUnitSearchResultListElementComponent,
|
||||||
PersonSearchResultListElementComponent,
|
PersonSearchResultListElementComponent,
|
||||||
ProjectSearchResultListElementComponent,
|
ProjectSearchResultListElementComponent,
|
||||||
PersonSearchResultGridElementComponent,
|
PersonSearchResultGridElementComponent,
|
||||||
OrgunitSearchResultGridElementComponent,
|
OrgUnitSearchResultGridElementComponent,
|
||||||
ProjectSearchResultGridElementComponent
|
ProjectSearchResultGridElementComponent
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@@ -0,0 +1,63 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { ChangeDetectionStrategy, ComponentFactoryResolver, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { Context } from '../../core/shared/context.model';
|
||||||
|
import { MetadataRepresentation, MetadataRepresentationType } from '../../core/shared/metadata-representation/metadata-representation.model';
|
||||||
|
import { MetadataRepresentationLoaderComponent } from './metadata-representation-loader.component';
|
||||||
|
import { PlainTextMetadataListElementComponent } from '../object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component';
|
||||||
|
import { spyOnExported } from '../testing/utils';
|
||||||
|
import { MetadataRepresentationDirective } from './metadata-representation.directive';
|
||||||
|
import * as metadataRepresentationDecorator from './metadata-representation.decorator';
|
||||||
|
|
||||||
|
const testType = 'TestType';
|
||||||
|
const testContext = Context.Search;
|
||||||
|
const testRepresentationType = MetadataRepresentationType.Item;
|
||||||
|
|
||||||
|
class TestType implements MetadataRepresentation {
|
||||||
|
get itemType(): string {
|
||||||
|
return testType;
|
||||||
|
}
|
||||||
|
|
||||||
|
get representationType(): MetadataRepresentationType {
|
||||||
|
return testRepresentationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
getValue(): string {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
describe('MetadataRepresentationLoaderComponent', () => {
|
||||||
|
let comp: MetadataRepresentationLoaderComponent;
|
||||||
|
let fixture: ComponentFixture<MetadataRepresentationLoaderComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [],
|
||||||
|
declarations: [MetadataRepresentationLoaderComponent, PlainTextMetadataListElementComponent, MetadataRepresentationDirective],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
providers: [ComponentFactoryResolver]
|
||||||
|
}).overrideComponent(MetadataRepresentationLoaderComponent, {
|
||||||
|
set: {
|
||||||
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
|
entryComponents: [PlainTextMetadataListElementComponent]
|
||||||
|
}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
fixture = TestBed.createComponent(MetadataRepresentationLoaderComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
|
||||||
|
comp.mdRepresentation = new TestType();
|
||||||
|
comp.context = testContext;
|
||||||
|
|
||||||
|
spyOnExported(metadataRepresentationDecorator, 'getMetadataRepresentationComponent').and.returnValue(PlainTextMetadataListElementComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('When the component is rendered', () => {
|
||||||
|
it('should call the getMetadataRepresentationComponent function with the right entity type, representation type and context', () => {
|
||||||
|
expect(metadataRepresentationDecorator.getMetadataRepresentationComponent).toHaveBeenCalledWith(testType, testRepresentationType, testContext);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
@@ -8,7 +8,6 @@ export const DEFAULT_ENTITY_TYPE = 'Publication';
|
|||||||
export const DEFAULT_REPRESENTATION_TYPE = MetadataRepresentationType.PlainText;
|
export const DEFAULT_REPRESENTATION_TYPE = MetadataRepresentationType.PlainText;
|
||||||
export const DEFAULT_CONTEXT = Context.Undefined;
|
export const DEFAULT_CONTEXT = Context.Undefined;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorator function to store metadata representation mapping
|
* Decorator function to store metadata representation mapping
|
||||||
* @param entityType The entity type the component represents
|
* @param entityType The entity type the component represents
|
||||||
|
@@ -15,7 +15,7 @@ import { MyDSpaceActionsComponent } from '../mydspace-actions';
|
|||||||
import { NotificationsService } from '../../notifications/notifications.service';
|
import { NotificationsService } from '../../notifications/notifications.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component represents mydspace actions related to ClaimedTask object.
|
* This component represents actions related to ClaimedTask object.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-claimed-task-actions',
|
selector: 'ds-claimed-task-actions',
|
||||||
|
@@ -9,7 +9,7 @@ import { WorkflowItemDataService } from '../../../core/submission/workflowitem-d
|
|||||||
import { NotificationsService } from '../../notifications/notifications.service';
|
import { NotificationsService } from '../../notifications/notifications.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component represents mydspace actions related to WorkflowItem object.
|
* This component represents actions related to WorkflowItem object.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-workflowitem-actions',
|
selector: 'ds-workflowitem-actions',
|
||||||
|
@@ -8,11 +8,10 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { WorkspaceItem } from '../../../core/submission/models/workspaceitem.model';
|
import { WorkspaceItem } from '../../../core/submission/models/workspaceitem.model';
|
||||||
import { MyDSpaceActionsComponent } from '../mydspace-actions';
|
import { MyDSpaceActionsComponent } from '../mydspace-actions';
|
||||||
import { WorkspaceitemDataService } from '../../../core/submission/workspaceitem-data.service';
|
import { WorkspaceitemDataService } from '../../../core/submission/workspaceitem-data.service';
|
||||||
import { ResourceType } from '../../../core/shared/resource-type';
|
|
||||||
import { NotificationsService } from '../../notifications/notifications.service';
|
import { NotificationsService } from '../../notifications/notifications.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component represents mydspace actions related to WorkspaceItem object.
|
* This component represents actions related to WorkspaceItem object.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-workspaceitem-actions',
|
selector: 'ds-workspaceitem-actions',
|
||||||
|
@@ -0,0 +1,58 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
import { ChangeDetectionStrategy, ComponentFactoryResolver, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
|
import { ListableObjectComponentLoaderComponent } from './listable-object-component-loader.component';
|
||||||
|
import { ListableObject } from '../listable-object.model';
|
||||||
|
import { GenericConstructor } from '../../../../core/shared/generic-constructor';
|
||||||
|
import { Context } from '../../../../core/shared/context.model';
|
||||||
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
|
import * as listableObjectDecorators from './listable-object.decorator';
|
||||||
|
import { PublicationListElementComponent } from '../../../object-list/item-list-element/item-types/publication/publication-list-element.component';
|
||||||
|
import { ListableObjectDirective } from './listable-object.directive';
|
||||||
|
import { spyOnExported } from '../../../testing/utils';
|
||||||
|
|
||||||
|
const testType = 'TestType';
|
||||||
|
const testContext = Context.Search;
|
||||||
|
const testViewMode = ViewMode.StandalonePage;
|
||||||
|
|
||||||
|
class TestType implements ListableObject {
|
||||||
|
getRenderTypes(): Array<string | GenericConstructor<ListableObject>> {
|
||||||
|
return [testType];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe('ListableObjectComponentLoaderComponent', () => {
|
||||||
|
let comp: ListableObjectComponentLoaderComponent;
|
||||||
|
let fixture: ComponentFixture<ListableObjectComponentLoaderComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
imports: [],
|
||||||
|
declarations: [ListableObjectComponentLoaderComponent, PublicationListElementComponent, ListableObjectDirective],
|
||||||
|
schemas: [NO_ERRORS_SCHEMA],
|
||||||
|
providers: [ComponentFactoryResolver]
|
||||||
|
}).overrideComponent(ListableObjectComponentLoaderComponent, {
|
||||||
|
set: {
|
||||||
|
changeDetection: ChangeDetectionStrategy.Default,
|
||||||
|
entryComponents: [PublicationListElementComponent]
|
||||||
|
}
|
||||||
|
}).compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
fixture = TestBed.createComponent(ListableObjectComponentLoaderComponent);
|
||||||
|
comp = fixture.componentInstance;
|
||||||
|
|
||||||
|
comp.object = new TestType();
|
||||||
|
comp.viewMode = testViewMode;
|
||||||
|
comp.context = testContext;
|
||||||
|
spyOnExported(listableObjectDecorators, 'getListableObjectComponent').and.returnValue(PublicationListElementComponent);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe('When the component is rendered', () => {
|
||||||
|
it('should call the getListableObjectComponent function with the right types, view mode and context', () => {
|
||||||
|
expect(listableObjectDecorators.getListableObjectComponent).toHaveBeenCalledWith([testType], testViewMode, testContext);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
});
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, Inject } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
@@ -12,7 +12,6 @@ import { SearchResultDetailElementComponent } from '../search-result-detail-elem
|
|||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { ClaimedTaskSearchResult } from '../../../object-collection/shared/claimed-task-search-result.model';
|
import { ClaimedTaskSearchResult } from '../../../object-collection/shared/claimed-task-search-result.model';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders claimed task object for the search result in the detail view.
|
* This component renders claimed task object for the search result in the detail view.
|
||||||
@@ -45,11 +44,12 @@ export class ClaimedTaskSearchResultDetailElementComponent extends SearchResultD
|
|||||||
* Initialize all instance variables
|
* Initialize all instance variables
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
super.ngOnInit();
|
||||||
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>);
|
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve workflowitem from result object
|
* Retrieve workflow item from result object
|
||||||
*/
|
*/
|
||||||
initWorkflowItem(wfi$: Observable<RemoteData<WorkflowItem>>) {
|
initWorkflowItem(wfi$: Observable<RemoteData<WorkflowItem>>) {
|
||||||
wfi$.pipe(
|
wfi$.pipe(
|
||||||
|
@@ -13,7 +13,7 @@ import { listableObjectComponent } from '../../../object-collection/shared/lista
|
|||||||
import { PoolTaskSearchResult } from '../../../object-collection/shared/pool-task-search-result.model';
|
import { PoolTaskSearchResult } from '../../../object-collection/shared/pool-task-search-result.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders pool task object for the mydspace result in the detail view.
|
* This component renders pool task object for the search result in the detail view.
|
||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-pool-search-result-detail-element',
|
selector: 'ds-pool-search-result-detail-element',
|
||||||
@@ -43,6 +43,7 @@ export class PoolSearchResultDetailElementComponent extends SearchResultDetailEl
|
|||||||
* Initialize all instance variables
|
* Initialize all instance variables
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
super.ngOnInit();
|
||||||
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>);
|
this.initWorkflowItem(this.dso.workflowitem as Observable<RemoteData<WorkflowItem>>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ import { WorkflowItemSearchResultDetailElementComponent } from './workflow-item-
|
|||||||
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
import { WorkflowItem } from '../../../../core/submission/models/workflowitem.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
||||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflowitem-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||||
|
|
||||||
let component: WorkflowItemSearchResultDetailElementComponent;
|
let component: WorkflowItemSearchResultDetailElementComponent;
|
||||||
let fixture: ComponentFixture<WorkflowItemSearchResultDetailElementComponent>;
|
let fixture: ComponentFixture<WorkflowItemSearchResultDetailElementComponent>;
|
||||||
|
@@ -10,7 +10,7 @@ import { RemoteData } from '../../../../core/data/remote-data';
|
|||||||
import { find } from 'rxjs/operators';
|
import { find } from 'rxjs/operators';
|
||||||
import { isNotUndefined } from '../../../empty.util';
|
import { isNotUndefined } from '../../../empty.util';
|
||||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflowitem-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders workflowitem object for the search result in the detail view.
|
* This component renders workflowitem object for the search result in the detail view.
|
||||||
@@ -38,6 +38,7 @@ export class WorkflowItemSearchResultDetailElementComponent extends SearchResult
|
|||||||
* Initialize all instance variables
|
* Initialize all instance variables
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
super.ngOnInit();
|
||||||
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ import { WorkspaceItemSearchResultDetailElementComponent } from './workspace-ite
|
|||||||
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
||||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflowitem-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||||
|
|
||||||
let component: WorkspaceItemSearchResultDetailElementComponent;
|
let component: WorkspaceItemSearchResultDetailElementComponent;
|
||||||
let fixture: ComponentFixture<WorkspaceItemSearchResultDetailElementComponent>;
|
let fixture: ComponentFixture<WorkspaceItemSearchResultDetailElementComponent>;
|
||||||
|
@@ -11,7 +11,7 @@ import { SearchResultDetailElementComponent } from '../search-result-detail-elem
|
|||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
import { ViewMode } from '../../../../core/shared/view-mode.model';
|
||||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { WorkspaceItemSearchResult } from '../../../object-collection/shared/workspaceitem-search-result.model';
|
import { WorkspaceItemSearchResult } from '../../../object-collection/shared/workspace-item-search-result.model';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This component renders workspace item object for the search result in the detail view.
|
* This component renders workspace item object for the search result in the detail view.
|
||||||
@@ -39,6 +39,7 @@ export class WorkspaceItemSearchResultDetailElementComponent extends SearchResul
|
|||||||
* Initialize all instance variables
|
* Initialize all instance variables
|
||||||
*/
|
*/
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
super.ngOnInit();
|
||||||
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
this.initItem(this.dso.item as Observable<RemoteData<Item>>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
<ds-listable-object-component-loader [object]="metadataRepresentation" [viewMode]="viewMode">
|
<ds-listable-object-component-loader [object]="metadataRepresentation" [viewMode]="viewMode"></ds-listable-object-component-loader>
|
||||||
</ds-listable-object-component-loader>
|
|
||||||
|
@@ -27,9 +27,9 @@ describe('ItemMetadataListElementComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should call an item-type-switcher component and pass the item-metadata-representation', () => {
|
it('should call a listable-object-component-loader component and pass the item-metadata-representation', () => {
|
||||||
const itemTypeSwitcher = fixture.debugElement.query(By.css('ds-listable-object-component-loader')).nativeElement;
|
const objectLoader = fixture.debugElement.query(By.css('ds-listable-object-component-loader')).nativeElement;
|
||||||
expect(itemTypeSwitcher.object).toBe(mockItemMetadataRepresentation);
|
expect(objectLoader.object).toBe(mockItemMetadataRepresentation);
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -19,7 +19,7 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-claimed-search-result-list-element',
|
selector: 'ds-claimed-search-result-list-element',
|
||||||
styleUrls: ['../my-dspace-result-list-element.component.scss'],
|
styleUrls: ['../../search-result-list-element/search-result-list-element.component.scss'],
|
||||||
templateUrl: './claimed-search-result-list-element.component.html',
|
templateUrl: './claimed-search-result-list-element.component.html',
|
||||||
providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }]
|
providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }]
|
||||||
})
|
})
|
||||||
|
@@ -13,7 +13,7 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-item-search-result-list-element-submission',
|
selector: 'ds-item-search-result-list-element-submission',
|
||||||
styleUrls: ['../my-dspace-result-list-element.component.scss', './item-search-result-list-element-submission.component.scss'],
|
styleUrls: ['../../search-result-list-element/search-result-list-element.component.scss', './item-search-result-list-element-submission.component.scss'],
|
||||||
templateUrl: './item-search-result-list-element-submission.component.html'
|
templateUrl: './item-search-result-list-element-submission.component.html'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
@import '../search-result-list-element/search-result-list-element.component.scss';
|
|
@@ -19,7 +19,7 @@ import { TruncatableService } from '../../../truncatable/truncatable.service';
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-pool-search-result-list-element',
|
selector: 'ds-pool-search-result-list-element',
|
||||||
styleUrls: ['../my-dspace-result-list-element.component.scss'],
|
styleUrls: ['../../search-result-list-element/search-result-list-element.component.scss'],
|
||||||
templateUrl: './pool-search-result-list-element.component.html',
|
templateUrl: './pool-search-result-list-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ import { WorkflowItem } from '../../../../core/submission/models/workflowitem.mo
|
|||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
||||||
import { WorkflowItemSearchResultListElementComponent } from './workflow-item-search-result-list-element.component';
|
import { WorkflowItemSearchResultListElementComponent } from './workflow-item-search-result-list-element.component';
|
||||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflowitem-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||||
|
|
||||||
let component: WorkflowItemSearchResultListElementComponent;
|
let component: WorkflowItemSearchResultListElementComponent;
|
||||||
|
@@ -10,7 +10,7 @@ import { WorkflowItem } from '../../../../core/submission/models/workflowitem.mo
|
|||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflowitem-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +18,7 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-workflow-item-my-dspace-result-list-element',
|
selector: 'ds-workflow-item-my-dspace-result-list-element',
|
||||||
styleUrls: ['../my-dspace-result-list-element.component.scss'],
|
styleUrls: ['../../search-result-list-element/search-result-list-element.component.scss'],
|
||||||
templateUrl: './workflow-item-search-result-list-element.component.html',
|
templateUrl: './workflow-item-search-result-list-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -9,7 +9,7 @@ import { WorkspaceItemSearchResultListElementComponent } from './workspace-item-
|
|||||||
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../../../testing/utils';
|
||||||
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflowitem-search-result.model';
|
import { WorkflowItemSearchResult } from '../../../object-collection/shared/workflow-item-search-result.model';
|
||||||
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
import { TruncatableService } from '../../../truncatable/truncatable.service';
|
||||||
|
|
||||||
let component: WorkspaceItemSearchResultListElementComponent;
|
let component: WorkspaceItemSearchResultListElementComponent;
|
||||||
|
@@ -10,7 +10,7 @@ import { isNotUndefined } from '../../../empty.util';
|
|||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
import { MyDspaceItemStatusType } from '../../../object-collection/shared/mydspace-item-status/my-dspace-item-status-type';
|
||||||
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
import { listableObjectComponent } from '../../../object-collection/shared/listable-object/listable-object.decorator';
|
||||||
import { WorkspaceItemSearchResult } from '../../../object-collection/shared/workspaceitem-search-result.model';
|
import { WorkspaceItemSearchResult } from '../../../object-collection/shared/workspace-item-search-result.model';
|
||||||
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
import { SearchResultListElementComponent } from '../../search-result-list-element/search-result-list-element.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -18,7 +18,7 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme
|
|||||||
*/
|
*/
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ds-workspace-item-search-result-list-element',
|
selector: 'ds-workspace-item-search-result-list-element',
|
||||||
styleUrls: ['../my-dspace-result-list-element.component.scss', './workspace-item-search-result-list-element.component.scss'],
|
styleUrls: ['../../search-result-list-element/search-result-list-element.component.scss', './workspace-item-search-result-list-element.component.scss'],
|
||||||
templateUrl: './workspace-item-search-result-list-element.component.html',
|
templateUrl: './workspace-item-search-result-list-element.component.html',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@@ -70,7 +70,6 @@ export class ObjectListComponent {
|
|||||||
*/
|
*/
|
||||||
private _objects: RemoteData<PaginatedList<ListableObject>>;
|
private _objects: RemoteData<PaginatedList<ListableObject>>;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the objects
|
* Setter for the objects
|
||||||
* @param objects The new objects
|
* @param objects The new objects
|
||||||
|
@@ -121,3 +121,14 @@ export function createPendingRemoteDataObject<T>(object?: T): RemoteData<T> {
|
|||||||
export function createPendingRemoteDataObject$<T>(object?: T): Observable<RemoteData<T>> {
|
export function createPendingRemoteDataObject$<T>(object?: T): Observable<RemoteData<T>> {
|
||||||
return observableOf(createPendingRemoteDataObject(object));
|
return observableOf(createPendingRemoteDataObject(object));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a jasmine spy for an exported function
|
||||||
|
* @param target The object to spy on
|
||||||
|
* @param prop The property/function to spy on
|
||||||
|
*/
|
||||||
|
export function spyOnExported<T>(target: T, prop: keyof T): jasmine.Spy {
|
||||||
|
const spy = jasmine.createSpy(`${prop}Spy`);
|
||||||
|
spyOnProperty(target, prop).and.returnValue(spy);
|
||||||
|
return spy;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user