Fix #13855: line-height animations. Close gh-1265.

(cherry picked from commit 3971c2ebb2)
This commit is contained in:
Richard Gibson
2013-05-08 22:56:51 -04:00
parent e0f59600a4
commit 42c25656d1
3 changed files with 102 additions and 60 deletions

38
test/unit/effects.js vendored
View File

@@ -1405,6 +1405,44 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() {
});
});
test("line-height animates correctly (#13855)", function() {
expect( 12 );
stop();
var
animated = jQuery(
"<p style='line-height: 4;'>unitless</p>" +
"<p style='line-height: 50px;'>px</p>" +
"<p style='line-height: 420%;'>percent</p>" +
"<p style='line-height: 2.5em;'>em</p>"
).appendTo("#qunit-fixture"),
initialHeight = jQuery.map( animated, function( el ) {
return jQuery( el ).height();
});
animated.animate( { "line-height": "hide" }, 1500 );
setTimeout(function() {
animated.each(function( i ) {
var label = jQuery.text( this ),
initial = initialHeight[ i ],
height = jQuery( this ).height();
ok( height < initial, "hide " + label + ": upper bound" );
ok( height > initial / 2, "hide " + label + ": lower bound" );
});
animated.stop( true, true ).hide().animate( { "line-height": "show" }, 1500 );
setTimeout(function() {
animated.each(function( i ) {
var label = jQuery.text( this ),
initial = initialHeight[ i ],
height = jQuery( this ).height();
ok( height < initial / 2, "show " + label + ": upper bound" );
});
animated.stop( true, true );
start();
}, 400 );
}, 400 );
});
// Start 1.8 Animation tests
asyncTest( "jQuery.Animation( object, props, opts )", 4, function() {
var animation,