Skip to content
Permalink
Browse files

Add back unit in the width/height step function. Fixes #10669.

  • Loading branch information...
timmywil committed Nov 7, 2011
1 parent a7e911b commit 1e677f30f68d8ea41261aa666a9ba0720383e9d0
Showing with 16 additions and 1 deletion.
  1. +1 −1 src/effects.js
  2. +15 −0 test/unit/effects.js
@@ -620,7 +620,7 @@ jQuery.extend( jQuery.fx, {
// Do not set anything below 0
jQuery.each([ "width", "height" ], function( i, prop ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) );
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
};
});

@@ -324,6 +324,21 @@ test("animate table-cell width/height", function() {
});
});

test("animate percentage(%) on width/height", function() {
expect( 2 );

var $div = jQuery("<div style='position:absolute;top:-999px;left:-999px;width:60px;height:60px;'><div style='width:50%;height:50%;'></div></div>")
.appendTo("#qunit-fixture").children("div");

stop();
$div.animate({ width: "25%", height: "25%" }, 13, function() {
var $this = jQuery(this);
equal( $this.width(), 15, "Width was animated to 15px rather than 25px");
equal( $this.height(), 15, "Height was animated to 15px rather than 25px");
start();
});
});

test("animate resets overflow-x and overflow-y when finished", function() {
expect(2);
stop();

0 comments on commit 1e677f3

Please sign in to comment.
You can’t perform that action at this time.