mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
test fixes
This commit is contained in:
@@ -609,7 +609,10 @@
|
|||||||
"submission.sections.describe.relationship-lookup.select-all": "Select all",
|
"submission.sections.describe.relationship-lookup.select-all": "Select all",
|
||||||
"submission.sections.describe.relationship-lookup.select-page": "Select page",
|
"submission.sections.describe.relationship-lookup.select-page": "Select page",
|
||||||
"submission.sections.describe.relationship-lookup.selected": "Selected {{ size }} items",
|
"submission.sections.describe.relationship-lookup.selected": "Selected {{ size }} items",
|
||||||
"submission.sections.describe.relationship-lookup.title": "Select a {{ label }}",
|
"submission.sections.describe.relationship-lookup.title.Journal Issue": "Select a Journal Issue",
|
||||||
|
"submission.sections.describe.relationship-lookup.title.Journal Volume": "Select a Journal Volume",
|
||||||
|
"submission.sections.describe.relationship-lookup.title.Journal": "Select a Journal",
|
||||||
|
"submission.sections.describe.relationship-lookup.title.Author": "Select an Author",
|
||||||
"submission.sections.describe.relationship-lookup.toggle-dropdown": "Toggle dropdown",
|
"submission.sections.describe.relationship-lookup.toggle-dropdown": "Toggle dropdown",
|
||||||
"submission.sections.general.add-more": "Add more",
|
"submission.sections.general.add-more": "Add more",
|
||||||
"submission.sections.general.collection": "Collection",
|
"submission.sections.general.collection": "Collection",
|
||||||
|
@@ -31,7 +31,7 @@ describe('ItemPageDateFieldComponent', () => {
|
|||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
fixture = TestBed.createComponent(ItemPageDateFieldComponent);
|
fixture = TestBed.createComponent(ItemPageDateFieldComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
comp.itemRD$ = mockItemWithMetadataFieldAndValue(mockField, mockValue);
|
comp.item = mockItemWithMetadataFieldAndValue(mockField, mockValue);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@@ -8,15 +8,14 @@ import { ItemDataService } from '../../../../core/data/item-data.service';
|
|||||||
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
|
||||||
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Item } from '../../../../core/shared/item.model';
|
import { Item } from '../../../../core/shared/item.model';
|
||||||
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 { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { createRelationshipsObservable } from '../shared/item.component.spec';
|
import { createRelationshipsObservable } from '../shared/item.component.spec';
|
||||||
import { PublicationComponent } from './publication.component';
|
import { PublicationComponent } from './publication.component';
|
||||||
import { of as observableOf } from 'rxjs';
|
|
||||||
import { MetadataMap } from '../../../../core/shared/metadata.models';
|
import { MetadataMap } from '../../../../core/shared/metadata.models';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
||||||
|
import { RelationshipService } from '../../../../core/data/relationship.service';
|
||||||
|
|
||||||
const mockItem: Item = Object.assign(new Item(), {
|
const mockItem: Item = Object.assign(new Item(), {
|
||||||
bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
|
bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
|
||||||
@@ -40,7 +39,8 @@ describe('PublicationComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{provide: ITEM, useValue: mockItem},
|
{provide: ITEM, useValue: mockItem},
|
||||||
{provide: ItemDataService, useValue: {}},
|
{provide: ItemDataService, useValue: {}},
|
||||||
{provide: TruncatableService, useValue: {}}
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: RelationshipService, useValue: {}}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
@@ -26,6 +26,7 @@ import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-rep
|
|||||||
import { MetadataMap, MetadataValue } from '../../../../core/shared/metadata.models';
|
import { MetadataMap, MetadataValue } from '../../../../core/shared/metadata.models';
|
||||||
import { compareArraysUsing, compareArraysUsingIds } from './item-relationships-utils';
|
import { compareArraysUsing, compareArraysUsingIds } from './item-relationships-utils';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
||||||
|
import { RelationshipService } from '../../../../core/data/relationship.service';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a generic test for an item-page-fields component using a mockItem and the type of component
|
* Create a generic test for an item-page-fields component using a mockItem and the type of component
|
||||||
@@ -51,7 +52,8 @@ export function getItemPageFieldsTest(mockItem: Item, component) {
|
|||||||
providers: [
|
providers: [
|
||||||
{provide: ITEM, useValue: mockItem},
|
{provide: ITEM, useValue: mockItem},
|
||||||
{provide: ItemDataService, useValue: {}},
|
{provide: ItemDataService, useValue: {}},
|
||||||
{provide: TruncatableService, useValue: {}}
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: RelationshipService, useValue: {}}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
@@ -379,7 +381,8 @@ describe('ItemComponent', () => {
|
|||||||
}), BrowserAnimationsModule],
|
}), BrowserAnimationsModule],
|
||||||
declarations: [ItemComponent, VarDirective],
|
declarations: [ItemComponent, VarDirective],
|
||||||
providers: [
|
providers: [
|
||||||
{provide: ITEM, useValue: mockItem}
|
{provide: ITEM, useValue: mockItem},
|
||||||
|
{provide: RelationshipService, useValue: {}}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
@@ -38,12 +38,8 @@ describe('MyDSpaceConfigurationService', () => {
|
|||||||
|
|
||||||
const roleService: any = new MockRoleService();
|
const roleService: any = new MockRoleService();
|
||||||
|
|
||||||
const fixedFilterService = jasmine.createSpyObj('SearchFixedFilterService', {
|
|
||||||
getQueryByFilterName: observableOf(''),
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
service = new MyDSpaceConfigurationService(roleService, fixedFilterService, spy, activatedRoute);
|
service = new MyDSpaceConfigurationService(roleService, spy, activatedRoute);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the scope is called', () => {
|
describe('when the scope is called', () => {
|
||||||
|
@@ -30,14 +30,10 @@ describe('SearchConfigurationService', () => {
|
|||||||
getRouteParameterValue: observableOf('')
|
getRouteParameterValue: observableOf('')
|
||||||
});
|
});
|
||||||
|
|
||||||
const fixedFilterService = jasmine.createSpyObj('SearchFixedFilterService', {
|
|
||||||
getQueryByFilterName: observableOf(''),
|
|
||||||
});
|
|
||||||
|
|
||||||
const activatedRoute: any = new ActivatedRouteStub();
|
const activatedRoute: any = new ActivatedRouteStub();
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
service = new SearchConfigurationService(routeService, fixedFilterService, activatedRoute);
|
service = new SearchConfigurationService(routeService, activatedRoute);
|
||||||
});
|
});
|
||||||
describe('when the scope is called', () => {
|
describe('when the scope is called', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@@ -72,7 +72,6 @@ export class SearchConfigurationService implements OnDestroy {
|
|||||||
/**
|
/**
|
||||||
* Initialize the search options
|
* Initialize the search options
|
||||||
* @param {RouteService} routeService
|
* @param {RouteService} routeService
|
||||||
* @param {SearchFixedFilterService} fixedFilterService
|
|
||||||
* @param {ActivatedRoute} route
|
* @param {ActivatedRoute} route
|
||||||
*/
|
*/
|
||||||
constructor(protected routeService: RouteService,
|
constructor(protected routeService: RouteService,
|
||||||
|
@@ -29,7 +29,7 @@ class Owner extends EquatableObject<Owner> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fdescribe('equatable', () => {
|
describe('equatable', () => {
|
||||||
let dogRoger: Dog;
|
let dogRoger: Dog;
|
||||||
let dogMissy: Dog;
|
let dogMissy: Dog;
|
||||||
|
|
||||||
|
@@ -16,6 +16,7 @@ import { JournalComponent } from './journal.component';
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { GenericItemPageFieldComponent } from '../../../../+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component';
|
import { GenericItemPageFieldComponent } from '../../../../+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
||||||
|
import { RelationshipService } from '../../../../core/data/relationship.service';
|
||||||
|
|
||||||
let comp: JournalComponent;
|
let comp: JournalComponent;
|
||||||
let fixture: ComponentFixture<JournalComponent>;
|
let fixture: ComponentFixture<JournalComponent>;
|
||||||
@@ -57,7 +58,8 @@ describe('JournalComponent', () => {
|
|||||||
providers: [
|
providers: [
|
||||||
{provide: ITEM, useValue: mockItem},
|
{provide: ITEM, useValue: mockItem},
|
||||||
{provide: ItemDataService, useValue: {}},
|
{provide: ItemDataService, useValue: {}},
|
||||||
{provide: TruncatableService, useValue: {}}
|
{provide: TruncatableService, useValue: {}},
|
||||||
|
{provide: RelationshipService, useValue: {}}
|
||||||
],
|
],
|
||||||
|
|
||||||
schemas: [NO_ERRORS_SCHEMA]
|
schemas: [NO_ERRORS_SCHEMA]
|
||||||
|
@@ -65,6 +65,10 @@ import { DsDynamicFormArrayComponent } from './models/array-group/dynamic-form-a
|
|||||||
import { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component';
|
import { DsDynamicFormGroupComponent } from './models/form-group/dynamic-form-group.component';
|
||||||
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
import { DsDynamicRelationGroupComponent } from './models/relation-group/dynamic-relation-group.components';
|
||||||
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component';
|
||||||
|
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
|
||||||
|
import { RelationshipService } from '../../../../core/data/relationship.service';
|
||||||
|
import { SelectableListService } from '../../../object-list/selectable-list/selectable-list.service';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('DsDynamicFormControlContainerComponent test suite', () => {
|
describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||||
|
|
||||||
@@ -95,12 +99,14 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
|||||||
new DynamicSwitchModel({ id: 'switch' }),
|
new DynamicSwitchModel({ id: 'switch' }),
|
||||||
new DynamicTextAreaModel({ id: 'textarea' }),
|
new DynamicTextAreaModel({ id: 'textarea' }),
|
||||||
new DynamicTimePickerModel({ id: 'timepicker' }),
|
new DynamicTimePickerModel({ id: 'timepicker' }),
|
||||||
new DynamicTypeaheadModel({ id: 'typeahead' }),
|
new DynamicTypeaheadModel({ id: 'typeahead', workspaceItem: new WorkspaceItem(), repeatable: false }),
|
||||||
new DynamicScrollableDropdownModel({
|
new DynamicScrollableDropdownModel({
|
||||||
id: 'scrollableDropdown',
|
id: 'scrollableDropdown',
|
||||||
authorityOptions: authorityOptions
|
authorityOptions: authorityOptions,
|
||||||
|
workspaceItem: new WorkspaceItem(),
|
||||||
|
repeatable: false
|
||||||
}),
|
}),
|
||||||
new DynamicTagModel({ id: 'tag' }),
|
new DynamicTagModel({ id: 'tag', workspaceItem: new WorkspaceItem(), repeatable: false}),
|
||||||
new DynamicListCheckboxGroupModel({
|
new DynamicListCheckboxGroupModel({
|
||||||
id: 'checkboxList',
|
id: 'checkboxList',
|
||||||
authorityOptions: authorityOptions,
|
authorityOptions: authorityOptions,
|
||||||
@@ -118,11 +124,13 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
|||||||
name: 'relationGroup',
|
name: 'relationGroup',
|
||||||
relationFields: [],
|
relationFields: [],
|
||||||
scopeUUID: '',
|
scopeUUID: '',
|
||||||
submissionScope: ''
|
submissionScope: '',
|
||||||
|
workspaceItem: new WorkspaceItem(),
|
||||||
|
repeatable: false
|
||||||
}),
|
}),
|
||||||
new DynamicDsDatePickerModel({ id: 'datepicker' }),
|
new DynamicDsDatePickerModel({ id: 'datepicker'}),
|
||||||
new DynamicLookupModel({ id: 'lookup' }),
|
new DynamicLookupModel({ id: 'lookup', workspaceItem: new WorkspaceItem(), repeatable: false }),
|
||||||
new DynamicLookupNameModel({ id: 'lookupName' }),
|
new DynamicLookupNameModel({ id: 'lookupName', workspaceItem: new WorkspaceItem(), repeatable: false }),
|
||||||
new DynamicQualdropModel({ id: 'combobox', readOnly: false })
|
new DynamicQualdropModel({ id: 'combobox', readOnly: false })
|
||||||
];
|
];
|
||||||
const testModel = formModel[8];
|
const testModel = formModel[8];
|
||||||
@@ -152,7 +160,12 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
|||||||
TranslateModule.forRoot(),
|
TranslateModule.forRoot(),
|
||||||
TextMaskModule
|
TextMaskModule
|
||||||
],
|
],
|
||||||
providers: [DsDynamicFormControlContainerComponent, DynamicFormService],
|
providers: [
|
||||||
|
DsDynamicFormControlContainerComponent,
|
||||||
|
DynamicFormService,
|
||||||
|
{ provide: RelationshipService, useValue: {} },
|
||||||
|
{ provide: SelectableListService, useValue: {} }
|
||||||
|
],
|
||||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||||
}).compileComponents().then(() => {
|
}).compileComponents().then(() => {
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h4 class="modal-title" id="modal-title">{{ ('submission.sections.describe.relationship-lookup.title' | translate:{label: label}) }}</h4>
|
<h4 class="modal-title" id="modal-title">{{ ('submission.sections.describe.relationship-lookup.title.' + label) | translate }}</h4>
|
||||||
<button type="button" class="close" aria-label="Close button" aria-describedby="modal-title"
|
<button type="button" class="close" aria-label="Close button" aria-describedby="modal-title"
|
||||||
(click)="modal.dismiss()">
|
(click)="modal.dismiss()">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
|
@@ -3,6 +3,7 @@ import { DateFieldParser } from './date-field-parser';
|
|||||||
import { DynamicDsDatePickerModel } from '../ds-dynamic-form-ui/models/date-picker/date-picker.model';
|
import { DynamicDsDatePickerModel } from '../ds-dynamic-form-ui/models/date-picker/date-picker.model';
|
||||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('DateFieldParser test suite', () => {
|
describe('DateFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -35,13 +36,13 @@ describe('DateFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new DateFieldParser(field, initFormValues, parserOptions);
|
const parser = new DateFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof DateFieldParser).toBe(true);
|
expect(parser instanceof DateFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicDsDatePickerModel object when repeatable option is false', () => {
|
it('should return a DynamicDsDatePickerModel object when repeatable option is false', () => {
|
||||||
const parser = new DateFieldParser(field, initFormValues, parserOptions);
|
const parser = new DateFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ describe('DateFieldParser test suite', () => {
|
|||||||
};
|
};
|
||||||
const expectedValue = '1983-11-18';
|
const expectedValue = '1983-11-18';
|
||||||
|
|
||||||
const parser = new DateFieldParser(field, initFormValues, parserOptions);
|
const parser = new DateFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@ import { FormFieldModel } from '../models/form-field.model';
|
|||||||
import { DropdownFieldParser } from './dropdown-field-parser';
|
import { DropdownFieldParser } from './dropdown-field-parser';
|
||||||
import { DynamicScrollableDropdownModel } from '../ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model';
|
import { DynamicScrollableDropdownModel } from '../ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('DropdownFieldParser test suite', () => {
|
describe('DropdownFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -35,13 +36,13 @@ describe('DropdownFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new DropdownFieldParser(field, initFormValues, parserOptions);
|
const parser = new DropdownFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof DropdownFieldParser).toBe(true);
|
expect(parser instanceof DropdownFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicScrollableDropdownModel object when repeatable option is false', () => {
|
it('should return a DynamicScrollableDropdownModel object when repeatable option is false', () => {
|
||||||
const parser = new DropdownFieldParser(field, initFormValues, parserOptions);
|
const parser = new DropdownFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ describe('DropdownFieldParser test suite', () => {
|
|||||||
|
|
||||||
it('should throw when authority is not passed', () => {
|
it('should throw when authority is not passed', () => {
|
||||||
field.selectableMetadata[0].authority = null;
|
field.selectableMetadata[0].authority = null;
|
||||||
const parser = new DropdownFieldParser(field, initFormValues, parserOptions);
|
const parser = new DropdownFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(() => parser.parse())
|
expect(() => parser.parse())
|
||||||
.toThrow();
|
.toThrow();
|
||||||
|
@@ -4,6 +4,7 @@ import { ListFieldParser } from './list-field-parser';
|
|||||||
import { DynamicListCheckboxGroupModel } from '../ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model';
|
import { DynamicListCheckboxGroupModel } from '../ds-dynamic-form-ui/models/list/dynamic-list-checkbox-group.model';
|
||||||
import { DynamicListRadioGroupModel } from '../ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model';
|
import { DynamicListRadioGroupModel } from '../ds-dynamic-form-ui/models/list/dynamic-list-radio-group.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('ListFieldParser test suite', () => {
|
describe('ListFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -37,13 +38,13 @@ describe('ListFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new ListFieldParser(field, initFormValues, parserOptions);
|
const parser = new ListFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof ListFieldParser).toBe(true);
|
expect(parser instanceof ListFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicListCheckboxGroupModel object when repeatable option is true', () => {
|
it('should return a DynamicListCheckboxGroupModel object when repeatable option is true', () => {
|
||||||
const parser = new ListFieldParser(field, initFormValues, parserOptions);
|
const parser = new ListFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ describe('ListFieldParser test suite', () => {
|
|||||||
|
|
||||||
it('should return a DynamicListRadioGroupModel object when repeatable option is false', () => {
|
it('should return a DynamicListRadioGroupModel object when repeatable option is false', () => {
|
||||||
field.repeatable = false;
|
field.repeatable = false;
|
||||||
const parser = new ListFieldParser(field, initFormValues, parserOptions);
|
const parser = new ListFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -65,7 +66,7 @@ describe('ListFieldParser test suite', () => {
|
|||||||
};
|
};
|
||||||
const expectedValue = [new FormFieldMetadataValueObject('test type')];
|
const expectedValue = [new FormFieldMetadataValueObject('test type')];
|
||||||
|
|
||||||
const parser = new ListFieldParser(field, initFormValues, parserOptions);
|
const parser = new ListFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ import { FormFieldMetadataValueObject } from '../models/form-field-metadata-valu
|
|||||||
import { LookupFieldParser } from './lookup-field-parser';
|
import { LookupFieldParser } from './lookup-field-parser';
|
||||||
import { DynamicLookupModel } from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup.model';
|
import { DynamicLookupModel } from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('LookupFieldParser test suite', () => {
|
describe('LookupFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -36,13 +37,13 @@ describe('LookupFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new LookupFieldParser(field, initFormValues, parserOptions);
|
const parser = new LookupFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof LookupFieldParser).toBe(true);
|
expect(parser instanceof LookupFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicLookupModel object when repeatable option is false', () => {
|
it('should return a DynamicLookupModel object when repeatable option is false', () => {
|
||||||
const parser = new LookupFieldParser(field, initFormValues, parserOptions);
|
const parser = new LookupFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ describe('LookupFieldParser test suite', () => {
|
|||||||
};
|
};
|
||||||
const expectedValue = new FormFieldMetadataValueObject('test journal');
|
const expectedValue = new FormFieldMetadataValueObject('test journal');
|
||||||
|
|
||||||
const parser = new LookupFieldParser(field, initFormValues, parserOptions);
|
const parser = new LookupFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ import { DynamicLookupModel } from '../ds-dynamic-form-ui/models/lookup/dynamic-
|
|||||||
import { LookupNameFieldParser } from './lookup-name-field-parser';
|
import { LookupNameFieldParser } from './lookup-name-field-parser';
|
||||||
import { DynamicLookupNameModel } from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
|
import { DynamicLookupNameModel } from '../ds-dynamic-form-ui/models/lookup/dynamic-lookup-name.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('LookupNameFieldParser test suite', () => {
|
describe('LookupNameFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -38,13 +39,13 @@ describe('LookupNameFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new LookupNameFieldParser(field, initFormValues, parserOptions);
|
const parser = new LookupNameFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof LookupNameFieldParser).toBe(true);
|
expect(parser instanceof LookupNameFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicLookupNameModel object when repeatable option is false', () => {
|
it('should return a DynamicLookupNameModel object when repeatable option is false', () => {
|
||||||
const parser = new LookupNameFieldParser(field, initFormValues, parserOptions);
|
const parser = new LookupNameFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ describe('LookupNameFieldParser test suite', () => {
|
|||||||
};
|
};
|
||||||
const expectedValue = new FormFieldMetadataValueObject('test author');
|
const expectedValue = new FormFieldMetadataValueObject('test author');
|
||||||
|
|
||||||
const parser = new LookupNameFieldParser(field, initFormValues, parserOptions);
|
const parser = new LookupNameFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ import { NameFieldParser } from './name-field-parser';
|
|||||||
import { DynamicConcatModel } from '../ds-dynamic-form-ui/models/ds-dynamic-concat.model';
|
import { DynamicConcatModel } from '../ds-dynamic-form-ui/models/ds-dynamic-concat.model';
|
||||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('NameFieldParser test suite', () => {
|
describe('NameFieldParser test suite', () => {
|
||||||
let field1: FormFieldModel;
|
let field1: FormFieldModel;
|
||||||
@@ -69,13 +70,13 @@ describe('NameFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new NameFieldParser(field1, initFormValues, parserOptions);
|
const parser = new NameFieldParser(field1, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof NameFieldParser).toBe(true);
|
expect(parser instanceof NameFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicConcatModel object when repeatable option is false', () => {
|
it('should return a DynamicConcatModel object when repeatable option is false', () => {
|
||||||
const parser = new NameFieldParser(field2, initFormValues, parserOptions);
|
const parser = new NameFieldParser(field2, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ describe('NameFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicConcatModel object with the correct separator', () => {
|
it('should return a DynamicConcatModel object with the correct separator', () => {
|
||||||
const parser = new NameFieldParser(field2, initFormValues, parserOptions);
|
const parser = new NameFieldParser(field2, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ describe('NameFieldParser test suite', () => {
|
|||||||
};
|
};
|
||||||
const expectedValue = new FormFieldMetadataValueObject('test, name');
|
const expectedValue = new FormFieldMetadataValueObject('test, name');
|
||||||
|
|
||||||
const parser = new NameFieldParser(field1, initFormValues, parserOptions);
|
const parser = new NameFieldParser(field1, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -4,6 +4,7 @@ import { DynamicQualdropModel } from '../ds-dynamic-form-ui/models/ds-dynamic-qu
|
|||||||
import { DynamicTypeaheadModel } from '../ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model';
|
import { DynamicTypeaheadModel } from '../ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.model';
|
||||||
import { DsDynamicInputModel } from '../ds-dynamic-form-ui/models/ds-dynamic-input.model';
|
import { DsDynamicInputModel } from '../ds-dynamic-form-ui/models/ds-dynamic-input.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('OneboxFieldParser test suite', () => {
|
describe('OneboxFieldParser test suite', () => {
|
||||||
let field1: FormFieldModel;
|
let field1: FormFieldModel;
|
||||||
@@ -70,13 +71,13 @@ describe('OneboxFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new OneboxFieldParser(field1, initFormValues, parserOptions);
|
const parser = new OneboxFieldParser(field1, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof OneboxFieldParser).toBe(true);
|
expect(parser instanceof OneboxFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicQualdropModel object when selectableMetadata is multiple', () => {
|
it('should return a DynamicQualdropModel object when selectableMetadata is multiple', () => {
|
||||||
const parser = new OneboxFieldParser(field2, initFormValues, parserOptions);
|
const parser = new OneboxFieldParser(field2, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -84,7 +85,7 @@ describe('OneboxFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DsDynamicInputModel object when selectableMetadata is not multiple', () => {
|
it('should return a DsDynamicInputModel object when selectableMetadata is not multiple', () => {
|
||||||
const parser = new OneboxFieldParser(field3, initFormValues, parserOptions);
|
const parser = new OneboxFieldParser(field3, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -92,7 +93,7 @@ describe('OneboxFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicTypeaheadModel object when selectableMetadata has authority', () => {
|
it('should return a DynamicTypeaheadModel object when selectableMetadata has authority', () => {
|
||||||
const parser = new OneboxFieldParser(field1, initFormValues, parserOptions);
|
const parser = new OneboxFieldParser(field1, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ import { RelationGroupFieldParser } from './relation-group-field-parser';
|
|||||||
import { DynamicRelationGroupModel } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
import { DynamicRelationGroupModel } from '../ds-dynamic-form-ui/models/relation-group/dynamic-relation-group.model';
|
||||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('RelationGroupFieldParser test suite', () => {
|
describe('RelationGroupFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -71,13 +72,13 @@ describe('RelationGroupFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions);
|
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof RelationGroupFieldParser).toBe(true);
|
expect(parser instanceof RelationGroupFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicRelationGroupModel object', () => {
|
it('should return a DynamicRelationGroupModel object', () => {
|
||||||
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions);
|
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -86,7 +87,7 @@ describe('RelationGroupFieldParser test suite', () => {
|
|||||||
|
|
||||||
it('should throw when rows configuration is empty', () => {
|
it('should throw when rows configuration is empty', () => {
|
||||||
field.rows = null;
|
field.rows = null;
|
||||||
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions);
|
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(() => parser.parse())
|
expect(() => parser.parse())
|
||||||
.toThrow();
|
.toThrow();
|
||||||
@@ -97,7 +98,7 @@ describe('RelationGroupFieldParser test suite', () => {
|
|||||||
author: [new FormFieldMetadataValueObject('test author')],
|
author: [new FormFieldMetadataValueObject('test author')],
|
||||||
affiliation: [new FormFieldMetadataValueObject('test affiliation')]
|
affiliation: [new FormFieldMetadataValueObject('test affiliation')]
|
||||||
};
|
};
|
||||||
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions);
|
const parser = new RelationGroupFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
const expectedValue = [{
|
const expectedValue = [{
|
||||||
|
@@ -3,6 +3,7 @@ import { RowParser } from './row-parser';
|
|||||||
import { DynamicRowGroupModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
import { DynamicRowGroupModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-group-model';
|
||||||
import { DynamicRowArrayModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
import { DynamicRowArrayModel } from '../ds-dynamic-form-ui/models/ds-dynamic-row-array-model';
|
||||||
import { FormRowModel } from '../../../../core/config/models/config-submission-form.model';
|
import { FormRowModel } from '../../../../core/config/models/config-submission-form.model';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('RowParser test suite', () => {
|
describe('RowParser test suite', () => {
|
||||||
|
|
||||||
@@ -328,49 +329,49 @@ describe('RowParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
let parser = new RowParser(row1, scopeUUID, initFormValues, submissionScope, readOnly);
|
let parser = new RowParser(row1, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row2, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row2, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row3, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row3, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row4, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row4, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row5, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row5, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row6, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row6, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row7, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row7, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row8, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row8, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row9, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row9, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
|
|
||||||
parser = new RowParser(row10, scopeUUID, initFormValues, submissionScope, readOnly);
|
parser = new RowParser(row10, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
expect(parser instanceof RowParser).toBe(true);
|
expect(parser instanceof RowParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicRowGroupModel object', () => {
|
it('should return a DynamicRowGroupModel object', () => {
|
||||||
const parser = new RowParser(row1, scopeUUID, initFormValues, submissionScope, readOnly);
|
const parser = new RowParser(row1, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
const rowModel = parser.parse();
|
const rowModel = parser.parse();
|
||||||
|
|
||||||
@@ -378,7 +379,7 @@ describe('RowParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a row with three fields', () => {
|
it('should return a row with three fields', () => {
|
||||||
const parser = new RowParser(row1, scopeUUID, initFormValues, submissionScope, readOnly);
|
const parser = new RowParser(row1, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
const rowModel = parser.parse();
|
const rowModel = parser.parse();
|
||||||
|
|
||||||
@@ -386,7 +387,7 @@ describe('RowParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicRowArrayModel object', () => {
|
it('should return a DynamicRowArrayModel object', () => {
|
||||||
const parser = new RowParser(row2, scopeUUID, initFormValues, submissionScope, readOnly);
|
const parser = new RowParser(row2, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
const rowModel = parser.parse();
|
const rowModel = parser.parse();
|
||||||
|
|
||||||
@@ -394,7 +395,7 @@ describe('RowParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a row that contains only scoped fields', () => {
|
it('should return a row that contains only scoped fields', () => {
|
||||||
const parser = new RowParser(row3, scopeUUID, initFormValues, submissionScope, readOnly);
|
const parser = new RowParser(row3, scopeUUID, initFormValues, new WorkspaceItem(), submissionScope, readOnly);
|
||||||
|
|
||||||
const rowModel = parser.parse();
|
const rowModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ import { DynamicConcatModel } from '../ds-dynamic-form-ui/models/ds-dynamic-conc
|
|||||||
import { SeriesFieldParser } from './series-field-parser';
|
import { SeriesFieldParser } from './series-field-parser';
|
||||||
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('SeriesFieldParser test suite', () => {
|
describe('SeriesFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -32,13 +33,13 @@ describe('SeriesFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new SeriesFieldParser(field, initFormValues, parserOptions);
|
const parser = new SeriesFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof SeriesFieldParser).toBe(true);
|
expect(parser instanceof SeriesFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicConcatModel object when repeatable option is false', () => {
|
it('should return a DynamicConcatModel object when repeatable option is false', () => {
|
||||||
const parser = new SeriesFieldParser(field, initFormValues, parserOptions);
|
const parser = new SeriesFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ describe('SeriesFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicConcatModel object with the correct separator', () => {
|
it('should return a DynamicConcatModel object with the correct separator', () => {
|
||||||
const parser = new SeriesFieldParser(field, initFormValues, parserOptions);
|
const parser = new SeriesFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ describe('SeriesFieldParser test suite', () => {
|
|||||||
};
|
};
|
||||||
const expectedValue = new FormFieldMetadataValueObject('test; series');
|
const expectedValue = new FormFieldMetadataValueObject('test; series');
|
||||||
|
|
||||||
const parser = new SeriesFieldParser(field, initFormValues, parserOptions);
|
const parser = new SeriesFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ import { FormFieldMetadataValueObject } from '../models/form-field-metadata-valu
|
|||||||
import { TagFieldParser } from './tag-field-parser';
|
import { TagFieldParser } from './tag-field-parser';
|
||||||
import { DynamicTagModel } from '../ds-dynamic-form-ui/models/tag/dynamic-tag.model';
|
import { DynamicTagModel } from '../ds-dynamic-form-ui/models/tag/dynamic-tag.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('TagFieldParser test suite', () => {
|
describe('TagFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -36,13 +37,13 @@ describe('TagFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new TagFieldParser(field, initFormValues, parserOptions);
|
const parser = new TagFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof TagFieldParser).toBe(true);
|
expect(parser instanceof TagFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DynamicTagModel object when repeatable option is false', () => {
|
it('should return a DynamicTagModel object when repeatable option is false', () => {
|
||||||
const parser = new TagFieldParser(field, initFormValues, parserOptions);
|
const parser = new TagFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ describe('TagFieldParser test suite', () => {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const parser = new TagFieldParser(field, initFormValues, parserOptions);
|
const parser = new TagFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -3,6 +3,7 @@ import { FormFieldMetadataValueObject } from '../models/form-field-metadata-valu
|
|||||||
import { TextareaFieldParser } from './textarea-field-parser';
|
import { TextareaFieldParser } from './textarea-field-parser';
|
||||||
import { DsDynamicTextAreaModel } from '../ds-dynamic-form-ui/models/ds-dynamic-textarea.model';
|
import { DsDynamicTextAreaModel } from '../ds-dynamic-form-ui/models/ds-dynamic-textarea.model';
|
||||||
import { ParserOptions } from './parser-options';
|
import { ParserOptions } from './parser-options';
|
||||||
|
import { WorkspaceItem } from '../../../../core/submission/models/workspaceitem.model';
|
||||||
|
|
||||||
describe('TextareaFieldParser test suite', () => {
|
describe('TextareaFieldParser test suite', () => {
|
||||||
let field: FormFieldModel;
|
let field: FormFieldModel;
|
||||||
@@ -34,13 +35,13 @@ describe('TextareaFieldParser test suite', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should init parser properly', () => {
|
it('should init parser properly', () => {
|
||||||
const parser = new TextareaFieldParser(field, initFormValues, parserOptions);
|
const parser = new TextareaFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
expect(parser instanceof TextareaFieldParser).toBe(true);
|
expect(parser instanceof TextareaFieldParser).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return a DsDynamicTextAreaModel object when repeatable option is false', () => {
|
it('should return a DsDynamicTextAreaModel object when repeatable option is false', () => {
|
||||||
const parser = new TextareaFieldParser(field, initFormValues, parserOptions);
|
const parser = new TextareaFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
@@ -55,7 +56,7 @@ describe('TextareaFieldParser test suite', () => {
|
|||||||
};
|
};
|
||||||
const expectedValue ='test description';
|
const expectedValue ='test description';
|
||||||
|
|
||||||
const parser = new TextareaFieldParser(field, initFormValues, parserOptions);
|
const parser = new TextareaFieldParser(field, initFormValues, parserOptions, new WorkspaceItem());
|
||||||
|
|
||||||
const fieldModel = parser.parse();
|
const fieldModel = parser.parse();
|
||||||
|
|
||||||
|
@@ -72,7 +72,7 @@ describe('ItemDetailPreviewComponent', () => {
|
|||||||
fixture = TestBed.createComponent(ItemDetailPreviewComponent);
|
fixture = TestBed.createComponent(ItemDetailPreviewComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
component.object = { hitHighlights: {} } as any;
|
component.object = { hitHighlights: {} } as any;
|
||||||
component.itemRD$ = mockItem;
|
component.item = mockItem;
|
||||||
component.separator = ', ';
|
component.separator = ', ';
|
||||||
spyOn(component.item, 'getFiles').and.returnValue(mockItem.bitstreams);
|
spyOn(component.item, 'getFiles').and.returnValue(mockItem.bitstreams);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@@ -9,6 +9,7 @@ import { PaginatedList } from '../../core/data/paginated-list';
|
|||||||
import { PageInfo } from '../../core/shared/page-info.model';
|
import { PageInfo } from '../../core/shared/page-info.model';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { createSuccessfulRemoteDataObject } from '../testing/utils';
|
import { createSuccessfulRemoteDataObject } from '../testing/utils';
|
||||||
|
import { ListableObject } from '../object-collection/shared/listable-object.model';
|
||||||
|
|
||||||
describe('ObjectDetailComponent', () => {
|
describe('ObjectDetailComponent', () => {
|
||||||
let comp: ObjectDetailComponent;
|
let comp: ObjectDetailComponent;
|
||||||
@@ -16,16 +17,16 @@ describe('ObjectDetailComponent', () => {
|
|||||||
const testEvent = {test: 'test'};
|
const testEvent = {test: 'test'};
|
||||||
|
|
||||||
const testObjects = [
|
const testObjects = [
|
||||||
{ one: 1 },
|
{ one: 1 } as any,
|
||||||
{ two: 2 },
|
{ two: 2 } as any,
|
||||||
{ three: 3 },
|
{ three: 3 } as any,
|
||||||
{ four: 4 },
|
{ four: 4 } as any,
|
||||||
{ five: 5 },
|
{ five: 5 } as any,
|
||||||
{ six: 6 },
|
{ six: 6 } as any,
|
||||||
{ seven: 7 },
|
{ seven: 7 } as any,
|
||||||
{ eight: 8 },
|
{ eight: 8 } as any,
|
||||||
{ nine: 9 },
|
{ nine: 9 } as any,
|
||||||
{ ten: 10 }
|
{ ten: 10 } as any
|
||||||
];
|
];
|
||||||
const pageInfo = Object.assign(new PageInfo(), {elementsPerPage: 1, totalElements: 10, totalPages: 10, currentPage: 1})
|
const pageInfo = Object.assign(new PageInfo(), {elementsPerPage: 1, totalElements: 10, totalPages: 10, currentPage: 1})
|
||||||
const mockRD = createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, testObjects));
|
const mockRD = createSuccessfulRemoteDataObject(new PaginatedList(pageInfo, testObjects));
|
||||||
|
@@ -10,7 +10,6 @@ import { FormsModule } from '@angular/forms';
|
|||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { SearchService } from '../../../../../core/shared/search/search.service';
|
import { SearchService } from '../../../../../core/shared/search/search.service';
|
||||||
import { SearchServiceStub } from '../../../../testing/search-service-stub';
|
import { SearchServiceStub } from '../../../../testing/search-service-stub';
|
||||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
|
||||||
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
import { PaginatedList } from '../../../../../core/data/paginated-list';
|
||||||
import { RouterStub } from '../../../../testing/router-stub';
|
import { RouterStub } from '../../../../testing/router-stub';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
@@ -19,8 +18,7 @@ import { SearchFacetFilterComponent } from './search-facet-filter.component';
|
|||||||
import { RemoteDataBuildService } from '../../../../../core/cache/builders/remote-data-build.service';
|
import { RemoteDataBuildService } from '../../../../../core/cache/builders/remote-data-build.service';
|
||||||
import { SearchConfigurationServiceStub } from '../../../../testing/search-configuration-service-stub';
|
import { SearchConfigurationServiceStub } from '../../../../testing/search-configuration-service-stub';
|
||||||
import { SEARCH_CONFIG_SERVICE } from '../../../../../+my-dspace-page/my-dspace-page.component';
|
import { SEARCH_CONFIG_SERVICE } from '../../../../../+my-dspace-page/my-dspace-page.component';
|
||||||
import { tap } from 'rxjs/operators';
|
import { createSuccessfulRemoteDataObject$ } from '../../../../testing/utils';
|
||||||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
|
|
||||||
|
|
||||||
describe('SearchFacetFilterComponent', () => {
|
describe('SearchFacetFilterComponent', () => {
|
||||||
let comp: SearchFacetFilterComponent;
|
let comp: SearchFacetFilterComponent;
|
||||||
|
Reference in New Issue
Block a user