mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
[835] Auto-save in new Item Submission form breaks the form
Methods renaming
This commit is contained in:
@@ -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')]"
|
||||
|
@@ -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');
|
||||
|
@@ -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>
|
||||
|
@@ -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'));
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user