aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortimmywil <timmywillisn@gmail.com>2012-01-20 15:57:11 -0500
committertimmywil <timmywillisn@gmail.com>2012-01-20 15:57:11 -0500
commit4eef88cf6d7a72b33f1796e7405d559a2e0f506c (patch)
treeec3d3805b98b049270b98037af6bfab597f54dba
parente8673ae1aafe16a8a7f855958f545c710bf8133e (diff)
downloadjquery-4eef88cf6d7a72b33f1796e7405d559a2e0f506c.tar.gz
jquery-4eef88cf6d7a72b33f1796e7405d559a2e0f506c.zip
Add unit tests for animation toggling from hide position. Supplements #10848.
-rw-r--r--test/unit/effects.js29
1 files changed, 23 insertions, 6 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js
index 49fa33d42..2078dc629 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -1146,13 +1146,15 @@ jQuery.each({
},
function( method, defProp ) {
test( method + "().stop()." + method + "()", function() {
- expect( 4 );
+ expect( 8 );
+
+ var animTime = 100;
jQuery.each([ "in", "out" ], function( i, type ) {
var $elem = jQuery( "#" + method.toLowerCase() + type ),
startVal = defProp( $elem );
- $elem[ method ]("fast");
+ $elem[ method ]( animTime );
stop();
setTimeout( function() {
@@ -1160,11 +1162,26 @@ function( method, defProp ) {
notEqual( defProp( $elem ), startVal, ".stop() is called about halfway through animation." );
- $elem[ method ]("fast", function() {
- equal( defProp( jQuery(this) ), startVal, "After doing .stop() halfway, check that state has been saved for returning to original property value." );
- start();
+ $elem[ method ](animTime, function() {
+ equal( defProp( $elem ), startVal, "After doing .stop() halfway through hide, check that state has been saved for returning to original property value." );
+
+ // Start from hidden position to show this time
+ $elem.hide()[ method ]( animTime );
+ setTimeout( function() {
+ $elem.stop();
+
+ notEqual( defProp( $elem ), startVal, ".stop() is called about halfway through animation." );
+
+ $elem[ method ](animTime, function() {
+ equal( defProp( $elem ), startVal, "After doing .stop() halfway through show, check that state has been saved for returning to original property value." );
+
+ // Remove olddisplay data from .hide() call
+ jQuery.removeData( this, "olddisplay", true );
+ start();
+ });
+ }, animTime / 2);
});
- }, 100);
+ }, animTime / 2);
});
});
});