mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Unit Tests & effects.scale: Fixing bugs in effects unit tests - Particularly IE, found a bug in scale.js in the meantime. Fixes #7395 - Size based effects are breaking unit tests in IE - also leaking a global var
This commit is contained in:
parent
4f0f407df3
commit
4fc5ea141d
@ -38,10 +38,13 @@
|
|||||||
.test {
|
.test {
|
||||||
background: #000;
|
background: #000;
|
||||||
border: 0;
|
border: 0;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
}
|
}
|
||||||
.testAddBorder {
|
.testAddBorder {
|
||||||
border: 10px solid #000;
|
border: 10px solid #000;
|
||||||
}
|
}
|
||||||
|
.testChildren,
|
||||||
.testChangeBackground {
|
.testChangeBackground {
|
||||||
background: #fff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
|
@ -77,12 +77,12 @@ asyncTest( "animateClass works with colors", function() {
|
|||||||
count = 0;
|
count = 0;
|
||||||
expect(2);
|
expect(2);
|
||||||
test.toggleClass("testChangeBackground", duration, function() {
|
test.toggleClass("testChangeBackground", duration, function() {
|
||||||
present( test.css("backgroundColor"), [ "#ffffff", "rgb(255, 255, 255)" ], "Color is final" );
|
present( test.css("backgroundColor"), [ "#ffffff", "#fff", "rgb(255, 255, 255)" ], "Color is final" );
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
var color = test.css("backgroundColor");
|
var color = test.css("backgroundColor");
|
||||||
notPresent( color, [ "#000000", "#ffffff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
|
notPresent( color, [ "#000000", "#ffffff", "#000", "#fff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
|
||||||
"Color is not endpoints in middle." );
|
"Color is not endpoints in middle." );
|
||||||
}, mid);
|
}, mid);
|
||||||
});
|
});
|
||||||
@ -92,19 +92,20 @@ asyncTest( "animateClass works with children", function() {
|
|||||||
h2 = test.find("h2");
|
h2 = test.find("h2");
|
||||||
|
|
||||||
expect(4);
|
expect(4);
|
||||||
|
setTimeout(function() {
|
||||||
|
notPresent( h2.css("fontSize"), ["10px","20px"], "Font size is neither endpoint when in middle.");
|
||||||
|
}, mid);
|
||||||
test.toggleClass("testChildren", { children: true, duration: duration, complete: function() {
|
test.toggleClass("testChildren", { children: true, duration: duration, complete: function() {
|
||||||
equal( h2.css("fontSize"), "20px", "Text size is final during complete");
|
equal( h2.css("fontSize"), "20px", "Text size is final during complete");
|
||||||
test.toggleClass("testChildren", duration, function() {
|
test.toggleClass("testChildren", duration, function() {
|
||||||
equal( h2.css("fontSize"), "10px", "Text size revertted after class removed");
|
equal( h2.css("fontSize"), "10px", "Text size revertted after class removed");
|
||||||
|
|
||||||
start();
|
start();
|
||||||
});
|
});
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
equal( h2.css("fontSize"), "20px", "Text size unchanged with children: undefined" );
|
equal( h2.css("fontSize"), "20px", "Text size unchanged during animate with children: undefined" );
|
||||||
}, mid);
|
}, mid);
|
||||||
}});
|
}});
|
||||||
setTimeout(function() {
|
|
||||||
notPresent( h2.css("fontSize"), ["10px","20px"], "Font size is neither endpoint when in middle.");
|
|
||||||
}, mid);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
})(jQuery);
|
})(jQuery);
|
||||||
|
2
ui/jquery.effects.core.js
vendored
2
ui/jquery.effects.core.js
vendored
@ -451,7 +451,7 @@ $.extend( $.effects, {
|
|||||||
setTransition: function( element, list, factor, value ) {
|
setTransition: function( element, list, factor, value ) {
|
||||||
value = value || {};
|
value = value || {};
|
||||||
$.each( list, function(i, x){
|
$.each( list, function(i, x){
|
||||||
unit = element.cssUnit( x );
|
var unit = element.cssUnit( x );
|
||||||
if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
|
if ( unit[ 0 ] > 0 ) value[ x ] = unit[ 0 ] * factor + unit[ 1 ];
|
||||||
});
|
});
|
||||||
return value;
|
return value;
|
||||||
|
20
ui/jquery.effects.scale.js
vendored
20
ui/jquery.effects.scale.js
vendored
@ -115,11 +115,15 @@ $.effects.effect.size = function( o ) {
|
|||||||
restore = o.restore || false,
|
restore = o.restore || false,
|
||||||
scale = o.scale || 'both',
|
scale = o.scale || 'both',
|
||||||
origin = o.origin,
|
origin = o.origin,
|
||||||
original = {
|
original, baseline, factor;
|
||||||
height: el.height(),
|
|
||||||
width: el.width()
|
if ( mode === "show" ) {
|
||||||
},
|
el.show();
|
||||||
baseline, factor;
|
}
|
||||||
|
original = {
|
||||||
|
height: el.height(),
|
||||||
|
width: el.width()
|
||||||
|
};
|
||||||
|
|
||||||
el.from = o.from || original;
|
el.from = o.from || original;
|
||||||
el.to = o.to || original;
|
el.to = o.to || original;
|
||||||
@ -149,14 +153,14 @@ $.effects.effect.size = function( o ) {
|
|||||||
if ( scale == 'box' || scale == 'both' ) {
|
if ( scale == 'box' || scale == 'both' ) {
|
||||||
|
|
||||||
// Vertical props scaling
|
// Vertical props scaling
|
||||||
if ( factor.from.y != factor.to.y ) {
|
if ( factor.from.y !== factor.to.y ) {
|
||||||
props = props.concat( vProps );
|
props = props.concat( vProps );
|
||||||
el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
|
el.from = $.effects.setTransition( el, vProps, factor.from.y, el.from );
|
||||||
el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
|
el.to = $.effects.setTransition( el, vProps, factor.to.y, el.to );
|
||||||
};
|
};
|
||||||
|
|
||||||
// Horizontal props scaling
|
// Horizontal props scaling
|
||||||
if ( factor.from.x != factor.to.x ) {
|
if ( factor.from.x !== factor.to.x ) {
|
||||||
props = props.concat( hProps );
|
props = props.concat( hProps );
|
||||||
el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
|
el.from = $.effects.setTransition( el, hProps, factor.from.x, el.from );
|
||||||
el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
|
el.to = $.effects.setTransition( el, hProps, factor.to.x, el.to );
|
||||||
@ -167,7 +171,7 @@ $.effects.effect.size = function( o ) {
|
|||||||
if ( scale == 'content' || scale == 'both' ) {
|
if ( scale == 'content' || scale == 'both' ) {
|
||||||
|
|
||||||
// Vertical props scaling
|
// Vertical props scaling
|
||||||
if ( factor.from.y != factor.to.y ) {
|
if ( factor.from.y !== factor.to.y ) {
|
||||||
props = props.concat( cProps );
|
props = props.concat( cProps );
|
||||||
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
|
el.from = $.effects.setTransition( el, cProps, factor.from.y, el.from );
|
||||||
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
|
el.to = $.effects.setTransition( el, cProps, factor.to.y, el.to );
|
||||||
|
Loading…
Reference in New Issue
Block a user