From 440be33d48e776beed9ec76c6d400450a61ceb1e Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Thu, 29 May 2014 11:40:12 -0700 Subject: [PATCH] test($compile): transcludeFn is available in compile of templateUrl directive --- test/ng/compileSpec.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index ff44f100227d..1095a76b6805 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -4057,6 +4057,35 @@ describe('$compile', function() { }); }); + + it('should expose transcludeFn in compile fn even for templateUrl', function() { + module(function() { + directive('transInCompile', valueFn({ + transclude: true, + // template: '
whatever
', + templateUrl: 'foo.html', + compile: function(_, __, transclude) { + return function(scope, element) { + transclude(scope, function(clone, scope) { + element.html(''); + element.append(clone); + }); + }; + } + })); + }); + + inject(function($compile, $rootScope, $templateCache) { + $templateCache.put('foo.html', '
whatever
'); + + compile('
transcluded content
'); + $rootScope.$apply(); + + expect(trim(element.text())).toBe('transcluded content'); + }); + }); + + it('should make the result of a transclusion available to the parent directive in post-linking phase' + '(template)', function() { module(function() {