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/jqLiteSpec.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test/jqLiteSpec.js') diff --git a/test/jqLiteSpec.js b/test/jqLiteSpec.js index 358b8c4a..5b2e35b0 100644 --- a/test/jqLiteSpec.js +++ b/test/jqLiteSpec.js @@ -802,6 +802,26 @@ describe('jqLite', function() { }); }); + + describe('wrap', function() { + it('should wrap text node', function() { + var root = jqLite('
A<a>B</a>C
'); + var text = root.contents(); + expect(text.wrap("")[0]).toBe(text[0]); + expect(root.find('span').text()).toEqual('ABC'); + }); + it('should wrap free text node', function() { + var root = jqLite('
A<a>B</a>C
'); + var text = root.contents(); + text.remove(); + expect(root.text()).toBe(''); + + text.wrap(""); + expect(text.parent().text()).toEqual('ABC'); + }); + }); + + describe('prepend', function() { it('should prepend to empty', function() { var root = jqLite('
'); -- cgit v1.2.3