@@ -57,18 +57,23 @@ describe('$controller', function() {
57
57
expect ( ctrl instanceof BarCtrl ) . toBe ( true ) ;
58
58
} ) ;
59
59
60
- it ( 'should return true when having an existing controller' , function ( ) {
61
- var FooCtrl = function ( $scope ) { $scope . foo = 'foo' ; } ;
60
+ it ( 'should return true when having an existing controller, should return false otherwise' , function ( ) {
61
+ var FooCtrl = function ( $scope ) { $scope . foo = 'foo' ; } ,
62
+ BarCtrl = function ( $scope ) { $scope . bar = 'bar' ; } ;
62
63
63
- $controllerProvider . register ( { FooCtrl : FooCtrl } ) ;
64
- expect ( $controllerProvider . has ( 'FooCtrl' ) ) . toBe ( true ) ;
65
- } ) ;
64
+ $controllerProvider . register ( 'FooCtrl' , noop ) ;
65
+ $controllerProvider . register ( 'BarCtrl' , [ 'dep1' , 'dep2' , noop ] ) ;
66
+ $controllerProvider . register ( {
67
+ 'BazCtrl' : noop ,
68
+ 'QuxCtrl' : [ 'dep1' , 'dep2' , noop ]
69
+ } ) ;
66
70
67
- it ( 'should return false when not having a non existing controller' , function ( ) {
68
- var FooCtrl = function ( $scope ) { $scope . foo = 'foo' ; } ;
71
+ expect ( $controllerProvider . has ( 'FooCtrl' ) ) . toBe ( true ) ;
72
+ expect ( $controllerProvider . has ( 'BarCtrl' ) ) . toBe ( true ) ;
73
+ expect ( $controllerProvider . has ( 'BazCtrl' ) ) . toBe ( true ) ;
74
+ expect ( $controllerProvider . has ( 'QuxCtrl' ) ) . toBe ( true ) ;
69
75
70
- $controllerProvider . register ( { FooCtrl : FooCtrl } ) ;
71
- expect ( $controllerProvider . has ( 'BarCtrl' ) ) . toBe ( false ) ;
76
+ expect ( $controllerProvider . has ( 'UnknownCtrl' ) ) . toBe ( false ) ;
72
77
} ) ;
73
78
74
79
it ( 'should allow registration of controllers annotated with arrays' , function ( ) {
0 commit comments