我有一个指令,其中控制器被定义为指令定义的一部分。单元测试使用Karma的角度Js控制器
(function(){
var app = angular.module('app', []);
app.directive('test', function(){
return {
restrict: 'E',
templateUrl: 'test.html',
controller: ['$scope', function ($scope){...*set of functions*......}],
controllerAs:'reportCtrl',
link:function(Attrs){
}
};
});
})();
我需要为这组函数编写单元测试。我不熟悉业力测试,并没有为这类代码找到很多资源。我几乎尝试了所有可能的方式。有人可以帮我写这个单元测试
[角JS单元测试控制器]的可能的复制(http://stackoverflow.com/questions/33134566/angular-js-unit-testing-a-controller) – angmerica