在我的代码中,我想为父组件中的函数编写一个测试用例。因为我正在为子组件中的属性设置一个值,所以在为父组件运行karma套件时,我得到一个类似属性(子组件)的错误。
In parentcomponent.ts
@Viewchildren(Childcomponent) childcomp : Childcomponent
getstatus()
{
this.childcomp.empconfig1 = this.empconfig ( value in parent comp)
}
现在在运行父组件的测试用例时,我的empconfig1未定义。
如何在父spec.ts文件中为此子组件编写模拟组件,并将值设置为子组件的 empconfig1