From b3fe1d37a907e5de68a2c7000f6f49f5b0550cc9 Mon Sep 17 00:00:00 2001 From: Wes Alvaro Date: Mon, 3 Feb 2014 16:53:52 -0800 Subject: [PATCH] bug(mocks): Correctly calls workFn with "this". Currently, the workFn is called with the implied, global "this" instead of the current context as it should be. See this bin for the problem and suggested solution: http://jsbin.com/EDohOlih/1/edit --- src/ngMock/angular-mocks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index 19f0ac9d7ed9..98a69425c9a9 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -2125,7 +2125,7 @@ if(window.jasmine || window.mocha) { window.inject = angular.mock.inject = function() { var blockFns = Array.prototype.slice.call(arguments, 0); var errorForStack = new Error('Declaration Location'); - return isSpecRunning() ? workFn() : workFn; + return isSpecRunning() ? workFn.call(this) : workFn; ///////////////////// function workFn() { var modules = currentSpec.$modules || [];