File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,27 @@ 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' ; } ,
62
+ scope = { } ,
63
+ ctrl ;
64
+
65
+ $controllerProvider . register ( { FooCtrl : FooCtrl } ) ;
66
+
67
+ ctrl = $controller ( 'FooCtrl' , { $scope : scope } ) ;
68
+ expect ( ctrl . has ( 'FooCtrl' ) ) . toBe ( true ) ;
69
+ } ) ;
70
+
71
+ it ( 'should return false when not having a non existing controller' , function ( ) {
72
+ var FooCtrl = function ( $scope ) { $scope . foo = 'foo' ; } ,
73
+ scope = { } ,
74
+ ctrl ;
75
+
76
+ $controllerProvider . register ( { FooCtrl : FooCtrl } ) ;
77
+
78
+ ctrl = $controller ( 'FooCtrl' , { $scope : scope } ) ;
79
+ expect ( ctrl . has ( 'whatever' ) ) . toBe ( false ) ;
80
+ } ) ;
60
81
61
82
it ( 'should allow registration of controllers annotated with arrays' , function ( ) {
62
83
var FooCtrl = function ( $scope ) { $scope . foo = 'bar' ; } ,
You can’t perform that action at this time.
0 commit comments