Skip to content
Snippets Groups Projects
Commit c09ae932 authored by Jan Zickermann's avatar Jan Zickermann
Browse files

OZG-4995 Fix bad OE form update

parent 2a86c9fe
No related branches found
No related tags found
No related merge requests found
......@@ -263,6 +263,14 @@ describe('OrganisationseinheitFormService', () => {
describe('patch', () => {
const organisationseinheit: Organisationseinheit = createOrganisationseinheit();
it('should reset', () => {
formService.reset = jest.fn();
formService.patch(organisationseinheit);
expect(formService.reset).toHaveBeenCalled();
});
it('should set source', () => {
formService.patch(organisationseinheit);
......@@ -305,6 +313,14 @@ describe('OrganisationseinheitFormService', () => {
});
describe('reset', () => {
it('should set source to null', () => {
formService.form.reset = jest.fn();
formService.reset();
expect(formService.source).toBeNull();
});
it('should call form reset', () => {
formService.form.reset = jest.fn();
......
......@@ -119,6 +119,7 @@ export class OrganisationseinheitFormservice {
}
public patch(organisationseinheit: Organisationseinheit): void {
this.reset();
this.source = organisationseinheit;
this.form.patchValue({
[OrganisationseinheitFormservice.ORGANISATIONSEINHEIT_NAME_FIELD]: organisationseinheit.name,
......@@ -128,6 +129,7 @@ export class OrganisationseinheitFormservice {
}
public reset(): void {
this.source = null;
this.form.reset();
this.form.markAsUntouched();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment