X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=88e7d71076ca97936e0bab89fbd4ee270ba039f8;hb=7a04d1da54caec00b900620390df820fb85b1227;hp=ca185a47ee78c90c211e05eb6b19863859119779;hpb=991dafae16e44512c5107b90bc8ce9675d8f5c12;p=jquery.git diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index ca185a4..88e7d71 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -10,7 +10,7 @@ test("text()", function() { }); var testWrap = function(val) { - expect(12); + expect(15); var defaultText = 'Try them out:' var result = jQuery('#first').wrap(val( '
' )).text(); equals( defaultText, result, 'Check for wrapping of on-the-fly html' ); @@ -45,6 +45,12 @@ var testWrap = function(val) { j = jQuery("").wrap("
test
"); equals( j[0].previousSibling.nodeType, 3, "Make sure the previous node is a text element" ); equals( j[0].parentNode.nodeName.toUpperCase(), "DIV", "And that we're in the div element." ); + + // Try to wrap an element with multiple elements (should fail) + j = jQuery("
").children().wrap("

"); + equals( j[0].parentNode.parentNode.childNodes.length, 1, "There should only be one element wrapping." ); + equals( j.length, 1, "There should only be one element (no cloning)." ); + equals( j[0].parentNode.nodeName.toUpperCase(), "P", "The span should be in the paragraph." ); } test("wrap(String|Element)", function() {