Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

338
Views
Angular: pruebe la habilitación del control de forma reactiva en los cambios de valor

Tengo que probar si algunos controles están habilitados.

 ngOnChanges(): void { this.form.get('menuVisibility').valueChanges.subscribe((visible: boolean) => { ['userIdVisibility', 'userOptionsVisibility', 'languageVisibility'].forEach((controlName) => { if (visible) { this.form.controls[controlName].enable(); } else { this.form.controls[controlName].disable(); } }); }); }

Escribí esta SPEC:

 it('should dispatch action for valueChanges', fakeAsync(() => { component.form.get('menuVisibility').setValue(true); component.form.get('menuVisibility').updateValueAndValidity({ emitEvent: true }); component.ngOnChanges(); tick(); expect(component.form.get('userIdVisibility').enabled).toBeTruthy(); expect(component.form.get('userOptionsVisibility').enabled).toBeTruthy(); expect(component.form.get('languageVisibility').enabled).toBeTruthy(); }));

Pero la prueba nunca entra en el bloque forEach.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!