X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Feffects.js;h=919e3ea4c6eadea4fdf0547376fa4683e08cdc21;hb=90a4abd5111e57213059eb80876551ae1fac6c53;hp=2c5616dd92b5c4ee3a2950f798a8679e4081068f;hpb=b70872f70d720e5f25eea7fdf0453804074dc194;p=jquery.git diff --git a/test/unit/effects.js b/test/unit/effects.js index 2c5616d..919e3ea 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('

'); @@ -120,7 +138,7 @@ test("animate option (queue === false)", function () { */ test("animate with no properties", function() { - expect(1); + expect(2); var divs = jQuery("div"), count = 0; @@ -129,6 +147,16 @@ test("animate with no properties", function() { }); equals( divs.length, count, "Make sure that callback is called for each element in the set." ); + + stop(); + + var foo = jQuery("#foo"); + + foo.animate({}); + foo.animate({top: 10}, 100, function(){ + ok( true, "Animation was properly dequeued." ); + start(); + }); }); test("animate duration 0", function() {