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

Commit ff0395f

Browse files
Andrew Schmadelpetebacondarwin
Andrew Schmadel
authored andcommitted
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 Closes #13124
1 parent cd3673e commit ff0395f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/ngMock/angular-mocks.js

+1
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,7 @@ angular.module('ngMock', ['ng']).provider({
23292329
* the {@link ngMockE2E.$httpBackend e2e $httpBackend} mock.
23302330
*/
23312331
angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
2332+
$provide.value('$httpBackend', angular.injector(['ng']).get('$httpBackend'));
23322333
$provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
23332334
}]);
23342335

test/ngMock/angular-mocksSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2150,12 +2150,12 @@ describe('ngMockE2E', function() {
21502150
var hb, realHttpBackend, callback;
21512151

21522152
beforeEach(function() {
2153-
module(function($provide) {
2154-
callback = jasmine.createSpy('callback');
2153+
callback = jasmine.createSpy('callback');
2154+
angular.module('ng').config(function($provide) {
21552155
realHttpBackend = jasmine.createSpy('real $httpBackend');
21562156
$provide.value('$httpBackend', realHttpBackend);
2157-
$provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
21582157
});
2158+
module('ngMockE2E');
21592159
inject(function($injector) {
21602160
hb = $injector.get('$httpBackend');
21612161
});

0 commit comments

Comments
 (0)