Imagine having an Angular 2 Component containing two input parameters:
@Component{... (omitted for clarity)}
export class SomeComponent {
@Input() a: number
@Input() b: number
}
When needing to test this component, the process typically involves something like:
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
SomeComponent,
],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
The createComponent
method doesn't allow passing any parameters or calling the constructor. How can one go about instantiating/testing the component with different number values?