Commit 77412e03 authored by Dave Methvin's avatar Dave Methvin

Wait for both .stop() tests to finish, don't count on timing.

parent e4155395
...@@ -552,27 +552,30 @@ test("animate non-element", function() { ...@@ -552,27 +552,30 @@ test("animate non-element", function() {
}); });
test("stop()", function() { test("stop()", function() {
expect(4); expect( 4 );
stop(); stop();
var $foo = jQuery("#foo"); var $foo = jQuery("#foo"),
var w = 0; tests = 2,
w = 0;
$foo.hide().css( "width", 200 ) $foo.hide().css( "width", 200 )
.animate( { "width": "show" }, 1000 ); .animate( { "width": "show" }, 1500 );
setTimeout(function() { setTimeout(function() {
var nw = $foo.css("width"); 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(); $foo.stop();
nw = $foo.css("width"); 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() { setTimeout(function() {
$foo.removeData(); $foo.removeData();
$foo.removeData(undefined, true); $foo.removeData(undefined, true);
equal( nw, $foo.css("width"), "The animation didn't continue" ); equal( nw, $foo.css("width"), "The animation didn't continue" );
start(); if ( --tests === 0 ) {
start();
}
}, 100); }, 100);
}, 100); }, 100);
...@@ -586,6 +589,9 @@ test("stop()", function() { ...@@ -586,6 +589,9 @@ test("stop()", function() {
equal( $two.css("opacity"), "0", "Stop does not interfere with animations on other elements (#6641)" ); equal( $two.css("opacity"), "0", "Stop does not interfere with animations on other elements (#6641)" );
// Reset styles // Reset styles
$one.add( $two ).css("opacity", ""); $one.add( $two ).css("opacity", "");
if ( --tests === 0 ) {
start();
}
}); });
}, 50); }, 50);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment