From c335a46ce34b4c91b4234dfa905dd1b9eb10ede6 Mon Sep 17 00:00:00 2001
From: "Zickermann, Jan" <jan.zickermann@dataport.de>
Date: Wed, 28 Feb 2024 15:32:33 +0100
Subject: [PATCH] OZG-4948 Remove button disabled on submit

---
 .../postfach-form.component.html              |  1 -
 .../postfach-form.component.spec.ts           | 20 +------------------
 .../postfach-form/postfach-form.component.ts  |  7 +------
 3 files changed, 2 insertions(+), 26 deletions(-)

diff --git a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.html b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.html
index 1810d16569..4ddfd2b7a9 100644
--- a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.html
+++ b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.html
@@ -45,7 +45,6 @@
 
   <button
     (click)="submit()"
-    [disabled]="isSubmitting"
     data-test-id="save-button"
     class="bg-ozgblue-700 hover:bg-ozgblue-600 active:bg-ozgblue-600/90 focus-visible:outline-ozgblue-800 rounded-md px-3 py-2 text-sm font-semibold text-white shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"
   >
diff --git a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.spec.ts b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.spec.ts
index b71dc55347..ee99eb6160 100644
--- a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.spec.ts
+++ b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.spec.ts
@@ -74,7 +74,7 @@ describe('PostfachFormComponent', () => {
     it('should use form control for signatur-text', () => {
       const someText = 'some signatur text';
 
-      form.get(PostfachFormService.SIGNATUR_FIELD)!!.setValue(someText);
+      form.get(PostfachFormService.SIGNATUR_FIELD).setValue(someText);
 
       const signatur = getElementFromFixture(fixture, signaturTextarea);
       expect(signatur.value).toBe(someText);
@@ -89,23 +89,5 @@ describe('PostfachFormComponent', () => {
 
       expect(component.submit).toHaveBeenCalled();
     });
-
-    it('should be enabled', () => {
-      component.isSubmitting = false;
-
-      fixture.detectChanges();
-
-      const buttonElement: HTMLButtonElement = getElementFromFixture(fixture, saveButton);
-      expect(buttonElement.disabled).toBe(false);
-    });
-
-    it('should be disabled during submit', () => {
-      component.isSubmitting = true;
-
-      fixture.detectChanges();
-
-      const buttonElement: HTMLButtonElement = getElementFromFixture(fixture, saveButton);
-      expect(buttonElement.disabled).toBe(true);
-    });
   });
 });
diff --git a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts
index ed07440a3a..0a56b56ad8 100644
--- a/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts
+++ b/alfa-client/libs/admin-settings/src/lib/postfach/postfach-container/postfach-form/postfach-form.component.ts
@@ -8,16 +8,11 @@ import { PostfachFormService } from './postfach.formservice';
   providers: [PostfachFormService],
 })
 export class PostfachFormComponent {
-  public isSubmitting = false;
-
   constructor(public formService: PostfachFormService) {}
 
   protected readonly PostfachFormService = PostfachFormService;
 
   submit() {
-    this.isSubmitting = true;
-    this.formService.submit().subscribe(() => {
-      this.isSubmitting = false;
-    });
+    this.formService.submit();
   }
 }
-- 
GitLab