Tag: 业力运动员

UI路由器与$ httpbackendunit testing,angular度js干涉

这是一个提交function的控制器: $scope.submit = function(){ $http.post('/api/project', $scope.project) .success(function(data, status){ $modalInstance.dismiss(true); }) .error(function(data){ console.log(data); }) } } 这是我的testing it('should make a post to /api/project on submit and close the modal on success', function() { scope.submit(); $httpBackend.expectPOST('/api/project').respond(200, 'test'); $httpBackend.flush(); expect(modalInstance.dismiss).toHaveBeenCalledWith(true); }); 我得到的错误是: Error: Unexpected request: GET views/appBar.html views / appBar.html是我的templateUrl: .state('project', { url: '/', templateUrl:'views/appBar.html', controller: 'ProjectsCtrl' }) […]