aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/css.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2012-07-25 21:24:49 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-07-25 21:24:49 -0400
commited898c62c8d3e8c2091592976c181ee4142287ac (patch)
treefdd39a0023e6a7be39fe26b744644691c0db186e /test/unit/css.js
parent5119b252ac2f3391e9f23efef4852095e0d7e6b3 (diff)
downloadjquery-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.js13
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() {