【发布时间】:2019-06-28 12:09:04
【问题描述】:
export class ComponentDetailsComponent implements OnInit {
@ViewChild('treeGridReference') treeGrid: jqxTreeGridComponent;
....more code....
this.treeGrid.clearSelection();// how do I mock this?
}
如果它是一个构造函数依赖项,我可以使用空的clearSelection 方法为jqxTreeGridComponent 创建一个存根,类似于:
class jqxTreeGridComponentStub{
clearSelection(){}
}
}
{ provide: jqxTreeGridComponent, useClass: jqxTreeGridComponentStub },
【问题讨论】:
标签: javascript angular typescript unit-testing jasmine