[835] Auto-save in new Item Submission form breaks the form

Methods renaming
This commit is contained in:
Alessandro Martelli
2020-12-15 10:35:55 +01:00
parent 0794c50d19
commit 451881ef08
7 changed files with 10 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
[formId]="formId"
[group]="formGroup"
[hasErrorMessaging]="model.hasErrorMessages"
[hidden]="model.hidden"
[hidden]="model.hidden"linke
[layout]="formLayout"
[model]="model"
[ngClass]="[getClass(model, 'element', 'host'), getClass(model, 'grid', 'host')]"

View File

@@ -20,7 +20,7 @@ export class SubmissionServiceStub {
getSubmissionStatus = jasmine.createSpy('getSubmissionStatus');
getSubmissionSaveProcessingStatus = jasmine.createSpy('getSubmissionSaveProcessingStatus');
getSubmissionDepositProcessingStatus = jasmine.createSpy('getSubmissionDepositProcessingStatus');
hasNotSavedModification = jasmine.createSpy('hasNotSavedModification');
hasUnsavedModification = jasmine.createSpy('hasUnsavedModification');
isSectionHidden = jasmine.createSpy('isSectionHidden');
isSubmissionLoading = jasmine.createSpy('isSubmissionLoading');
notifyNewSection = jasmine.createSpy('notifyNewSection');

View File

@@ -12,7 +12,7 @@
<button type="button"
class="btn btn-info"
id="save"
[disabled]="(processingSaveStatus | async) || !(hasNotSavedModification | async)"
[disabled]="(processingSaveStatus | async) || !(hasUnsavedModification | async)"
(click)="save($event)">
<span>{{'submission.general.save' | translate}}</span>
</button>

View File

@@ -225,7 +225,7 @@ describe('SubmissionFormFooterComponent Component', () => {
});
it('should disable save button when all modifications had been saved', () => {
comp.hasNotSavedModification = observableOf(false);
comp.hasUnsavedModification = observableOf(false);
fixture.detectChanges();
const saveBtn: any = fixture.debugElement.query(By.css('#save'));
@@ -233,7 +233,7 @@ describe('SubmissionFormFooterComponent Component', () => {
});
it('should enable save button when there are not saved modifications', () => {
comp.hasNotSavedModification = observableOf(true);
comp.hasUnsavedModification = observableOf(true);
fixture.detectChanges();
const saveBtn: any = fixture.debugElement.query(By.css('#save'));

View File

@@ -52,7 +52,7 @@ export class SubmissionFormFooterComponent implements OnChanges {
/**
* A boolean representing if submission form has unsaved modifications
*/
public hasNotSavedModification: Observable<boolean>;
public hasUnsavedModification: Observable<boolean>;
/**
* Initialize instance variables
@@ -78,7 +78,7 @@ export class SubmissionFormFooterComponent implements OnChanges {
this.processingSaveStatus = this.submissionService.getSubmissionSaveProcessingStatus(this.submissionId);
this.processingDepositStatus = this.submissionService.getSubmissionDepositProcessingStatus(this.submissionId);
this.showDepositAndDiscard = observableOf(this.submissionService.getSubmissionScope() === SubmissionScopeType.WorkspaceItem);
this.hasNotSavedModification = this.submissionService.hasNotSavedModification();
this.hasUnsavedModification = this.submissionService.hasUnsavedModification();
}
}

View File

@@ -757,13 +757,13 @@ describe('SubmissionService test suite', () => {
});
});
describe('hasNotSavedModification', () => {
describe('hasUnsavedModification', () => {
it('should call jsonPatchOperationService hasPendingOperation observable', () => {
(service as any).jsonPatchOperationService.hasPendingOperations = jasmine.createSpy('hasPendingOperations')
.and.returnValue(observableOf(true));
scheduler = getTestScheduler();
scheduler.schedule(() => service.hasNotSavedModification());
scheduler.schedule(() => service.hasUnsavedModification());
scheduler.flush();
expect((service as any).jsonPatchOperationService.hasPendingOperations).toHaveBeenCalledWith('sections');

View File

@@ -437,7 +437,7 @@ export class SubmissionService {
* @return Observable<boolean>
* observable with submission unsaved modification presence
*/
hasNotSavedModification(): Observable<boolean> {
hasUnsavedModification(): Observable<boolean> {
return this.jsonPatchOperationService.hasPendingOperations('sections');
}