Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 92d8971

Browse files
author
Andrew Schmadel
committed
fix(ngMockE2E): allow $httpBackend.passThrough() to work when ngMock is loaded
Allow $httpBackend.passThrough() to work normally when ngMock is loaded concurrently with ngMockE2E, as is typically the case when writing tests with angular.mock.module() Fixes #1434
1 parent ad4296d commit 92d8971

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/ngMock/angular-mocks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,7 @@ angular.module('ngMock', ['ng']).provider({
21292129
* the {@link ngMockE2E.$httpBackend e2e $httpBackend} mock.
21302130
*/
21312131
angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
2132+
$provide.value('$httpBackend', angular.injector(['ng']).get('$httpBackend'));
21322133
$provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
21332134
}]);
21342135

test/ngMock/angular-mocksSpec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,12 +1846,12 @@ describe('ngMockE2E', function() {
18461846
var hb, realHttpBackend, callback;
18471847

18481848
beforeEach(function() {
1849-
module(function($provide) {
1850-
callback = jasmine.createSpy('callback');
1849+
callback = jasmine.createSpy('callback');
1850+
angular.module('ng').config(function($provide) {
18511851
realHttpBackend = jasmine.createSpy('real $httpBackend');
18521852
$provide.value('$httpBackend', realHttpBackend);
1853-
$provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
18541853
});
1854+
module('ngMockE2E');
18551855
inject(function($injector) {
18561856
hb = $injector.get('$httpBackend');
18571857
});

0 commit comments

Comments
 (0)