diff options
| author | Misko Hevery | 2012-03-15 22:18:06 -0700 |
|---|---|---|
| committer | Misko Hevery | 2012-03-19 11:35:10 -0700 |
| commit | 9918b748be01266eb10db39d51b4d3098d54ab66 (patch) | |
| tree | 41b9b46a1ac03bff7ec7e5d8027dd255e0c55ecc /test | |
| parent | 6ecac8e71a84792a434d21db2c245b3648c55f18 (diff) | |
| download | angular.js-9918b748be01266eb10db39d51b4d3098d54ab66.tar.bz2 | |
fix(compiler): allow transclusion of root elements
Fixed an issue where a directive that uses transclusion (such as ngRepeat) failed to link if it was declared on the root element of the compilation tree. (For example ngView or ngInclude including template where ngRepeat was the top most element).
Diffstat (limited to 'test')
| -rw-r--r-- | test/jqLiteSpec.js | 2 | ||||
| -rw-r--r-- | test/service/compilerSpec.js | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 5cad8c24..417b912c 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -39,7 +39,7 @@ describe('jqLite', function() { it('should be jqLite when jqLiteMode is on, otherwise jQuery', function() { - expect(jqLite).toBe(_jqLiteMode ? jqLiteWrap : _jQuery); + expect(jqLite).toBe(_jqLiteMode ? JQLite : _jQuery); }); diff --git a/test/service/compilerSpec.js b/test/service/compilerSpec.js index 28c91492..f977294b 100644 --- a/test/service/compilerSpec.js +++ b/test/service/compilerSpec.js @@ -1751,5 +1751,27 @@ describe('$compile', function() { }); }); + + it('should support transcluded element on root content', function() { + var comment; + module(function($compileProvider) { + $compileProvider.directive('transclude', valueFn({ + transclude: 'element', + compile: function(element, attr, linker) { + return function(scope, element, attr) { + comment = element; + }; + } + })); + }); + inject(function($compile, $rootScope) { + var element = jqLite('<div>before<div transclude></div>after</div>').contents(); + expect(element.length).toEqual(3); + expect(nodeName_(element[1])).toBe('DIV'); + $compile(element)($rootScope); + expect(nodeName_(element[1])).toBe('#comment'); + expect(nodeName_(comment)).toBe('#comment'); + }); + }); }); }); |
