fix indent

This commit is contained in:
Gustavo Maximiliano Cortez 2015-04-11 12:17:32 -03:00
parent af783c1109
commit 00b69bef23
1 changed files with 27 additions and 27 deletions

View File

@ -1,30 +1,30 @@
angular.module('stateMock',[]); angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){ angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = []; this.expectedTransitions = [];
this.transitionTo = function(stateName){ this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){ if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift(); var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){ if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName ); throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
} }
}else{ }else{
throw Error("No more transitions were expected! Tried to transition to "+ stateName ); throw Error("No more transitions were expected! Tried to transition to "+ stateName );
} }
console.log("Mock transition to: " + stateName); console.log("Mock transition to: " + stateName);
var deferred = $q.defer(); var deferred = $q.defer();
var promise = deferred.promise; var promise = deferred.promise;
deferred.resolve(); deferred.resolve();
return promise; return promise;
} }
this.go = this.transitionTo; this.go = this.transitionTo;
this.expectTransitionTo = function(stateName){ this.expectTransitionTo = function(stateName){
this.expectedTransitions.push(stateName); this.expectedTransitions.push(stateName);
} }
this.ensureAllTransitionsHappened = function(){ this.ensureAllTransitionsHappened = function(){
if(this.expectedTransitions.length > 0){ if(this.expectedTransitions.length > 0){
throw Error("Not all transitions happened!"); throw Error("Not all transitions happened!");
} }
} }
}); });