});
var testReplaceWith = function(val) {
- expect(17);
+ expect(20);
jQuery('#yahoo').replaceWith(val( '<b id="replace">buga</b>' ));
ok( jQuery("#replace")[0], 'Replace element with string' );
ok( !jQuery("#yahoo")[0], 'Verify that original element is gone, after string' );
//"</script>");
equals(jQuery('.replacewith').length, 1, 'Check number of elements in page.');
jQuery('.replacewith').remove();
+
+ QUnit.reset();
+
+ jQuery("#main").append("<div id='replaceWith'></div>");
+ equals( jQuery("#main").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." );
+
+ jQuery("#replaceWith").replaceWith( val("<div id='replaceWith'></div>") );
+ equals( jQuery("#main").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." );
+
+ jQuery("#replaceWith").replaceWith( val("<div id='replaceWith'></div>") );
+ equals( jQuery("#main").find("div[id=replaceWith]").length, 1, "Make sure only one div exists." );
}
test("replaceWith(String|Element|Array<Element>|jQuery)", function() {
test("replaceWith(Function)", function() {
testReplaceWith(functionReturningObj);
- expect(18);
+ expect(21);
var y = jQuery("#yahoo")[0];