X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=8c3d1a55e679cf1096ac9ef395cfaac4cda95cc2;hb=da51cd0e43d6d61e0d3d6c197cef1e658bad29bc;hp=4631ead61eac05a8142aec381f4b0e51a79da61d;hpb=f5b649fafbd85a1973a9c46ca6bf163d9de857a7;p=jquery.git diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 4631ead..8c3d1a5 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -549,7 +549,7 @@ test("replaceAll(String|Element|Array<Element>|jQuery)", function() { }); test("clone()", function() { - expect(28); + expect(30); equals( 'This is a normal link: Yahoo', jQuery('#en').text(), 'Assert text for #en' ); var clone = jQuery('#yahoo').clone(); equals( 'Try them out:Yahoo', jQuery('#first').append(clone).text(), 'Check for clone' ); @@ -594,6 +594,11 @@ test("clone()", function() { div = div.clone(true); equals( div.length, 1, "One element cloned" ); equals( div[0].nodeName.toUpperCase(), "DIV", "DIV element cloned" ); + + div = jQuery("
").data({ a: true, b: true }); + div = div.clone(true); + equals( div.data("a"), true, "Data cloned." ); + equals( div.data("b"), true, "Data cloned." ); }); if (!isLocal) { @@ -734,15 +739,16 @@ test("html(String)", function() { test("html(Function)", function() { testHtml(functionReturningObj); -}) +}); var testText = function(valueObj) { expect(4); - equals( jQuery("#foo").text("
Hello cruel world!
")[0].innerHTML.replace(/>/g, ">"), "<div><b>Hello</b> cruel world!</div>", "Check escaped text" ); + var val = valueObj("
Hello cruel world!
"); + equals( jQuery("#foo").text(val)[0].innerHTML.replace(/>/g, ">"), "<div><b>Hello</b> cruel world!</div>", "Check escaped text" ); // using contents will get comments regular, text, and comment nodes var j = jQuery("#nonnodes").contents(); - j.text("hi!"); + j.text(valueObj("hi!")); equals( jQuery(j[0]).text(), "hi!", "Check node,textnode,comment with text()" ); equals( j[1].nodeValue, " there ", "Check node,textnode,comment with text()" ); equals( j[2].nodeType, 8, "Check node,textnode,comment with text()" );