TSK-614 BUG to allow update empty wbAccessItems

- Update accesItemsClone onReset access items form.
This commit is contained in:
Martin Rojas Miguel Angel 2018-07-04 15:52:21 +02:00 committed by Holger Hagen
parent 9f2aa0a03f
commit f54c1319dd
2 changed files with 12 additions and 1 deletions

View File

@ -129,4 +129,14 @@ describe('AccessItemsComponent', () => {
new AlertModel(AlertType.SUCCESS, `Workbasket ${component.workbasket.key} Access items were saved successfully`));
});
it('should keep accessItemsClone length to previous value after clearing the form.', () => {
expect(component.accessItemsClone.length).toBe(2);
component.remove(1);
expect(component.accessItemsClone.length).toBe(1);
component.clear();
expect(component.accessItemsClone.length).toBe(2);
});
});

View File

@ -130,9 +130,10 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
}
clear() {
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'))
this.AccessItemsForm.reset();
this.setAccessItemsGroups(this.accessItemsResetClone);
this.accessItemsClone = this.cloneAccessItems(this.accessItemsResetClone);
this.alertService.triggerAlert(new AlertModel(AlertType.INFO, 'Reset edited fields'))
}
remove(index: number) {