Digamos que tengo un Componente Angular 2 con dos parámetros de entrada:
@Component{... (omitted for clarity)} export class SomeComponent { @Input() a: number @Input() b: number }Cuando quiero probar este componente tengo algo como:
beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ SomeComponent, ], }) .compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(SomeComponent); component = fixture.componentInstance; fixture.detectChanges(); }); La llamada a createComponent no toma ningún parámetro ni me permite llamar al constructor. ¿Cómo puedo instanciar/probar el componente para varios valores numéricos?
Como señaló JB Nizet, cuando un componente tiene parámetros @input, debe iniciarlos en beforeEach() : ```
beforeEach(() => { fixture = TestBed.createComponent(SomeComponent); component = fixture.componentInstance; component.a = 1; component.b = 2; fixture.detectChanges(); });```