From 1ff51c20b1825da17be161d15417d6995a8d4227 Mon Sep 17 00:00:00 2001
From: Albert <Albert.Bruns@mgm-tp.com>
Date: Thu, 3 Apr 2025 19:21:56 +0200
Subject: [PATCH] OZG-7974 small fix

---
 .../lib/form/formcontrol-editor.abstract.component.spec.ts  | 6 ------
 .../src/lib/form/formcontrol-editor.abstract.component.ts   | 5 +++--
 2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.spec.ts b/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.spec.ts
index 210d995986..cee669970f 100644
--- a/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.spec.ts
+++ b/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.spec.ts
@@ -28,12 +28,6 @@ describe('FormControlEditorAbstractComponent', () => {
     fixture.detectChanges();
   });
 
-  describe('constructor', () => {
-    it('should set control value accessor', () => {
-      expect(component.control.valueAccessor).toBe(component);
-    });
-  });
-
   describe('ng on init', () => {
     it('should set valueChange subscription', () => {
       component.ngOnInit();
diff --git a/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.ts b/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.ts
index 29b75f0e5b..6e07be87f8 100644
--- a/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.ts
+++ b/alfa-client/libs/design-component/src/lib/form/formcontrol-editor.abstract.component.ts
@@ -42,12 +42,13 @@ export abstract class FormControlEditorAbstractComponent implements ControlValue
 
   constructor(@Self() @Optional() public control: NgControl | null) {
     if (this.control) this.control.valueAccessor = this;
+  }
+
+  ngOnInit(): void {
     this._changesSubscr = this.fieldControl.valueChanges.subscribe((value: unknown) => {
       this._fieldControlOnChangeHandler(value);
     });
-  }
 
-  ngOnInit(): void {
     if (this.control) {
       this._statusSubscr = this.control.statusChanges.subscribe(() => {
         this.setErrors();
-- 
GitLab