2014-09-18 78 views
6

我有以下测试:

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()); 
}); 

我得到以下错误:在调试时,我看到$browser.$$checkUrlChange上线12502

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) 

angular.js确实没有定义。

作为一个临时的解决方案,我改变了对线1250调用到$browser.$$checkUrlChange && $browser.$$checkUrlChange()

但我不禁想知道这只猴子补丁是否能伤害我在一些其他的方式。

任何有关如何正确解决这个问题的线索非常感谢。

如果我没有得到我的答案,我可能会考虑在GitHub上的Angular repo上打开一个bug。

+1

可能重复[茉莉测试失败,不确定是不是一个函数(评估$浏览器$$ checkUrlChange())](http://stackoverflow.com/questions/25785149/ jasmine-test-fails-unde-undefined-is-not-a-function-evaluation-browser-checku) – 2014-09-18 17:31:49

+0

你应该发布你的答案,先生:) – 2014-09-28 07:55:17

回答