mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
refactor(mocks): simplify the implementation
This commit is contained in:
parent
3bf4390339
commit
64d58a5b52
1 changed files with 3 additions and 4 deletions
7
src/ngMock/angular-mocks.js
vendored
7
src/ngMock/angular-mocks.js
vendored
|
|
@ -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.call(currentSpec) : workFn;
|
||||
return isSpecRunning() ? workFn() : workFn;
|
||||
/////////////////////
|
||||
function workFn() {
|
||||
var modules = currentSpec.$modules || [];
|
||||
|
|
@ -2138,9 +2138,8 @@ if(window.jasmine || window.mocha) {
|
|||
}
|
||||
for(var i = 0, ii = blockFns.length; i < ii; i++) {
|
||||
try {
|
||||
/* jshint -W040 *//* Jasmine explicitly provides a `this` object when calling functions */
|
||||
injector.invoke(blockFns[i] || angular.noop, this);
|
||||
/* jshint +W040 */
|
||||
// jasmine sets this to be the current spec, so we are mimicing that
|
||||
injector.invoke(blockFns[i] || angular.noop, currentSpec);
|
||||
} catch (e) {
|
||||
if (e.stack && errorForStack) {
|
||||
throw new ErrorAddingDeclarationLocationStack(e, errorForStack);
|
||||
|
|
|
|||
Loading…
Reference in a new issue