Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
angular2中的ag网格单元测试-fixture.nativeElement.query不是函数_Angular_Karma Jasmine_Ag Grid - Fatal编程技术网

angular2中的ag网格单元测试-fixture.nativeElement.query不是函数

angular2中的ag网格单元测试-fixture.nativeElement.query不是函数,angular,karma-jasmine,ag-grid,Angular,Karma Jasmine,Ag Grid,我在angular中使用Karma/Jasmine为ag grid编写了一个测试用例。在我的测试用例中,只是检查ag网格头并得到错误,比如“fixture.nativeElement.query不是一个函数”,但我对我编写的方法是否正确没有足够的信心。如果有人有想法,请帮助我 这是我的测试用例 it('测试列标题',()=>{ fixture.nativeElement.query(By.css(“.ag fresh”)) .map(函数(标题){ 返回header.getText() }).

我在angular中使用Karma/Jasmine为ag grid编写了一个测试用例。在我的测试用例中,只是检查ag网格头并得到错误,比如“fixture.nativeElement.query不是一个函数”,但我对我编写的方法是否正确没有足够的信心。如果有人有想法,请帮助我

这是我的测试用例

it('测试列标题',()=>{
fixture.nativeElement.query(By.css(“.ag fresh”))
.map(函数(标题){
返回header.getText()
}).then(函数(标题){
expect(headers).toEqual(['color','qty','price']);
});

});
您应该在
fixture.debugElement
上使用
query()
。而且我认为你不需要把结果映射到这里


fixture.debugElement.query(By.css(“.ag fresh”)).nativeElement
应该为您做这件事。

他们的任何源链接都可以使用Jasmine/Karma进行ag网格单元测试。