TSK-614 BUG Update accesItemsClone onReset access items form.

- Update accesItemsClone onReset access items form.
This commit is contained in:
Miguel Martin Rojas 2018-07-04 15:43:02 +02:00
parent 8af86d5b9d
commit 97133761fd
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) {