Commit 192bab8e authored by John Resig's avatar John Resig

jQuery.css() returns a string value - handle this properly in the animation code.

parent d1f3dc9a
...@@ -321,7 +321,7 @@ jQuery.fx.prototype = { ...@@ -321,7 +321,7 @@ jQuery.fx.prototype = {
return this.elem[ this.prop ]; return this.elem[ this.prop ];
} }
var r = jQuery.css( this.elem, this.prop ); var r = parseFloat( jQuery.css( this.elem, this.prop ), 10 );
return r && r > -10000 ? r : 0; return r && r > -10000 ? r : 0;
}, },
......
...@@ -240,11 +240,11 @@ test("stop()", function() { ...@@ -240,11 +240,11 @@ test("stop()", function() {
$foo.animate({ width:'show' }, 1000); $foo.animate({ width:'show' }, 1000);
setTimeout(function(){ setTimeout(function(){
var nw = $foo.width(); var nw = $foo.width();
ok( nw != w, "An animation occurred " + nw + "px " + w + "px"); notEqual( nw, w, "An animation occurred " + nw + "px " + w + "px");
$foo.stop(); $foo.stop();
nw = $foo.width(); nw = $foo.width();
ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px"); notEqual( nw, w, "Stop didn't reset the animation " + nw + "px " + w + "px");
setTimeout(function(){ setTimeout(function(){
equals( nw, $foo.width(), "The animation didn't continue" ); equals( nw, $foo.width(), "The animation didn't continue" );
start(); start();
...@@ -266,13 +266,12 @@ test("stop() - several in queue", function() { ...@@ -266,13 +266,12 @@ test("stop() - several in queue", function() {
setTimeout(function(){ setTimeout(function(){
equals( $foo.queue().length, 3, "All 3 still in the queue" ); equals( $foo.queue().length, 3, "All 3 still in the queue" );
var nw = $foo.width(); var nw = $foo.width();
ok( nw != w, "An animation occurred " + nw + "px " + w + "px"); notEqual( nw, w, "An animation occurred " + nw + "px " + w + "px");
$foo.stop(); $foo.stop();
nw = $foo.width(); nw = $foo.width();
ok( nw != w, "Stop didn't reset the animation " + nw + "px " + w + "px"); notEqual( nw, w, "Stop didn't reset the animation " + nw + "px " + w + "px");
// Disabled, being flaky
//equals( $foo.queue().length, 1, "The next animation continued" );
$foo.stop(true); $foo.stop(true);
start(); start();
}, 100); }, 100);
...@@ -517,7 +516,7 @@ jQuery.each( { ...@@ -517,7 +516,7 @@ jQuery.each( {
if ( t_h == "show" ) { if ( t_h == "show" ) {
var old_h = jQuery.css(this, "height"); var old_h = jQuery.css(this, "height");
jQuery(this).append("<br/>Some more text<br/>and some more..."); jQuery(this).append("<br/>Some more text<br/>and some more...");
notEqual(jQuery.css(this, "height"), old_h, "Make sure height is auto."); notEqual(jQuery.css(this, "height") + "px", old_h, "Make sure height is auto.");
} }
start(); start();
......
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