@@ -44,7 +44,6 @@ describe('router', function () {
4444 expect ( elt . text ( ) ) . toBe ( 'Home' ) ;
4545 } ) ) ;
4646
47-
4847 it ( 'should bind the component to the current router' , inject ( function ( $location ) {
4948 var router ;
5049 registerComponent ( 'homeCmp' , {
@@ -74,6 +73,28 @@ describe('router', function () {
7473 expect ( router ) . toBeDefined ( ) ;
7574 } ) ) ;
7675
76+ it ( 'should work when an async route is provided route data' , inject ( function ( $location , $q ) {
77+ registerDirective ( 'homeCmp' , {
78+ template : 'Home ({{homeCmp.isAdmin}})' ,
79+ $routerOnActivate : function ( next , prev ) {
80+ this . isAdmin = next . routeData . data . isAdmin ;
81+ }
82+ } ) ;
83+
84+ registerDirective ( 'app' , {
85+ template : '<div ng-outlet></div>' ,
86+ $routeConfig : [
87+ { path : '/' , loader : function ( ) { return $q . when ( 'homeCmp' ) ; } , data : { isAdmin : true } }
88+ ]
89+ } ) ;
90+
91+ compile ( '<app></app>' ) ;
92+
93+ $location . path ( '/' ) ;
94+ $rootScope . $digest ( ) ;
95+ expect ( elt . text ( ) ) . toBe ( 'Home (true)' ) ;
96+ } ) ) ;
97+
7798 function registerDirective ( name , options ) {
7899 function factory ( ) {
79100 return {
@@ -124,4 +145,4 @@ describe('router', function () {
124145 }
125146 } ) ;
126147 }
127- } ) ;
148+ } ) ;
0 commit comments