diff options
author | Oleg <markelog@gmail.com> | 2013-09-17 13:24:27 +0400 |
---|---|---|
committer | Oleg <markelog@gmail.com> | 2013-09-17 13:24:27 +0400 |
commit | 642e9a45579cfa90861b8ea71a95dd077775caaf (patch) | |
tree | 4a07b3d4ed45da3bb54559ec63e9b5e9c519ec89 /test/unit/manipulation.js | |
parent | 80538b04fd4ce8bd531d3d1fb60236a315c82d80 (diff) | |
download | jquery-642e9a45579cfa90861b8ea71a95dd077775caaf.tar.gz jquery-642e9a45579cfa90861b8ea71a95dd077775caaf.zip |
Simplify replaceWith method. Closes gh-1276
Diffstat (limited to 'test/unit/manipulation.js')
-rw-r--r-- | test/unit/manipulation.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/unit/manipulation.js b/test/unit/manipulation.js index fae407751..ad89bd1be 100644 --- a/test/unit/manipulation.js +++ b/test/unit/manipulation.js @@ -1010,20 +1010,21 @@ test( "replaceWith(string) for more than one element", function() { equal(jQuery("#foo p").length, 0, "verify that all the three original element have been replaced"); }); -test( "empty replaceWith (#13401; #13596)", 4, function() { - expect( 6 ); - - var $el = jQuery("<div/>"), +test( "Empty replaceWith (#13401; #13596)", 8, function() { + var $el = jQuery( "<div/>" ), tests = { "empty string": "", "empty array": [], - "empty collection": jQuery("#nonexistent") + "empty collection": jQuery( "#nonexistent" ), + + // in case of jQuery(...).replaceWith(); + "empty undefined": undefined }; jQuery.each( tests, function( label, input ) { - $el.html("<a/>").children().replaceWith( input ); + $el.html( "<a/>" ).children().replaceWith( input ); strictEqual( $el.html(), "", "replaceWith(" + label + ")" ); - $el.html("<b/>").children().replaceWith(function() { return input; }); + $el.html( "<b/>" ).children().replaceWith(function() { return input; }); strictEqual( $el.html(), "", "replaceWith(function returning " + label + ")" ); }); }); |