我有ViewChild
和set content
。
我想知道如何使用单元测试来测试这段代码。
此图片是代码覆盖率
@ViewChild(MatSort) set content(content: ElementRef) {
this.sort = content;
Iif (this.sort) {
this.historyReport.sort = this.sort;
}
}
答案 0 :(得分:1)
在依赖项中添加MatSortModule,将为您提供帮助
imports: [MatSortModule],
declarations: [],
providers: [
]
}).compileComponents();```