Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
test($compile): transcludeFn is available in compile of templateUrl d…
Browse files Browse the repository at this point in the history
…irective
  • Loading branch information
vojtajina committed May 29, 2014
1 parent 56c6021 commit 440be33
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/ng/compileSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<div class="foo">whatever</div>',
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', '<div class="foo">whatever</div>');

compile('<div trans-in-compile>transcluded content</div>');
$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() {
Expand Down

0 comments on commit 440be33

Please sign in to comment.