Skip to content

Commit

Permalink
Landing pull request 372. Test for numeric properties was using wrong…
Browse files Browse the repository at this point in the history
… variable. Fixes #9074.

More Details:
 - jquery#372
  • Loading branch information
gnarf authored and timmywil committed May 7, 2011
1 parent 97ee042 commit 2eb1d71
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ jQuery.fn.extend({

for ( p in prop ) {
e = new jQuery.fx( this, opt, p );

val = prop[p];

if ( rfxtypes.test(val) ) {
Expand All @@ -214,7 +213,7 @@ jQuery.fn.extend({

if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ name ] ? "" : "px" );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );

// We need to compute starting value
if ( unit !== "px" ) {
Expand Down
34 changes: 31 additions & 3 deletions test/unit/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ test("show()", function() {

hiddendiv.css("display","");

var pass = true, div = jQuery("#qunit-fixture div");
var pass = true;
div = jQuery("#qunit-fixture div");
div.show().each(function(){
if ( this.style.display == "none" ) pass = false;
});
Expand Down Expand Up @@ -582,7 +583,7 @@ jQuery.checkOverflowDisplay = function(){
equals(jQuery.css( this, "display" ), "inline", "Display shouldn't be tampered with.");

start();
}
};

test( "jQuery.fx.prototype.cur()", 6, function() {
var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" ).css({
Expand Down Expand Up @@ -901,7 +902,7 @@ jQuery.makeTest = function( text ){
.after( elem );

return elem;
}
};

jQuery.makeTest.id = 1;

Expand Down Expand Up @@ -993,3 +994,30 @@ test("animate unit-less properties (#4966)", 2, function() {
start();
});
});

test( "animate properties missing px w/ opacity as last (#9074)", 2, function() {
expect( 6 );
stop();
var div = jQuery( "<div style='position: absolute; margin-left: 0; left: 0px;'></div>" )
.appendTo( "#qunit-fixture" );
function cssInt( prop ) {
return parseInt( div.css( prop ), 10 );
}
equal( cssInt( "marginLeft" ), 0, "Margin left is 0" );
equal( cssInt( "left" ), 0, "Left is 0" );
div.animate({
left: 200,
marginLeft: 200,
opacity: 0
}, 1000);
setTimeout(function() {
var ml = cssInt( "marginLeft" ),
l = cssInt( "left" );
notEqual( ml, 0, "Margin left is not 0 after partial animate" );
notEqual( ml, 200, "Margin left is not 200 after partial animate" );
notEqual( l, 0, "Left is not 0 after partial animate" );
notEqual( l, 200, "Left is not 200 after partial animate" );
div.stop().remove();
start();
}, 100);
});

0 comments on commit 2eb1d71

Please sign in to comment.