diff options
| author | Igor Minar | 2014-02-07 12:14:32 -0800 |
|---|---|---|
| committer | Igor Minar | 2014-02-07 12:14:32 -0800 |
| commit | d5c7ef0f7886afdfeb6d78b7e320ba2bfe5c77ba (patch) | |
| tree | 8f6ec92cae25f6b4d80e16bac968eaa4b519a93a /src/ngMock/angular-mocks.js | |
| parent | 84fd3a18a3a7f181d1b8c0a7c02b703cc4b8ec3a (diff) | |
| download | angular.js-d5c7ef0f7886afdfeb6d78b7e320ba2bfe5c77ba.tar.bz2 | |
revert: refactor(mocks): simplify the `inject` implementation
This reverts commit 64d58a5b5292046adf8b28928950858ab3895fcc.
For some weird reason this is causing regressions at Google.
I'm not sure why and I'm running out of time to investigate, so I'm taking
a safe route here and reverting the commit since it's just a refactoring.
Diffstat (limited to 'src/ngMock/angular-mocks.js')
| -rw-r--r-- | src/ngMock/angular-mocks.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index 1be07a24..6b8868f7 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -2095,7 +2095,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(currentSpec) : workFn; ///////////////////// function workFn() { var modules = currentSpec.$modules || []; @@ -2108,8 +2108,9 @@ if(window.jasmine || window.mocha) { } for(var i = 0, ii = blockFns.length; i < ii; i++) { try { - // jasmine sets this to be the current spec, so we are mimicing that - injector.invoke(blockFns[i] || angular.noop, currentSpec); + /* jshint -W040 *//* Jasmine explicitly provides a `this` object when calling functions */ + injector.invoke(blockFns[i] || angular.noop, this); + /* jshint +W040 */ } catch (e) { if (e.stack && errorForStack) { throw new ErrorAddingDeclarationLocationStack(e, errorForStack); |
