角度测试意外请求:GET模板

时间:2017-05-19 13:20:09

标签: angularjs testing karma-jasmine

我试图测试指令,一个有activate()函数,调用另一个函数,错误时调用ngDialog.open()

ngDialog.open({
      template: 'path/to/template/error.html',
      className: 'ngdialog-theme-default',
      data: data
    });

这是我的测试:

   it('should check activate function', function() {
          $httpBackend.whenGET('path/to/template/error.html').respond(200, '');
          var onActivateSpy = spyOn(scope.$$childTail.headerVm, 'activate'));
    expect(onActivateSpy).toHaveBeenCalled();
    });

我有一个错误:错误:意外请求:GET路径/到/ template / error.html 我错过了什么?

EDITED 这是我之前的事情:

beforeEach(function () {
      module('app');
      module('path/to/template/error.html');
    });

我使用ng-html2js预处理器

0 个答案:

没有答案