Improve test stability for #13855 ticket. Close gh-1328.

This commit is contained in:
Oleg 2013-08-08 04:11:42 +04:00 committed by Richard Gibson
parent 1e9d43c0be
commit 34cc465792

19
test/unit/effects.js vendored
View File

@ -1445,16 +1445,13 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() {
}); });
}); });
test("line-height animates correctly (#13855)", function() { asyncTest("line-height animates correctly (#13855)", 12, function() {
expect( 12 );
stop();
var var
animated = jQuery( animated = jQuery(
"<p style='line-height: 4;'>unitless</p>" + "<p style='line-height: 5000;'>unitless</p>" +
"<p style='line-height: 50px;'>px</p>" + "<p style='line-height: 5000px;'>px</p>" +
"<p style='line-height: 420%;'>percent</p>" + "<p style='line-height: 5000%;'>percent</p>" +
"<p style='line-height: 2.5em;'>em</p>" "<p style='line-height: 5000em;'>em</p>"
).appendTo("#qunit-fixture"), ).appendTo("#qunit-fixture"),
initialHeight = jQuery.map( animated, function( el ) { initialHeight = jQuery.map( animated, function( el ) {
return jQuery( el ).height(); return jQuery( el ).height();
@ -1466,8 +1463,8 @@ test("line-height animates correctly (#13855)", function() {
var label = jQuery.text( this ), var label = jQuery.text( this ),
initial = initialHeight[ i ], initial = initialHeight[ i ],
height = jQuery( this ).height(); height = jQuery( this ).height();
ok( height < initial, "hide " + label + ": upper bound" ); ok( height < initial, "hide " + label + ": upper bound; height:" + height + "; intitial: " + initial );
ok( height > initial / 2, "hide " + label + ": lower bound" ); ok( height > initial / 2, "hide " + label + ": lower bound; height:" + height + "; intitial/2: " + initial / 2 );
}); });
animated.stop( true, true ).hide().animate( { "line-height": "show" }, 1500 ); animated.stop( true, true ).hide().animate( { "line-height": "show" }, 1500 );
setTimeout(function() { setTimeout(function() {
@ -1475,7 +1472,7 @@ test("line-height animates correctly (#13855)", function() {
var label = jQuery.text( this ), var label = jQuery.text( this ),
initial = initialHeight[ i ], initial = initialHeight[ i ],
height = jQuery( this ).height(); height = jQuery( this ).height();
ok( height < initial / 2, "show " + label + ": upper bound" ); ok( height < initial / 2, "show " + label + ": upper bound; height:" + height + "; intitial/2: " + initial / 2 );
}); });
animated.stop( true, true ); animated.stop( true, true );
start(); start();