Angularjs控制器测试给出TypeError:undefined不是函数

时间:2015-01-15 08:03:31

标签: angularjs

.controller('ClientsCtrl', ['$scope', '$location', '$filter', '$modal', 'ngTableParams',
      function($scope, $location, $filter, $modal, ngTableParams) {

        var trowser = PY.getBooks($scope, $location, $modal);

      };

controllertestspec.js

'use strict';

describe('suite', function() {

  var scope, ctrl;
  beforeEach(module('clients'));
  beforeEach(inject(function($controller) {
    scope = {};
    var modalInstance = jasmine.createSpy('fakeModal');
    ctrl = $controller('ClientsCtrl', {
      $scope: scope,
      $modal: modalInstance
    });
  }));

  it('should change greeting value if name value is changed', function() {

  });

});

我添加了具有模块PY的js文件,如果我尝试打印console.log(typeof PY.Books),则显示为函数。 当我试图运行spec文件时出现错误

Chrome 39.0.2171(Mac OS X 10.9.5)客户端模块如果更改名称值,则应更改问候值FAILED     TypeError:undefined不是函数         在Object.PY.getBooks

0 个答案:

没有答案