aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngMock
diff options
context:
space:
mode:
authorIgor Minar2014-02-07 12:14:32 -0800
committerIgor Minar2014-02-07 12:14:32 -0800
commitd5c7ef0f7886afdfeb6d78b7e320ba2bfe5c77ba (patch)
tree8f6ec92cae25f6b4d80e16bac968eaa4b519a93a /src/ngMock
parent84fd3a18a3a7f181d1b8c0a7c02b703cc4b8ec3a (diff)
downloadangular.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')
-rw-r--r--src/ngMock/angular-mocks.js7
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);