This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -4057,6 +4057,35 @@ describe('$compile', function() {
4057
4057
} ) ;
4058
4058
} ) ;
4059
4059
4060
+
4061
+ it ( 'should expose transcludeFn in compile fn even for templateUrl' , function ( ) {
4062
+ module ( function ( ) {
4063
+ directive ( 'transInCompile' , valueFn ( {
4064
+ transclude : true ,
4065
+ // template: '<div class="foo">whatever</div>',
4066
+ templateUrl : 'foo.html' ,
4067
+ compile : function ( _ , __ , transclude ) {
4068
+ return function ( scope , element ) {
4069
+ transclude ( scope , function ( clone , scope ) {
4070
+ element . html ( '' ) ;
4071
+ element . append ( clone ) ;
4072
+ } ) ;
4073
+ } ;
4074
+ }
4075
+ } ) ) ;
4076
+ } ) ;
4077
+
4078
+ inject ( function ( $compile , $rootScope , $templateCache ) {
4079
+ $templateCache . put ( 'foo.html' , '<div class="foo">whatever</div>' ) ;
4080
+
4081
+ compile ( '<div trans-in-compile>transcluded content</div>' ) ;
4082
+ $rootScope . $apply ( ) ;
4083
+
4084
+ expect ( trim ( element . text ( ) ) ) . toBe ( 'transcluded content' ) ;
4085
+ } ) ;
4086
+ } ) ;
4087
+
4088
+
4060
4089
it ( 'should make the result of a transclusion available to the parent directive in post-linking phase' +
4061
4090
'(template)' , function ( ) {
4062
4091
module ( function ( ) {
You can’t perform that action at this time.
0 commit comments