diff --git a/src/app/access-control/group-registry/group-form/group-form.component.spec.ts b/src/app/access-control/group-registry/group-form/group-form.component.spec.ts index 86ee5e725e3..96f1b861520 100644 --- a/src/app/access-control/group-registry/group-form/group-form.component.spec.ts +++ b/src/app/access-control/group-registry/group-form/group-form.component.spec.ts @@ -3,7 +3,9 @@ import { HttpClient } from '@angular/common/http'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, + fakeAsync, TestBed, + tick, waitForAsync, } from '@angular/core/testing'; import { @@ -335,6 +337,19 @@ describe('GroupFormComponent', () => { component.ngOnInit(); }); + it('should update the form fields with the new values after successful edit', fakeAsync(() => { + component.groupName.setValue('newGroupName'); + component.groupDescription.setValue(groupDescription); + + component.onSubmit(); + tick(); + + expect(component.formGroup.value.groupName).toBe(expected2.name); + expect(component.formGroup.value.groupDescription).toBe( + expected2.firstMetadataValue('dc.description'), + ); + })); + it('should edit with name and description operations', () => { component.groupName.setValue('newGroupName'); component.onSubmit(); diff --git a/src/app/access-control/group-registry/group-form/group-form.component.ts b/src/app/access-control/group-registry/group-form/group-form.component.ts index 1f64df08bc0..5a6e1be4eee 100644 --- a/src/app/access-control/group-registry/group-form/group-form.component.ts +++ b/src/app/access-control/group-registry/group-form/group-form.component.ts @@ -414,6 +414,16 @@ export class GroupFormComponent implements OnInit, OnDestroy { getFirstCompletedRemoteData(), ).subscribe((rd: RemoteData) => { if (rd.hasSucceeded) { + + const updatedGroup = rd.payload; + + this.groupRegistryService.editGroup(updatedGroup); + + this.formGroup.patchValue({ + groupName: updatedGroup.name, + groupDescription: updatedGroup.firstMetadataValue('dc.description'), + }); + this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.edited.success', { name: this.dsoNameService.getName(rd.payload) })); this.submitForm.emit(rd.payload); } else {