X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Feffects.js;h=9ff5014c86dd53c651cb95cb800a3ba481f060f8;hb=70377a65e2a1c8478f3dc1e0e125b7b25b5324f3;hp=cefcc15a47e04f8baaac36402e9ee6f52e52cb14;hpb=0d5bd174614fa278826ac4aaaa64342f17c0ae56;p=jquery.git diff --git a/test/unit/effects.js b/test/unit/effects.js index cefcc15..9ff5014 100644 --- a/test/unit/effects.js +++ b/test/unit/effects.js @@ -1,18 +1,36 @@ module("effects"); test("show()", function() { - expect(16); + expect(23); var pass = true, div = jQuery("#main div"); div.show().each(function(){ if ( this.style.display == "none" ) pass = false; }); ok( pass, "Show" ); - pass = true; - div.hide().show(null).each(function() { - if ( this.style.display == "none" ) pass = false; + var speeds = { + "null speed": null, + "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('

'); @@ -43,7 +61,7 @@ test("show()", function() { test("show(Number) - other displays", function() { expect(15); - reset(); + QUnit.reset(); stop(); jQuery("#main").append('

'); @@ -462,7 +480,7 @@ jQuery.each( { if ( t_h == "hide"||t_h == "show" ) equals(this.style.height.indexOf(f_h), 0, "Height must be reset to " + f_h + ": " + this.style.height); - var cur_o = jQuery.style(this, "opacity"); + var cur_o = jQuery.css(this, "opacity", undefined, true); if ( cur_o !== "" ) cur_o = parseFloat( cur_o ); if ( t_o == "hide"||t_o == "show" ) @@ -474,7 +492,7 @@ jQuery.each( { if ( t_o.constructor == Number ) { equals(cur_o, t_o, "Final opacity should be " + t_o + ": " + cur_o); - ok(jQuery.curCSS(this, "opacity") != "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o); + ok(jQuery.css(this, "opacity") != "" || cur_o == t_o, "Opacity should be explicitly set to " + t_o + ", is instead: " + cur_o); } if ( t_w.constructor == Number ) { @@ -494,7 +512,7 @@ jQuery.each( { } if ( t_h == "show" ) { - var old_h = jQuery.curCSS(this, "height"); + var old_h = jQuery.css(this, "height"); jQuery(elem).append("
Some more text
and some more..."); ok(old_h != jQuery.css(this, "height" ), "Make sure height is auto."); }