Commit a63754aa authored by Karl Swedberg's avatar Karl Swedberg Committed by John Resig

added tests for show/hide with falsy, non-zero values

parent 21441b1c
module("effects"); module("effects");
test("show()", function() { test("show()", function() {
expect(16); expect(23);
var pass = true, div = jQuery("#main div"); var pass = true, div = jQuery("#main div");
div.show().each(function(){ div.show().each(function(){
if ( this.style.display == "none" ) pass = false; if ( this.style.display == "none" ) pass = false;
}); });
ok( pass, "Show" ); ok( pass, "Show" );
pass = true; var speeds = {
div.hide().show(null).each(function() { "null speed": null,
if ( this.style.display == "none" ) pass = false; "undefined speed": undefined,
"empty string speed": "",
"false speed": false
};
jQuery.each(speeds, function(name, speed) {
pass = true;
div.hide().show(speed).each(function() {
if ( this.style.display == "none" ) pass = false;
});
ok( pass, "Show with " + name);
});
jQuery.each(speeds, function(name, speed) {
pass = true;
div.hide().show(speed, function() {
pass = false;
});
ok( pass, "Show with " + name + " does not call animate callback");
}); });
ok( pass, "Show will null speed");
jQuery("#main").append('<div id="show-tests"><div><p><a href="#"></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>'); jQuery("#main").append('<div id="show-tests"><div><p><a href="#"></a></p><code></code><pre></pre><span></span></div><table><thead><tr><th></th></tr></thead><tbody><tr><td></td></tr></tbody></table><ul><li></li></ul></div>');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment