mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
small fixes + test fix
This commit is contained in:
@@ -7,12 +7,11 @@
|
||||
(submitSuggestion)="selectCustom($event)"></ds-org-unit-input-suggestions>
|
||||
<span class="text-muted">
|
||||
<span *ngIf="dso.allMetadata('organization.address.addressLocality').length > 0"
|
||||
class="item-list-job-title">
|
||||
<span [innerHTML]="firstMetadataValue(['organization.address.addressLocality'])"><span [innerHTML]="firstMetadataValue(['organization.address.addressLocality'])"></span></span>
|
||||
<span *ngIf="dso.allMetadata('organization.address.addressCountry').length > 0">, </span>
|
||||
class="item-list-address-locality">
|
||||
<span [innerHTML]="firstMetadataValue(['organization.address.addressLocality'])"><span [innerHTML]="firstMetadataValue(['organization.address.addressLocality'])"></span></span><span *ngIf="dso.allMetadata('organization.address.addressCountry').length > 0">, </span>
|
||||
</span>
|
||||
<span *ngIf="dso.allMetadata('organization.address.addressCountry').length > 0"
|
||||
class="item-list-job-title">
|
||||
class="item-list-address-country">
|
||||
<span [innerHTML]="firstMetadataValue(['organization.address.addressCountry'])"><span [innerHTML]="firstMetadataValue(['organization.address.addressCountry'])"></span></span>
|
||||
</span>
|
||||
</span>
|
||||
|
@@ -39,10 +39,16 @@ function init() {
|
||||
value: 'This is just another title'
|
||||
}
|
||||
],
|
||||
'person.jobTitle': [
|
||||
'organization.address.addressLocality': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Developer'
|
||||
value: 'Europe'
|
||||
}
|
||||
],
|
||||
'organization.address.addressCountry': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Belgium'
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -70,7 +76,7 @@ function init() {
|
||||
};
|
||||
}
|
||||
|
||||
describe('PersonSearchResultListElementSubmissionComponent', () => {
|
||||
describe('OrgUnitSearchResultListSubmissionElementComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
@@ -83,7 +89,7 @@ describe('PersonSearchResultListElementSubmissionComponent', () => {
|
||||
{ provide: NgbModal, useValue: {} },
|
||||
{ provide: ItemDataService, useValue: {} },
|
||||
{ provide: SelectableListService, useValue: {} },
|
||||
{ provide: Store, useValue: {}}
|
||||
{ provide: Store, useValue: {} }
|
||||
],
|
||||
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
@@ -98,26 +104,50 @@ describe('PersonSearchResultListElementSubmissionComponent', () => {
|
||||
|
||||
}));
|
||||
|
||||
describe('When the item has a job title', () => {
|
||||
describe('When the item has a address locality span', () => {
|
||||
beforeEach(() => {
|
||||
personListElementComponent.object = mockItemWithMetadata;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the job title span', () => {
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-job-title'));
|
||||
it('should show the address locality span', () => {
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-address-locality'));
|
||||
expect(jobTitleField).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item has no job title', () => {
|
||||
describe('When the item has no address locality', () => {
|
||||
beforeEach(() => {
|
||||
personListElementComponent.object = mockItemWithoutMetadata;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should not show the job title span', () => {
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-job-title'));
|
||||
it('should not show the address locality span', () => {
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-address-locality'));
|
||||
expect(jobTitleField).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item has a address country span', () => {
|
||||
beforeEach(() => {
|
||||
personListElementComponent.object = mockItemWithMetadata;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should show the address country span', () => {
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-address-country'));
|
||||
expect(jobTitleField).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('When the item has no address country', () => {
|
||||
beforeEach(() => {
|
||||
personListElementComponent.object = mockItemWithoutMetadata;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should not show the address country span', () => {
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-address-country'));
|
||||
expect(jobTitleField).toBeNull();
|
||||
});
|
||||
});
|
||||
|
@@ -16,7 +16,7 @@ import { ItemDataService } from '../../../../../core/data/item-data.service';
|
||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
import { NameVariantModalComponent } from '../../name-variant-modal/name-variant-modal.component';
|
||||
|
||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.Workspace)
|
||||
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.SubmissionModal)
|
||||
@Component({
|
||||
selector: 'ds-person-search-result-list-submission-element',
|
||||
styleUrls: ['./org-unit-search-result-list-submission-element.component.scss'],
|
||||
|
@@ -105,7 +105,7 @@ describe('PersonSearchResultListElementSubmissionComponent', () => {
|
||||
});
|
||||
|
||||
it('should show the job title span', () => {
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-job-title'));
|
||||
const jobTitleField = fixture.debugElement.query(By.css('span.item-list-job-title'));
|
||||
expect(jobTitleField).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
@@ -16,7 +16,7 @@ import { MetadataValue } from '../../../../../core/shared/metadata.models';
|
||||
import { ItemDataService } from '../../../../../core/data/item-data.service';
|
||||
import { SelectableListService } from '../../../../../shared/object-list/selectable-list/selectable-list.service';
|
||||
|
||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.Workspace)
|
||||
@listableObjectComponent('PersonSearchResult', ViewMode.ListElement, Context.SubmissionModal)
|
||||
@Component({
|
||||
selector: 'ds-person-search-result-list-submission-element',
|
||||
styleUrls: ['./person-search-result-list-submission-element.component.scss'],
|
||||
|
@@ -298,7 +298,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo
|
||||
}
|
||||
|
||||
openLookup() {
|
||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg', centered: true });
|
||||
this.modalRef = this.modalService.open(DsDynamicLookupRelationModalComponent, { size: 'lg'});
|
||||
const modalComp = this.modalRef.componentInstance;
|
||||
modalComp.repeatable = this.model.repeatable;
|
||||
modalComp.listId = this.listId;
|
||||
|
@@ -64,7 +64,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
|
||||
selection.map((s: SearchResult<Item>) => this.addNameVariantSubscription(s))
|
||||
);
|
||||
if (this.relationshipOptions.nameVariants) {
|
||||
this.context = Context.Workspace;
|
||||
this.context = Context.SubmissionModal;
|
||||
}
|
||||
|
||||
// this.setExistingNameVariants();
|
||||
|
@@ -14,6 +14,7 @@ import { cold, hot } from 'jasmine-marbles';
|
||||
import * as operators from 'rxjs/operators';
|
||||
import { last } from 'rxjs/operators';
|
||||
import { ItemType } from '../../../../../core/shared/item-relationships/item-type.model';
|
||||
import { RestResponse } from '../../../../../core/cache/response.models';
|
||||
|
||||
describe('RelationshipEffects', () => {
|
||||
let relationEffects: RelationshipEffects;
|
||||
@@ -71,19 +72,18 @@ describe('RelationshipEffects', () => {
|
||||
relationship = Object.assign(new Relationship(),
|
||||
{
|
||||
uuid: relationshipID,
|
||||
id: relationshipID,
|
||||
leftItem: createSuccessfulRemoteDataObject$(leftItem),
|
||||
rightItem: createSuccessfulRemoteDataObject$(rightItem),
|
||||
relationshipType: createSuccessfulRemoteDataObject$(relationshipType)
|
||||
});
|
||||
|
||||
mockRelationshipService = {
|
||||
getRelationshipByItemsAndLabel:
|
||||
() => observableOf(relationship),
|
||||
deleteRelationship: () => {
|
||||
/* Do nothing */
|
||||
},
|
||||
addRelationship: () => {
|
||||
/* Do nothing */
|
||||
}
|
||||
deleteRelationship: () => observableOf(new RestResponse(true, 200, 'OK')),
|
||||
addRelationship: () => observableOf(new RestResponse(true, 200, 'OK'))
|
||||
|
||||
};
|
||||
mockRelationshipTypeService = {
|
||||
getRelationshipTypeByLabelAndTypes:
|
||||
|
@@ -381,6 +381,7 @@ describe('FormComponent test suite', () => {
|
||||
});
|
||||
|
||||
describe('', () => {
|
||||
init();
|
||||
beforeEach(() => {
|
||||
formFixture = TestBed.createComponent(FormComponent);
|
||||
store = TestBed.get(Store);
|
||||
|
@@ -281,6 +281,7 @@ describe('InputSuggestionsComponent', () => {
|
||||
expect(autocomplete.nativeElement.classList).not.toContain('show');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when the variable \'show\' is set to true and close() is called', () => {
|
||||
beforeEach(() => {
|
||||
comp.show.next(true);
|
||||
@@ -304,5 +305,4 @@ describe('InputSuggestionsComponent', () => {
|
||||
expect(comp.onClickSuggestion).toHaveBeenCalledWith(suggestions[clickedIndex].value);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -10,15 +10,23 @@ describe('LinkMenuItemComponent', () => {
|
||||
let component: LinkMenuItemComponent;
|
||||
let fixture: ComponentFixture<LinkMenuItemComponent>;
|
||||
let debugElement: DebugElement;
|
||||
const text = 'HELLO';
|
||||
const link = 'http://google.com';
|
||||
const nameSpace = 'dspace.com/';
|
||||
const globalConfig = {
|
||||
ui: {
|
||||
nameSpace: nameSpace
|
||||
}
|
||||
} as any;
|
||||
let text;
|
||||
let link;
|
||||
let nameSpace;
|
||||
let globalConfig;
|
||||
|
||||
function init() {
|
||||
text = 'HELLO';
|
||||
link = 'http://google.com';
|
||||
nameSpace = 'dspace.com/';
|
||||
globalConfig = {
|
||||
ui: {
|
||||
nameSpace: nameSpace
|
||||
}
|
||||
} as any;
|
||||
}
|
||||
beforeEach(async(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [LinkMenuItemComponent, RouterLinkDirectiveStub],
|
||||
|
@@ -13,13 +13,14 @@ describe('MenuSectionComponent', () => {
|
||||
let comp: MenuSectionComponent;
|
||||
let fixture: ComponentFixture<MenuSectionComponent>;
|
||||
let menuService: MenuService;
|
||||
const dummySection = {
|
||||
id: 'section',
|
||||
visible: true,
|
||||
active: false
|
||||
} as any;
|
||||
let dummySection;
|
||||
|
||||
beforeEach(async(() => {
|
||||
dummySection = {
|
||||
id: 'section',
|
||||
visible: true,
|
||||
active: false
|
||||
} as any;
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule],
|
||||
declarations: [MenuSectionComponent],
|
||||
|
@@ -16,43 +16,54 @@ import {
|
||||
describe('MenuService', () => {
|
||||
let service: MenuService;
|
||||
let selectSpy;
|
||||
const store = Object.assign(observableOf({}), {
|
||||
dispatch: () => {/***/
|
||||
}
|
||||
}) as any;
|
||||
const fakeMenu = {
|
||||
id: MenuID.ADMIN,
|
||||
collapsed: true,
|
||||
visible: false,
|
||||
previewCollapsed: true
|
||||
} as any;
|
||||
const visibleSection1 = {
|
||||
id: 'section',
|
||||
visible: true,
|
||||
active: false
|
||||
};
|
||||
const visibleSection2 = {
|
||||
id: 'section_2',
|
||||
visible: true
|
||||
};
|
||||
const hiddenSection3 = {
|
||||
id: 'section_3',
|
||||
visible: false
|
||||
};
|
||||
const subSection4 = {
|
||||
id: 'section_4',
|
||||
visible: true,
|
||||
parentID: 'section1'
|
||||
};
|
||||
let store;
|
||||
let fakeMenu;
|
||||
let visibleSection1;
|
||||
let visibleSection2;
|
||||
let hiddenSection3;
|
||||
let subSection4;
|
||||
let topSections;
|
||||
|
||||
const topSections = {
|
||||
section: visibleSection1,
|
||||
section_2: visibleSection2,
|
||||
section_3: hiddenSection3,
|
||||
section_4: subSection4
|
||||
};
|
||||
function init() {
|
||||
store = Object.assign(observableOf({}), {
|
||||
dispatch: () => {/***/
|
||||
}
|
||||
}) as any;
|
||||
fakeMenu = {
|
||||
id: MenuID.ADMIN,
|
||||
collapsed: true,
|
||||
visible: false,
|
||||
previewCollapsed: true
|
||||
} as any;
|
||||
visibleSection1 = {
|
||||
id: 'section',
|
||||
visible: true,
|
||||
active: false
|
||||
};
|
||||
visibleSection2 = {
|
||||
id: 'section_2',
|
||||
visible: true
|
||||
};
|
||||
hiddenSection3 = {
|
||||
id: 'section_3',
|
||||
visible: false
|
||||
};
|
||||
subSection4 = {
|
||||
id: 'section_4',
|
||||
visible: true,
|
||||
parentID: 'section1'
|
||||
};
|
||||
|
||||
topSections = {
|
||||
section: visibleSection1,
|
||||
section_2: visibleSection2,
|
||||
section_3: hiddenSection3,
|
||||
section_4: subSection4
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(async(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
{ provide: Store, useValue: store },
|
||||
|
@@ -29,52 +29,67 @@ let mockObject: ClaimedTask;
|
||||
let notificationsServiceStub: NotificationsServiceStub;
|
||||
let router: RouterStub;
|
||||
|
||||
const mockDataService = jasmine.createSpyObj('ClaimedTaskDataService', {
|
||||
approveTask: jasmine.createSpy('approveTask'),
|
||||
rejectTask: jasmine.createSpy('rejectTask'),
|
||||
returnToPoolTask: jasmine.createSpy('returnToPoolTask'),
|
||||
});
|
||||
let mockDataService;
|
||||
|
||||
const searchService = getMockSearchService();
|
||||
let searchService;
|
||||
|
||||
const requestServce = getMockRequestService();
|
||||
let requestServce;
|
||||
|
||||
const item = Object.assign(new Item(), {
|
||||
bundles: observableOf({}),
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is just another title'
|
||||
}
|
||||
],
|
||||
'dc.type': [
|
||||
{
|
||||
language: null,
|
||||
value: 'Article'
|
||||
}
|
||||
],
|
||||
'dc.contributor.author': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Smith, Donald'
|
||||
}
|
||||
],
|
||||
'dc.date.issued': [
|
||||
{
|
||||
language: null,
|
||||
value: '2015-06-26'
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
const rdItem = createSuccessfulRemoteDataObject(item);
|
||||
const workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
|
||||
const rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
|
||||
mockObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' });
|
||||
let item;
|
||||
let rdItem;
|
||||
let workflowitem;
|
||||
let rdWorkflowitem;
|
||||
|
||||
function init() {
|
||||
mockDataService = jasmine.createSpyObj('ClaimedTaskDataService', {
|
||||
approveTask: jasmine.createSpy('approveTask'),
|
||||
rejectTask: jasmine.createSpy('rejectTask'),
|
||||
returnToPoolTask: jasmine.createSpy('returnToPoolTask'),
|
||||
});
|
||||
|
||||
searchService = getMockSearchService();
|
||||
|
||||
requestServce = getMockRequestService();
|
||||
|
||||
item = Object.assign(new Item(), {
|
||||
bundles: observableOf({}),
|
||||
metadata: {
|
||||
'dc.title': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'This is just another title'
|
||||
}
|
||||
],
|
||||
'dc.type': [
|
||||
{
|
||||
language: null,
|
||||
value: 'Article'
|
||||
}
|
||||
],
|
||||
'dc.contributor.author': [
|
||||
{
|
||||
language: 'en_US',
|
||||
value: 'Smith, Donald'
|
||||
}
|
||||
],
|
||||
'dc.date.issued': [
|
||||
{
|
||||
language: null,
|
||||
value: '2015-06-26'
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
rdItem = createSuccessfulRemoteDataObject(item);
|
||||
workflowitem = Object.assign(new WorkflowItem(), { item: observableOf(rdItem) });
|
||||
rdWorkflowitem = createSuccessfulRemoteDataObject(workflowitem);
|
||||
mockObject = Object.assign(new ClaimedTask(), { workflowitem: observableOf(rdWorkflowitem), id: '1234' });
|
||||
|
||||
}
|
||||
|
||||
describe('ClaimedTaskActionsComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
init();
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot({
|
||||
|
Reference in New Issue
Block a user