X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fmanipulation.js;h=d4c43487192395dbfaadfeb183d4dada4fd8a17b;hb=51283d9643726721acc415dba891004a30cf1ae6;hp=7b4f4d15909ae15f2cf7e280dced211ed03df4f2;hpb=2ae872c594790c4b935a1d7eabdf8b8212fd3c3f;p=jquery.git diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index 7b4f4d1..d4c4348 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -680,7 +680,7 @@ test("insertAfter(String|Element|Array<Element>|jQuery)", function() { }); var testReplaceWith = function(val) { - expect(17); + expect(20); jQuery('#yahoo').replaceWith(val( 'buga' )); ok( jQuery("#replace")[0], 'Replace element with string' ); ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' ); @@ -748,6 +748,17 @@ var testReplaceWith = function(val) { //""); equals(jQuery('.replacewith').length, 1, 'Check number of elements in page.'); jQuery('.replacewith').remove(); + + QUnit.reset(); + + jQuery("#main").append("
"); + equals( jQuery("#main").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." ); + + jQuery("#replaceWith").replaceWith( val("
") ); + equals( jQuery("#main").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." ); + + jQuery("#replaceWith").replaceWith( val("
") ); + equals( jQuery("#main").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." ); } test("replaceWith(String|Element|Array<Element>|jQuery)", function() { @@ -757,7 +768,7 @@ test("replaceWith(String|Element|Array<Element>|jQuery)", function() { test("replaceWith(Function)", function() { testReplaceWith(functionReturningObj); - expect(18); + expect(21); var y = jQuery("#yahoo")[0];