我有这个方法来验证组件,它正在调用另一个组件,就是它ViewChild.我正在this.ViewChildComponent.someMethod();尝试测试的组件中使用组件.我试着用spyOn(viewChildComponent, 'someMethod').and.returnValue(true).但它说this.ViewChildComponent.someMethod() is undefined.我有所有的依赖项,例如提供ViewChildComponent者的服务.我甚至前进了一步,并致电viewChildComponent其服务决定someMethod();
任何帮助都是极好的.