@@ -17,8 +17,8 @@ describe('$controller', function() {
17
17
18
18
it ( 'should allow registration of controllers' , function ( ) {
19
19
var FooCtrl = function ( $scope ) { $scope . foo = 'bar' } ,
20
- scope = { } ,
21
- ctrl ;
20
+ scope = { } ,
21
+ ctrl ;
22
22
23
23
$controllerProvider . register ( 'FooCtrl' , FooCtrl ) ;
24
24
ctrl = $controller ( 'FooCtrl' , { $scope : scope } ) ;
@@ -28,6 +28,24 @@ describe('$controller', function() {
28
28
} ) ;
29
29
30
30
31
+ it ( 'should allow registration of map of controllers' , function ( ) {
32
+ var FooCtrl = function ( $scope ) { $scope . foo = 'foo' } ,
33
+ BarCtrl = function ( $scope ) { $scope . bar = 'bar' } ,
34
+ scope = { } ,
35
+ ctrl ;
36
+
37
+ $controllerProvider . register ( { FooCtrl : FooCtrl , BarCtrl : BarCtrl } ) ;
38
+
39
+ ctrl = $controller ( 'FooCtrl' , { $scope : scope } ) ;
40
+ expect ( scope . foo ) . toBe ( 'foo' ) ;
41
+ expect ( ctrl instanceof FooCtrl ) . toBe ( true ) ;
42
+
43
+ ctrl = $controller ( 'BarCtrl' , { $scope : scope } ) ;
44
+ expect ( scope . bar ) . toBe ( 'bar' ) ;
45
+ expect ( ctrl instanceof BarCtrl ) . toBe ( true ) ;
46
+ } ) ;
47
+
48
+
31
49
it ( 'should allow registration of controllers annotated with arrays' , function ( ) {
32
50
var FooCtrl = function ( $scope ) { $scope . foo = 'bar' } ,
33
51
scope = { } ,
0 commit comments