相关疑难解决方法(0)

$ browser. $$ checkUrlChange在茉莉花测试中未定义

我有以下测试:

it('should maintain a bind between the data at the $scope to the data at the ingredientsService', function(){
    $scope.addFilters('val1', $scope.customFiltersData, 'filter1');
    $scope.$digest();
    expect($scope.customFiltersData).toEqual(ingredientsService.filters());
});
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

TypeError: undefined is not a function
    at Scope.$digest (/home/oleg/dev/vita-webapp-new/bower_components/angular/angular.js:12502:17)
    at null.<anonymous> (/home/oleg/dev/vita-webapp-new/test/spec/controllers/customfilters.js:92:20)
Run Code Online (Sandbox Code Playgroud)

调试时我看到$browser.$$checkUrlChange上线12502angular.js确实是不确定的.

作为临时解决方案,我将在线调用更改1250$browser.$$checkUrlChange && $browser.$$checkUrlChange()

但我不禁想知道这个猴子补丁是否会以其他方式伤害我.

任何关于如何正确解决这个问题的线索都非常感谢.

如果我没有得到我的答案,我可能会考虑在GitHub上的Angular回购中打开一个错误.

javascript unit-testing jasmine angularjs karma-runner

6
推荐指数
1
解决办法
1112
查看次数