From 81395ac2982504d254689fdab54d3bb5c4e32912 Mon Sep 17 00:00:00 2001 From: Alexander Harding Date: Tue, 1 Apr 2014 14:45:44 -0500 Subject: [PATCH] test($compile): add tests for tags as root template nodes --- test/ng/compileSpec.js | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js index 5110c4d6..f093c9a6 100755 --- a/test/ng/compileSpec.js +++ b/test/ng/compileSpec.js @@ -541,6 +541,14 @@ describe('$compile', function() { replace: true, template: 'TD' })); + directive('replaceWithOption', valueFn({ + replace: true, + template: '' + })); + directive('replaceWithOptgroup', valueFn({ + replace: true, + template: 'OPTGROUP' + })); })); @@ -746,6 +754,20 @@ describe('$compile', function() { }).not.toThrow(); expect(nodeName_(element)).toMatch(/tfoot/i); })); + + it('should support templates with root tags', inject(function($compile, $rootScope) { + expect(function() { + element = $compile('
')($rootScope); + }).not.toThrow(); + expect(nodeName_(element)).toMatch(/optgroup/i); + })); }); @@ -867,6 +889,14 @@ describe('$compile', function() { replace: true, templateUrl: 'tfoot.html' })); + directive('replaceWithOption', valueFn({ + replace: true, + templateUrl: 'option.html' + })); + directive('replaceWithOptgroup', valueFn({ + replace: true, + templateUrl: 'optgroup.html' + })); } )); @@ -1556,6 +1586,24 @@ describe('$compile', function() { $rootScope.$digest(); expect(nodeName_(element)).toMatch(/tfoot/i); })); + + it('should support templates with root '); + expect(function() { + element = $compile('
')($rootScope); + }).not.toThrow(); + $rootScope.$digest(); + expect(nodeName_(element)).toMatch(/option/i); + })); + + it('should support templates with root tags', inject(function($compile, $rootScope, $templateCache) { + $templateCache.put('optgroup.html', 'OPTGROUP'); + expect(function() { + element = $compile('
')($rootScope); + }).not.toThrow(); + $rootScope.$digest(); + expect(nodeName_(element)).toMatch(/optgroup/i); + })); });