File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -498,6 +498,24 @@ describe('angular', function(){
498
498
expect ( result . two ) . not . toBeDefined ( ) ;
499
499
expect ( result . third ) . toBeTruthy ( ) ;
500
500
} ) ;
501
+
502
+ it ( 'should inject dependencies specified by $inject' , function ( ) {
503
+ angular . service ( 'svc1' , function ( ) { return 'svc1' ; } ) ;
504
+ angular . service ( 'svc2' , function ( svc1 ) { return 'svc2-' + svc1 ; } , { $inject : [ 'svc1' ] } ) ;
505
+ expect ( angular . scope ( ) . $service ( 'svc2' ) ) . toEqual ( 'svc2-svc1' ) ;
506
+ } ) ;
507
+
508
+ it ( 'should inject dependencies specified by $inject and ignore function argument name' , function ( ) {
509
+ angular . service ( 'svc1' , function ( ) { return 'svc1' ; } ) ;
510
+ angular . service ( 'svc2' , function ( foo ) { return 'svc2-' + foo ; } , { $inject : [ 'svc1' ] } ) ;
511
+ expect ( angular . scope ( ) . $service ( 'svc2' ) ) . toEqual ( 'svc2-svc1' ) ;
512
+ } ) ;
513
+
514
+ it ( 'should inject infered dependencies when $inject is missing' , function ( ) {
515
+ angular . service ( 'svc1' , function ( ) { return 'svc1' ; } ) ;
516
+ angular . service ( 'svc2' , function ( svc1 ) { return 'svc2-' + svc1 ; } ) ;
517
+ expect ( angular . scope ( ) . $service ( 'svc2' ) ) . toEqual ( 'svc2-svc1' ) ;
518
+ } ) ;
501
519
} ) ;
502
520
503
521
describe ( 'isDate' , function ( ) {
You can’t perform that action at this time.
0 commit comments