aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/effects.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2012-08-09 21:30:51 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-08-09 21:30:51 -0400
commit77412e03056b2299309638212ae708acc190664c (patch)
tree94c467e02c037ad8414f6a6a9b44b7ee250eb366 /test/unit/effects.js
parente41553950debb135eaea303dc82f2dc5e19056be (diff)
downloadjquery-77412e03056b2299309638212ae708acc190664c.tar.gz
jquery-77412e03056b2299309638212ae708acc190664c.zip
Wait for both .stop() tests to finish, don't count on timing.
Diffstat (limited to 'test/unit/effects.js')
-rw-r--r--test/unit/effects.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/unit/effects.js b/test/unit/effects.js
index 4353e1566..0eb2a3156 100644
--- a/test/unit/effects.js
+++ b/test/unit/effects.js
@@ -552,27 +552,30 @@ test("animate non-element", function() {
});
test("stop()", function() {
- expect(4);
+ expect( 4 );
stop();
- var $foo = jQuery("#foo");
- var w = 0;
+ var $foo = jQuery("#foo"),
+ tests = 2,
+ w = 0;
$foo.hide().css( "width", 200 )
- .animate( { "width": "show" }, 1000 );
+ .animate( { "width": "show" }, 1500 );
setTimeout(function() {
var nw = $foo.css("width");
- notEqual( parseFloat( nw ), w, "An animation occurred " + nw + " " + w + "px");
+ notEqual( parseFloat( nw ), w, "An animation occurred " + nw + " " + w + "px" );
$foo.stop();
nw = $foo.css("width");
- notEqual( parseFloat( nw ), w, "Stop didn't reset the animation " + nw + " " + w + "px");
+ notEqual( parseFloat( nw ), w, "Stop didn't reset the animation " + nw + " " + w + "px" );
setTimeout(function() {
$foo.removeData();
$foo.removeData(undefined, true);
equal( nw, $foo.css("width"), "The animation didn't continue" );
- start();
+ if ( --tests === 0 ) {
+ start();
+ }
}, 100);
}, 100);
@@ -586,6 +589,9 @@ test("stop()", function() {
equal( $two.css("opacity"), "0", "Stop does not interfere with animations on other elements (#6641)" );
// Reset styles
$one.add( $two ).css("opacity", "");
+ if ( --tests === 0 ) {
+ start();
+ }
});
}, 50);
});