@@ -1567,6 +1567,72 @@ describe('$compile', function() {
1567
1567
} ) ) ;
1568
1568
} ) ;
1569
1569
1570
+ describe ( 'nested isolated scope transcludes' , function ( ) {
1571
+ beforeEach ( module ( function ( $compileProvider ) {
1572
+
1573
+ $compileProvider . directive ( 'trans' , valueFn ( {
1574
+ restrict : 'E' ,
1575
+ template : '<div ng-transclude></div>' ,
1576
+ transclude : true
1577
+ } ) ) ;
1578
+
1579
+ $compileProvider . directive ( 'transAsync' , valueFn ( {
1580
+ restrict : 'E' ,
1581
+ templateUrl : 'transAsync' ,
1582
+ transclude : true
1583
+ } ) ) ;
1584
+
1585
+ $compileProvider . directive ( 'iso' , valueFn ( {
1586
+ restrict : 'E' ,
1587
+ transclude : true ,
1588
+ template : '<trans><span ng-transclude></span></trans>' ,
1589
+ scope : { }
1590
+ } ) ) ;
1591
+ $compileProvider . directive ( 'isoAsync1' , valueFn ( {
1592
+ restrict : 'E' ,
1593
+ transclude : true ,
1594
+ template : '<trans-async><span ng-transclude></span></trans-async>' ,
1595
+ scope : { }
1596
+ } ) ) ;
1597
+ $compileProvider . directive ( 'isoAsync2' , valueFn ( {
1598
+ restrict : 'E' ,
1599
+ transclude : true ,
1600
+ templateUrl : 'isoAsync' ,
1601
+ scope : { }
1602
+ } ) ) ;
1603
+ } ) ) ;
1604
+
1605
+ beforeEach ( inject ( function ( $templateCache ) {
1606
+ $templateCache . put ( 'transAsync' , '<div ng-transclude></div>' ) ;
1607
+ $templateCache . put ( 'isoAsync' , '<trans-async><span ng-transclude></span></trans-async>' ) ;
1608
+ } ) ) ;
1609
+
1610
+
1611
+ it ( 'should pass the outer scope to the transclude on the isolated template sync-sync' , inject ( function ( $compile , $rootScope ) {
1612
+
1613
+ $rootScope . val = 'transcluded content' ;
1614
+ element = $compile ( '<iso><span ng-bind="val"></span></iso>' ) ( $rootScope ) ;
1615
+ $rootScope . $digest ( ) ;
1616
+ expect ( trim ( element . text ( ) ) ) . toEqual ( 'transcluded content' ) ;
1617
+ } ) ) ;
1618
+
1619
+ it ( 'should pass the outer scope to the transclude on the isolated template async-sync' , inject ( function ( $compile , $rootScope ) {
1620
+
1621
+ $rootScope . val = 'transcluded content' ;
1622
+ element = $compile ( '<iso-async1><span ng-bind="val"></span></iso-async1>' ) ( $rootScope ) ;
1623
+ $rootScope . $digest ( ) ;
1624
+ expect ( trim ( element . text ( ) ) ) . toEqual ( 'transcluded content' ) ;
1625
+ } ) ) ;
1626
+
1627
+ it ( 'should pass the outer scope to the transclude on the isolated template async-async' , inject ( function ( $compile , $rootScope ) {
1628
+
1629
+ $rootScope . val = 'transcluded content' ;
1630
+ element = $compile ( '<iso-async2><span ng-bind="val"></span></iso-async2>' ) ( $rootScope ) ;
1631
+ $rootScope . $digest ( ) ;
1632
+ expect ( trim ( element . text ( ) ) ) . toEqual ( 'transcluded content' ) ;
1633
+ } ) ) ;
1634
+
1635
+ } ) ;
1570
1636
1571
1637
1572
1638
it ( "should fail if replacing and template doesn't have a single root element" , function ( ) {
0 commit comments