diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.html b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.html
index 723ce0adbe..61bcbc9a4f 100644
--- a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.html
+++ b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.html
@@ -7,12 +7,11 @@
(submitSuggestion)="selectCustom($event)">
0"
- class="item-list-job-title">
-
- 0">,
+ class="item-list-address-locality">
+ 0">,
0"
- class="item-list-job-title">
+ class="item-list-address-country">
diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts
index fc53df8497..2a77b64f43 100644
--- a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts
+++ b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts
@@ -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();
});
});
diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.ts
index 7f4e7295b9..4a2a41aae5 100644
--- a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.ts
+++ b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.ts
@@ -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'],
diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts
index a21f0ec075..5215ed98eb 100644
--- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts
+++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts
@@ -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();
});
});
diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts
index 1bcea16020..37fd77649b 100644
--- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts
+++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.ts
@@ -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'],
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts
index 176b718cda..85701a89b8 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts
@@ -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;
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts
index 2a67c4fd63..3421e6c5c9 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts
@@ -64,7 +64,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy
selection.map((s: SearchResult- ) => this.addNameVariantSubscription(s))
);
if (this.relationshipOptions.nameVariants) {
- this.context = Context.Workspace;
+ this.context = Context.SubmissionModal;
}
// this.setExistingNameVariants();
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts
index 3870721463..f9d7dabf9c 100644
--- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts
+++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts
@@ -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:
diff --git a/src/app/shared/form/form.component.spec.ts b/src/app/shared/form/form.component.spec.ts
index 111e91364c..3342db37ae 100644
--- a/src/app/shared/form/form.component.spec.ts
+++ b/src/app/shared/form/form.component.spec.ts
@@ -381,6 +381,7 @@ describe('FormComponent test suite', () => {
});
describe('', () => {
+ init();
beforeEach(() => {
formFixture = TestBed.createComponent(FormComponent);
store = TestBed.get(Store);
diff --git a/src/app/shared/input-suggestions/input-suggestions.component.spec.ts b/src/app/shared/input-suggestions/input-suggestions.component.spec.ts
index b20c015d9f..f6cc646d5a 100644
--- a/src/app/shared/input-suggestions/input-suggestions.component.spec.ts
+++ b/src/app/shared/input-suggestions/input-suggestions.component.spec.ts
@@ -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);
});
});
-
});
diff --git a/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts b/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts
index f24ca86661..199bbeae25 100644
--- a/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts
+++ b/src/app/shared/menu/menu-item/link-menu-item.component.spec.ts
@@ -10,15 +10,23 @@ describe('LinkMenuItemComponent', () => {
let component: LinkMenuItemComponent;
let fixture: ComponentFixture;
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],
diff --git a/src/app/shared/menu/menu-section/menu-section.component.spec.ts b/src/app/shared/menu/menu-section/menu-section.component.spec.ts
index ebb099fb56..0a72d17eca 100644
--- a/src/app/shared/menu/menu-section/menu-section.component.spec.ts
+++ b/src/app/shared/menu/menu-section/menu-section.component.spec.ts
@@ -13,13 +13,14 @@ describe('MenuSectionComponent', () => {
let comp: MenuSectionComponent;
let fixture: ComponentFixture;
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],
diff --git a/src/app/shared/menu/menu.service.spec.ts b/src/app/shared/menu/menu.service.spec.ts
index b7f955b257..115b523d16 100644
--- a/src/app/shared/menu/menu.service.spec.ts
+++ b/src/app/shared/menu/menu.service.spec.ts
@@ -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 },
diff --git a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts
index df371cfaba..71991bdf25 100644
--- a/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts
+++ b/src/app/shared/mydspace-actions/claimed-task/claimed-task-actions.component.spec.ts
@@ -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({