title: How to unit test with Jasmine when FormGroup is set to disabled?
body: <p>I havea a angular 8 application  and I am using Jasmine Karma for unit testing. And I want to test a Formbuilder that is disabled in the NgOninit function:</p>
  <p>I have it like this: component.ts</p>
  <pre><code>constructor(
      private dossierService: DossierService,
      private route: ActivatedRoute,
      private sanitizer: DomSanitizer,
      private dossierFileService: DossierFileService,
      private errorProcessor: ErrorProcessor,
      private dialog: MatDialog
    ) {
      this.dossierItems = this.route.snapshot.data.dossierItems;
      this.editDossierForm = this.formBuilder.group({});
      this.editDossierForm.disable();
   
      this.dossier = this.route.snapshot.data.dossier;
      this.dossierItems = route.snapshot.data.dossierItems;
      this.profileImagefile = this.route.snapshot.data.profileImage;
   
      this.editDossierForm = this.formBuilder.group({
        firstName: this.formBuilder.control(this.dossier.firstName, [Validators.required, Validators.maxLength(255)]),
        lastName: this.formBuilder.control(this.dossier.lastName, [Validators.required, Validators.maxLength(255)]),
        mobile: this.formBuilder.control(this.dossier.mobile, [Validators.maxLength(255)]),
        company: this.formBuilder.control(this.dossier.company, [Validators.maxLength(255)]),
        buddy: this.formBuilder.control(this.dossier.buddy, [Validators.maxLength(255)]),
        supervisor: this.formBuilder.control(this.dossier.supervisor, [Validators.maxLength(255)]),
        dateOfBirth: this.formBuilder.control(this.dossier.dateOfBirth)
      });
    }
    ngOnInit(): void {
      this.editDossierForm.disable();
    }
  }
  </code></pre>
  <p>and this is the spec file of it:</p>
  <pre><code>
  describe('DossierPersonalDataComponent', () =&gt; {
    let component: DossierPersonalDataComponent;
    let fixture: ComponentFixture&lt;DossierPersonalDataComponent&gt;;
  
    beforeEach(async(() =&gt; {
  
  
      TestBed.configureTestingModule({
        imports: [HttpClientTestingModule, DossierModule, BrowserModule],
        declarations: [DossierPersonalDataComponent],
        providers: [
            DossierFileService,
            ErrorProcessor,
            {
              provide: ActivatedRoute,
              useValue: {
                snapshot: {
                  data: {
                    dossier: {
                      firstName: 'hello',
                      lastName: 'world',
                      mobile: '111-111-1111',
                      company: 'carapax',
                      buddy: 'bud',
                      supervisor: 'super',
                      dateOfBirth: '1900-01-01',
                    },
                    dossierItems: [], // mock
                    profileImage: '',
                  }
                }
              }
            },
          {
            // DossierFileService, These have to be outside of the braces
            // ErrorProcessor,
  
            provide: DomSanitizer,
            useValue: {
              sanitize: () =&gt; 'safeString',
              bypassSecurityTrustHtml: () =&gt; 'safeString'
            }
          }
        ]
      })
        .compileComponents()
        .then(() =&gt; {
          fixture = TestBed.createComponent(DossierPersonalDataComponent);
          component = fixture.componentInstance;
        });
    }));
  
  
    it('should create', () =&gt; {
      expect(component).toBeTruthy();
    });
  });
  
  </code></pre>
  <p>but in the instanbul coverage rapport this stays red:</p>
  <pre><code>  }
    ngOnInit(): void {
      this.editDossierForm.disable();
    }
  </code></pre>
  <p>So how to coverage this part?</p>
  <p>Thank you</p>
  <p>oke,</p>
  <p>if I do it like this:</p>
  <pre><code>  it('should create', () =&gt; {    
      fixture.detectChanges();
      expect(component).toBeTruthy();
    });
  
  </code></pre>
  <p>I get this error:</p>
  <pre><code>DossierPersonalDataComponent &gt; should create
  TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
  </code></pre>
  <p>and in my tesspec, I see this:</p>
  <pre><code> get profileImageUrl() {
      return this.profileImagefile === null
        ? '/assets/placeholder.jpg'
        : this.sanitizer.bypassSecurityTrustUrl(window.URL.createObjectURL(this.profileImagefile));
    }
  </code></pre>
  <p>and this line:</p>
  <pre><code> ? '/assets/placeholder.jpg'
  </code></pre>
  <p>is in yellow. Branch not covered.</p>