From eed299a31b5a6dd0363133c5f9271bf33d090c94 Mon Sep 17 00:00:00 2001
From: Igor Minar
Date: Tue, 20 Aug 2013 16:31:09 -0700
Subject: fix(ngTransclude): clear the translusion point before transcluding
when the transluded content is being teleported to the translusion point, we should ensure that
the translusion point is empty before appending otherwise we end up with junk before the transcluded
content
---
 test/ng/compileSpec.js | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
(limited to 'test/ng/compileSpec.js')
diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 7c24e1d9..844511a3 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -2450,7 +2450,7 @@ describe('$compile', function() {
         element = $compile('
')($rootScope);
         $rootScope.$apply();
         expect(log).toEqual('parentController; childController');
-        expect(element.text()).toBe('parentTemplateText;childTemplateText;childContentText;')
+        expect(element.text()).toBe('childTemplateText;childContentText;')
       });
     });
 
@@ -2554,7 +2554,7 @@ describe('$compile', function() {
                             '')($rootScope);
         $rootScope.$apply();
         expect(log).toEqual('parentController; childController; babyController');
-        expect(element.text()).toBe('parentTemplateText;childTemplateText;childContentText;babyTemplateText;')
+        expect(element.text()).toBe('childContentText;babyTemplateText;')
       });
     });
 
@@ -2825,6 +2825,24 @@ describe('$compile', function() {
     });
 
 
+    it('should clear contents of the ng-translude element before appending transcluded content',
+        function() {
+      module(function() {
+        directive('trans', function() {
+          return {
+            transclude: true,
+            template: 'old stuff! 
'
+          };
+        });
+      });
+      inject(function(log, $rootScope, $compile) {
+        element = $compile('unicorn!
')($rootScope);
+        $rootScope.$apply();
+        expect(sortedHtml(element.html())).toEqual('unicorn!
');
+      });
+    });
+
+
     it('should make the result of a transclusion available to the parent directive in post-linking phase (template)',
         function() {
       module(function() {
-- 
cgit v1.2.3