@@ -5430,6 +5430,53 @@ describe('$compile', function() {
5430
5430
} ) ;
5431
5431
5432
5432
5433
+ it ( 'should bind required controllers to controllers that return an explicit constructor return value' , function ( ) {
5434
+ var parentController , containerController , siblingController , friendController , meController ;
5435
+
5436
+ function MeController ( ) {
5437
+ this . name = 'Me' ;
5438
+ this . $onInit = function ( ) {
5439
+ containerController = this . container ;
5440
+ friendController = this . friend ;
5441
+ } ;
5442
+ }
5443
+ function ParentController ( ) {
5444
+ return parentController = { name : 'Parent' } ;
5445
+ }
5446
+ function SiblingController ( ) {
5447
+ return siblingController = { name : 'Sibling' } ;
5448
+ }
5449
+
5450
+ angular . module ( 'my' , [ ] )
5451
+ . directive ( 'me' , function ( ) {
5452
+ return {
5453
+ restrict : 'E' ,
5454
+ scope : { } ,
5455
+ require : { container : '^parent' , friend : 'sibling' } ,
5456
+ controller : MeController
5457
+ } ;
5458
+ } )
5459
+ . directive ( 'parent' , function ( ) {
5460
+ return {
5461
+ restrict : 'E' ,
5462
+ scope : { } ,
5463
+ controller : ParentController
5464
+ } ;
5465
+ } )
5466
+ . directive ( 'sibling' , function ( ) {
5467
+ return {
5468
+ controller : SiblingController
5469
+ } ;
5470
+ } ) ;
5471
+
5472
+ module ( 'my' ) ;
5473
+ inject ( function ( $compile , $rootScope , meDirective ) {
5474
+ element = $compile ( '<parent><me sibling></me></parent>' ) ( $rootScope ) ;
5475
+ expect ( containerController ) . toEqual ( parentController ) ;
5476
+ expect ( friendController ) . toEqual ( siblingController ) ;
5477
+ } ) ;
5478
+ } ) ;
5479
+
5433
5480
it ( 'should require controller of an isolate directive from a non-isolate directive on the ' +
5434
5481
'same element' , function ( ) {
5435
5482
var IsolateController = function ( ) { } ;
0 commit comments