Angular2 karma测试集@输入变量
我正在运行angular2单元测试。该组件具有输入绑定。 我尝试手动设置,如下所示:Angular2 karma测试集@输入变量,angular,angular2-testing,Angular,Angular2 Testing,我正在运行angular2单元测试。该组件具有输入绑定。 我尝试手动设置,如下所示: fixture = TestBed.createComponent(Step2Component); component = fixture.componentInstance; component.notificationModel = new NotificationModel([], 'test'); fixture.detectChanges(); 但它失败了。在第一行,调用组件的ngOnInit,
fixture = TestBed.createComponent(Step2Component);
component = fixture.componentInstance;
component.notificationModel = new NotificationModel([], 'test');
fixture.detectChanges();
但它失败了。在第一行,调用组件的ngOnInit,然后使用NotificationModel。在这一点上,该变量未设置。
设置绑定变量的正确方法是什么
谢谢