我想测试我的角度应用。使用业力
这是我的karma配置文件:
(function(window,angular){
angular.module("demo-app",['ngRoute','angularUtils.directives.dirPagination','ui.bootstrap'])
.config(function($routeProvider){
$routeProvider
.when('/',{
title:'Dashboard',
templateUrl:'dashboard/views/dashboard-new.html',
controller:'dashboardCtrl'
})
.when('/dashboard',{
title:'Dashboard',
templateUrl:'dashboard/views/dashboard-new.html',
controller:'dashboardCtrl'
})
.when('/report',{
title:'Report',
templateUrl:'report/views/report.html',
controller: 'reportCtrl'
})
.when('/admin-employee',{
title:'Admin Employee',
templateUrl: 'admin/views/employee.html',
controller:'adminEmployeeCtrl'
})
.when('/admin-employee-function',{
title:'Admin Employee Function',
templateUrl:'admin/views/employee-function.html',
controller:'adminEmployeeFunctionCtrl'
})
.when('/admin-worksite',{
title:'Admin Worksite',
templateUrl:'admin/views/worksite.html',
controller:'adminWorksiteCtrl'
})
.when('/admin-organization',{
title:'Admin Organization',
templateUrl:'admin/views/organization.html',
controller:'adminOrganizationCtrl'
})
.when('/admin-alerts',{
title:'Admin Alert',
templateUrl:'admin/views/alert.html',
controller:'adminAlertCtrl'
})
.when('/admin-fix-areas',{
title:'Admin Fix Area',
templateUrl:'admin/views/fix-area.html',
controller:'adminFixAreaCtrl'
})
.when('/admin-fix-location',{
title:'Admin Worksite',
templateUrl:'admin/views/fix-location.html',
controller:'adminFixLocationCtrl'
})
.when('/admin-find-categories',{
title:'Admin Worksite',
templateUrl:'admin/views/find-category.html',
controller:'adminFindCategoryCtrl'
})
.when('/admin-find-types',{
title:'Admin Worksite',
templateUrl:'admin/views/find-type.html',
controller:'adminFindTypeCtrl'
})
.when('/admin-fix-categories',{
title:'Admin Worksite',
templateUrl:'admin/views/fix-category.html',
controller:'adminFixCategoryCtrl'
})
.otherwise({
redirectTo:'/'
});
})
.run( function($location,$rootScope, $route) {
$rootScope.$on('$routeChangeSuccess', function(event, current, previous) {
$rootScope.title = current.$$route.title;
document.title = $route.current.title;
});
})
})(window,window.angular);
这是我的app.js:
describe('app add fix ctrl test', function(){
beforeEach(module('demo-app'));
beforeEach(inject(function(_$controller_){
_$controller_('addFixCtrl',{
$scope:scope,
});
}));
it('test 1',function(){
expect(scope.isopen).toEqual(true);
});
});
这是我的addfix-ctrl.spec.js
(function(window,angular){
angular.module("demo-app")
.controller('addFixCtrl', function($scope, serviceDashboard, empService,$modalInstance, obj) {
...
$scope.isopen = true;
...
});
})(window,window.angular);
这是我的addfix控制器:
Chrome 55.0.2883 (Windows 7 0.0.0) fifi app add fix ctrl test test 1 FAILED
Error: Unknown provider: $compileProvider from ngRoute
at public/javascripts/angular/angular.min.js:29:439
at Object.c [as get] (public/javascripts/angular/angular.min.js:27:1
42)
at public/javascripts/angular/angular.min.js:26:138
at Array.forEach (native)
at n (public/javascripts/angular/angular.min.js:6:470)
at e (public/javascripts/angular/angular.min.js:25:497)
at public/javascripts/angular/angular.min.js:26:34
at Array.forEach (native)
at n (public/javascripts/angular/angular.min.js:6:470)
at e (public/javascripts/angular/angular.min.js:25:497)
TypeError: Cannot read property 'isopen' of undefined
at Object.<anonymous> (app_client/dashboard/controller/test/addfix-c
trl.spec.js:11:15)
Chrome 55.0.2883 (Windows 7 0.0.0): Executed 1 of 1 (1 FAILED) (0 secs / 0.011 s
Chrome 55.0.2883 (Windows 7 0.0.0): Executed 1 of 1 (1 FAILED) ERROR (0.077 secs
/ 0.011 secs)
每当我开始业力时,我都会收到以下错误消息:
jq
请帮帮我。