@@ -276,7 +276,17 @@ describe('state', function () {
276
276
. state ( 'OPT.OPT2' , OPT2 )
277
277
. state ( 'home' , { url : "/" } )
278
278
. state ( 'home.item' , { url : "front/:id" } )
279
- . state ( 'about' , { url : "/about" } )
279
+ . state ( 'about' , {
280
+ url : "/about" ,
281
+ resolve : {
282
+ stateInfo : function ( $transition$ ) {
283
+ return [ $transition$ . from ( ) . name , $transition$ . to ( ) . name ] ;
284
+ }
285
+ } ,
286
+ onEnter : function ( stateInfo ) {
287
+ log = stateInfo . join ( ' => ' ) ;
288
+ }
289
+ } )
280
290
. state ( 'about.person' , { url : "/:person" } )
281
291
. state ( 'about.person.item' , { url : "/:id" } )
282
292
. state ( 'about.sidebar' , { } )
@@ -709,6 +719,12 @@ describe('state', function () {
709
719
expect ( $location . url ( ) ) . toBe ( '/front/world#frag' ) ;
710
720
expect ( $location . hash ( ) ) . toBe ( 'frag' ) ;
711
721
} ) ) ;
722
+
723
+ it ( 'injects $transition$ into resolves' , inject ( function ( $state , $q ) {
724
+ $state . transitionTo ( 'home' ) ; $q . flush ( ) ;
725
+ $state . transitionTo ( 'about' ) ; $q . flush ( ) ;
726
+ expect ( log ) . toBe ( 'home => about' ) ;
727
+ } ) ) ;
712
728
} ) ;
713
729
714
730
describe ( '.go()' , function ( ) {
0 commit comments