From 14e7ef2005bbcc563bf4387e6026f5a18cd1190c Mon Sep 17 00:00:00 2001 From: Martin Staffa Date: Wed, 17 Jan 2018 12:03:05 +0100 Subject: [PATCH] fix(ngTransclude): remove terminal: true This was introduced in commit 2adaff083f309bd324c466edd781f3edbf0aff89, but made obsolete in 41f3269bfbd90a8d48e62639bb43f3020617bc57. Fixes #16411 Closes #16412 --- src/ng/directive/ngTransclude.js | 1 - test/ng/compileSpec.js | 43 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/ng/directive/ngTransclude.js b/src/ng/directive/ngTransclude.js index 4f48f5ee0bbf..a922e752f26c 100644 --- a/src/ng/directive/ngTransclude.js +++ b/src/ng/directive/ngTransclude.js @@ -162,7 +162,6 @@ var ngTranscludeMinErr = minErr('ngTransclude'); var ngTranscludeDirective = ['$compile', function($compile) { return { restrict: 'EAC', - terminal: true, compile: function ngTranscludeCompile(tElement) { // Remove and cache any original content to act as a fallback diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 8bd6fee9263c..86182c7eda2e 100644 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -8630,6 +8630,49 @@ describe('$compile', function() { }); + it('should compile directives with lower priority than ngTransclude', function() { + var ngTranscludePriority; + var lowerPriority = -1; + + module(function($provide) { + $provide.decorator('ngTranscludeDirective', function($delegate) { + ngTranscludePriority = $delegate[0].priority; + return $delegate; + }); + + directive('lower', function(log) { + return { + priority: lowerPriority, + link: { + pre: function() { + log('pre'); + }, + post: function() { + log('post'); + } + } + }; + }); + directive('trans', function(log) { + return { + transclude: true, + template: '
' + }; + }); + }); + inject(function(log, $rootScope, $compile) { + element = $compile('
transcluded content
')($rootScope); + + expect(lowerPriority).toBeLessThan(ngTranscludePriority); + + $rootScope.$apply(); + + expect(element.text()).toEqual('transcluded content'); + expect(log).toEqual('pre; post'); + }); + }); + + it('should not merge text elements from transcluded content', function() { module(function() { directive('foo', valueFn({