Commit d16fe84d authored by Richard Gibson's avatar Richard Gibson

No ticket: Improve line-height animation test stability

parent ff156d77
...@@ -1450,7 +1450,8 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() { ...@@ -1450,7 +1450,8 @@ test("Do not append px to 'fill-opacity' #9548", 1, function() {
}); });
asyncTest("line-height animates correctly (#13855)", 12, function() { asyncTest("line-height animates correctly (#13855)", 12, function() {
var longDuration = 2000, var t0,
longDuration = 2000,
shortDuration = 500, shortDuration = 500,
animated = jQuery( animated = jQuery(
"<p style='line-height: 100;'>unitless</p>" + "<p style='line-height: 100;'>unitless</p>" +
...@@ -1461,10 +1462,14 @@ asyncTest("line-height animates correctly (#13855)", 12, function() { ...@@ -1461,10 +1462,14 @@ asyncTest("line-height animates correctly (#13855)", 12, function() {
initialHeight = jQuery.map( animated, function( el ) { initialHeight = jQuery.map( animated, function( el ) {
return jQuery( el ).height(); return jQuery( el ).height();
}), }),
tolerance = 1.5, tolerance = 1.5;
// Delay start to improve test stability
setTimeout(function() {
t0 = +(new Date()); t0 = +(new Date());
animated.animate( { "line-height": "hide" }, longDuration, "linear" );
animated.animate( { "line-height": "hide" }, longDuration );
setTimeout(function() { setTimeout(function() {
var progress = ( (new Date()) - t0 ) / longDuration; var progress = ( (new Date()) - t0 ) / longDuration;
...@@ -1480,7 +1485,9 @@ asyncTest("line-height animates correctly (#13855)", 12, function() { ...@@ -1480,7 +1485,9 @@ asyncTest("line-height animates correctly (#13855)", 12, function() {
}); });
t0 = +(new Date()); t0 = +(new Date());
animated.stop( true, true ).hide().animate( { "line-height": "show" }, longDuration ); animated.stop( true, true ).hide()
.animate( { "line-height": "show" }, longDuration, "linear" );
setTimeout(function() { setTimeout(function() {
var progress = ( (new Date()) - t0 ) / longDuration; var progress = ( (new Date()) - t0 ) / longDuration;
...@@ -1497,6 +1504,7 @@ asyncTest("line-height animates correctly (#13855)", 12, function() { ...@@ -1497,6 +1504,7 @@ asyncTest("line-height animates correctly (#13855)", 12, function() {
start(); start();
}, shortDuration ); }, shortDuration );
}, shortDuration ); }, shortDuration );
}, 50 );
}); });
// Start 1.8 Animation tests // Start 1.8 Animation tests
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment