net*_*jor 8 javascript jasmine chutzpah angularjs visual-studio-2012
我有angularJs控制器
angular.module('App.ctrl.guests', [])
.controller('guestsController', ['$scope', '$http', '$location', '$timeout', 'guestsService', function ($scope, $http, $location, $timeout, guestsService) {
$scope.tiles = [];
}])
Run Code Online (Sandbox Code Playgroud)
和茉莉花测试
/// <reference path="~/Scripts/angular.js" />
/// <reference path="../../ProjectWeb/Scripts/app/guests/guestsCtrl.js" />
/// <reference path="~/Scripts/angular-mocks.js" />
/// <reference path="~/Scripts/jasmine.js" />
'use strict';
describe('App.ctrl.guests', function () {
var scope, controller;
beforeEach(function () {
module('App.ctrl.guests')
});
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
controller = $controller('guestsController', {
$scope: scope
});
}));
it('should have empty array', function () {
expect(scope.tiles).toBe([]);
});
})
Run Code Online (Sandbox Code Playgroud)
每次我在Visual studio chutzpah运行时,我得到:
ReferenceError:找不到变量:file in file:///.../JasmineTests/guestsControllerTest.js(第5行)
ReferenceError:无法找到变量:inject in file:///.../JasmineTests/guestsControllerTest.js(第12行)
这是一个问题,参考angular.js和茉莉花不知道什么是模块/注入关键字?这是我第一次用js测试:/
归档时间: |
|
查看次数: |
8930 次 |
最近记录: |