diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2012-07-25 21:24:49 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-07-25 21:24:49 -0400 |
commit | ed898c62c8d3e8c2091592976c181ee4142287ac (patch) | |
tree | fdd39a0023e6a7be39fe26b744644691c0db186e /test/unit/css.js | |
parent | 5119b252ac2f3391e9f23efef4852095e0d7e6b3 (diff) | |
download | jquery-ed898c62c8d3e8c2091592976c181ee4142287ac.tar.gz jquery-ed898c62c8d3e8c2091592976c181ee4142287ac.zip |
Fix #12148. Let .toggle() call the public .hide() for punching.
There is a slightly shorter way to do this but it's not Closure-friendly.
Diffstat (limited to 'test/unit/css.js')
-rw-r--r-- | test/unit/css.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/unit/css.js b/test/unit/css.js index 45aee9f06..c2142052a 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -561,7 +561,7 @@ test( "show() resolves correct default display, detached nodes (#10006)", functi }); test("toggle()", function() { - expect(6); + expect(7); var x = jQuery("#foo"); ok( x.is(":visible"), "is visible" ); x.toggle(); @@ -575,6 +575,17 @@ test("toggle()", function() { ok( x.is(":hidden"), "is hidden" ); x.toggle(true); ok( x.is(":visible"), "is visible again" ); + + // Ensure hide() is called when toggled (#12148) + var oldHide = jQuery.fn.hide; + jQuery.fn.hide = function() { + ok( true, name + " method called on toggle" ); + return oldHide.apply( this, arguments ); + }; + x.toggle( name === "show" ); + jQuery.fn.hide = oldHide; + + }); test("hide hidden elements (bug #7141)", function() { |