From 4a051efb89cf33e30d56f1227d1f6084ead4cd42 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 3 Feb 2012 16:20:24 -0800 Subject: feat($compile): support compiling text nodes by wrapping them in --- test/service/compilerSpec.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/service') diff --git a/test/service/compilerSpec.js b/test/service/compilerSpec.js index 8d91ed5d..02cdcefe 100644 --- a/test/service/compilerSpec.js +++ b/test/service/compilerSpec.js @@ -96,6 +96,15 @@ describe('$compile', function() { describe('compile phase', function() { + it('should wrap root text nodes in spans', inject(function($compile, $rootScope) { + element = jqLite('
A<a>B</a>C
'); + var text = element.contents(); + expect(text[0].nodeName).toEqual('#text'); + text = $compile(text)($rootScope); + expect(lowercase(text[0].nodeName)).toEqual('span'); + expect(element.find('span').text()).toEqual('ABC'); + })); + describe('multiple directives per element', function() { it('should allow multiple directives per element', inject(function($compile, $rootScope, log){ element = $compile( -- cgit v1.2.3