aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/manipulation.js
diff options
context:
space:
mode:
authorOleg <markelog@gmail.com>2013-09-17 13:24:27 +0400
committerOleg <markelog@gmail.com>2013-09-17 13:24:27 +0400
commit642e9a45579cfa90861b8ea71a95dd077775caaf (patch)
tree4a07b3d4ed45da3bb54559ec63e9b5e9c519ec89 /test/unit/manipulation.js
parent80538b04fd4ce8bd531d3d1fb60236a315c82d80 (diff)
downloadjquery-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.js15
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 + ")" );
});
});