在这种情况下如何对 Material stepper 进行单元测试:
export class FooComponent implements OnInit {
@ViewChild('stepper') stepper: MatStepper;
}
bar() {
this.stepper.selectedIndex = 1;
}
}
这会起作用,但是当使用 Jasmine 测试组件时,我会得到:
TypeError:无法设置未定义的属性“selectedIndex”
我应该注意,在测试MatStepperModule
中是在进口中。