Skip to content

Commit

Permalink
Added test for passing null to .show()
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Gonzalez authored and jeresig committed Nov 13, 2009
1 parent 9cd5866 commit 8cb8ae2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/unit/fx.js
@@ -1,13 +1,19 @@
module("fx");

test("show()", function() {
expect(15);
expect(16);
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;
});
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>');

var old = jQuery("#show-tests table").show().css("display") !== "table";
Expand Down

3 comments on commit 8cb8ae2

@DBJDBJ
Copy link

@DBJDBJ DBJDBJ commented on 8cb8ae2 Nov 13, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are jokers who pass number to $(). For some devious reasons. Can/should we add :

if ( "number" === typeof arguments[0] ) return ;

Into the $(), itself ?

@jeresig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No? I mean, otherwise we would be checking for every possible input and that doesn't really make much sense - I mean if someone wants to try and use jQuery in a non-standard way, we shouldn't really stop them (unless it's in an unintended way - such as passing in a null or undefined).

@DBJDBJ
Copy link

@DBJDBJ DBJDBJ commented on 8cb8ae2 Nov 14, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Please sign in to comment.