mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
Merge branch 'master' into submission-miscellaneous-fixes
This commit is contained in:
@@ -34,7 +34,6 @@ import { CommonModule } from '@angular/common';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { FormComponent } from '../../../shared/form/form.component';
|
||||
import { FormFieldModel } from '../../../shared/form/builder/models/form-field.model';
|
||||
import { FormRowModel } from '../../../core/config/models/config-submission-forms.model';
|
||||
import { ConfigData } from '../../../core/config/config-data';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import { FormFieldMetadataValueObject } from '../../../shared/form/builder/models/form-field-metadata-value.model';
|
||||
@@ -43,6 +42,7 @@ import { DsDynamicInputModel } from '../../../shared/form/builder/ds-dynamic-for
|
||||
import { SubmissionSectionError } from '../../objects/submission-objects.reducer';
|
||||
import { DynamicFormControlEvent, DynamicFormControlEventType } from '@ng-dynamic-forms/core';
|
||||
import { JsonPatchOperationPathCombiner } from '../../../core/json-patch/builder/json-patch-operation-path-combiner';
|
||||
import { FormRowModel } from '../../../core/config/models/config-submission-form.model';
|
||||
|
||||
function getMockSubmissionFormsConfigService(): SubmissionFormsConfigService {
|
||||
return jasmine.createSpyObj('FormOperationsService', {
|
||||
|
@@ -6,9 +6,13 @@ import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing'
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { DynamicCheckboxModel, DynamicFormControlEvent, DynamicFormControlEventType } from '@ng-dynamic-forms/core';
|
||||
import {
|
||||
DynamicCheckboxModel,
|
||||
DynamicFormControlEvent,
|
||||
DynamicFormControlEventType
|
||||
} from '@ng-dynamic-forms/core';
|
||||
|
||||
import { createTestComponent } from '../../../shared/testing/utils';
|
||||
import { createSuccessfulRemoteDataObject$, createTestComponent } from '../../../shared/testing/utils';
|
||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||
import { NotificationsServiceStub } from '../../../shared/testing/notifications-service-stub';
|
||||
import { SubmissionService } from '../../submission.service';
|
||||
@@ -109,8 +113,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
language: 'en_US',
|
||||
value: 'Community 1-Collection 1'
|
||||
}],
|
||||
license: observableOf(new RemoteData(false, false, true,
|
||||
undefined, Object.assign(new License(), { text: licenseText })))
|
||||
license: createSuccessfulRemoteDataObject$(Object.assign(new License(), { text: licenseText }))
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
@@ -193,8 +196,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
});
|
||||
|
||||
it('should init section properly', () => {
|
||||
collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
|
||||
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
|
||||
spyOn(compAsAny, 'getSectionStatus');
|
||||
@@ -219,8 +221,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
granted: true
|
||||
} as any;
|
||||
|
||||
collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
|
||||
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
|
||||
spyOn(compAsAny, 'getSectionStatus');
|
||||
@@ -239,8 +240,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
});
|
||||
|
||||
it('should set section errors properly', () => {
|
||||
collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf(mockLicenseParsedErrors.license));
|
||||
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
|
||||
|
||||
@@ -259,8 +259,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
granted: true
|
||||
} as any;
|
||||
|
||||
collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf(mockLicenseParsedErrors.license));
|
||||
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
|
||||
|
||||
@@ -272,8 +271,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
|
||||
it('should have status true when checkbox is selected', () => {
|
||||
|
||||
collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
|
||||
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
|
||||
|
||||
@@ -289,8 +287,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
|
||||
it('should have status false when checkbox is not selected', () => {
|
||||
|
||||
collectionDataService.findById.and.returnValue(observableOf(new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
sectionsServiceStub.getSectionErrors.and.returnValue(observableOf([]));
|
||||
sectionsServiceStub.isSectionReadOnly.and.returnValue(observableOf(false));
|
||||
|
||||
|
@@ -4,7 +4,7 @@ import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { of as observableOf } from 'rxjs';
|
||||
|
||||
import { createTestComponent } from '../../../shared/testing/utils';
|
||||
import { createSuccessfulRemoteDataObject$, createTestComponent } from '../../../shared/testing/utils';
|
||||
import { SubmissionService } from '../../submission.service';
|
||||
import { SubmissionServiceStub } from '../../../shared/testing/submission-service-stub';
|
||||
import { SectionsService } from '../sections.service';
|
||||
@@ -189,24 +189,17 @@ describe('SubmissionSectionUploadComponent test suite', () => {
|
||||
|
||||
submissionServiceStub.getSubmissionObject.and.returnValue(observableOf(submissionState));
|
||||
|
||||
collectionDataService.findById.and.returnValue(observableOf(
|
||||
new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
|
||||
resourcePolicyService.findByHref.and.returnValue(observableOf(
|
||||
new RemoteData(false, false, true,
|
||||
undefined, mockDefaultAccessCondition)
|
||||
));
|
||||
resourcePolicyService.findByHref.and.returnValue(createSuccessfulRemoteDataObject$(mockDefaultAccessCondition));
|
||||
|
||||
uploadsConfigService.getConfigByHref.and.returnValue(observableOf(
|
||||
new ConfigData(new PageInfo(), mockUploadConfigResponse as any)
|
||||
));
|
||||
|
||||
groupService.findById.and.returnValues(
|
||||
observableOf(new RemoteData(false, false, true,
|
||||
undefined, Object.assign(new Group(), mockGroup))),
|
||||
observableOf(new RemoteData(false, false, true,
|
||||
undefined, Object.assign(new Group(), mockGroup)))
|
||||
createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup)),
|
||||
createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup))
|
||||
);
|
||||
|
||||
bitstreamService.getUploadedFileList.and.returnValue(observableOf([]));
|
||||
@@ -235,24 +228,17 @@ describe('SubmissionSectionUploadComponent test suite', () => {
|
||||
|
||||
submissionServiceStub.getSubmissionObject.and.returnValue(observableOf(submissionState));
|
||||
|
||||
collectionDataService.findById.and.returnValue(observableOf(
|
||||
new RemoteData(false, false, true,
|
||||
undefined, mockCollection)));
|
||||
collectionDataService.findById.and.returnValue(createSuccessfulRemoteDataObject$(mockCollection));
|
||||
|
||||
resourcePolicyService.findByHref.and.returnValue(observableOf(
|
||||
new RemoteData(false, false, true,
|
||||
undefined, mockDefaultAccessCondition)
|
||||
));
|
||||
resourcePolicyService.findByHref.and.returnValue(createSuccessfulRemoteDataObject$(mockDefaultAccessCondition));
|
||||
|
||||
uploadsConfigService.getConfigByHref.and.returnValue(observableOf(
|
||||
new ConfigData(new PageInfo(), mockUploadConfigResponse as any)
|
||||
));
|
||||
|
||||
groupService.findById.and.returnValues(
|
||||
observableOf(new RemoteData(false, false, true,
|
||||
undefined, Object.assign(new Group(), mockGroup))),
|
||||
observableOf(new RemoteData(false, false, true,
|
||||
undefined, Object.assign(new Group(), mockGroup)))
|
||||
createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup)),
|
||||
createSuccessfulRemoteDataObject$(Object.assign(new Group(), mockGroup))
|
||||
);
|
||||
|
||||
bitstreamService.getUploadedFileList.and.returnValue(observableOf(mockUploadFiles));
|
||||
|
Reference in New Issue
Block a user