aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2017-09-08 17:14:57 -0400
committerRichard Gibson <richard.gibson@gmail.com>2017-09-08 17:14:57 -0400
commit8ea78caa8297e9fa5bf3d13b3d14609a24679f76 (patch)
treeab0626fcf030096a9741a450cbfa2a5902061dd5
parent692f9d4db30c9c6c4f6bc76005cf153586202fa6 (diff)
downloadjquery-8ea78caa8297e9fa5bf3d13b3d14609a24679f76.tar.gz
jquery-8ea78caa8297e9fa5bf3d13b3d14609a24679f76.zip
Tests: Update lineHeight adjustments to give Android more slop
-rw-r--r--test/unit/css.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/unit/css.js b/test/unit/css.js
index 79cce0549..285ad2ef0 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -221,16 +221,12 @@ QUnit.test( "css() non-px relative values (gh-1711)", function( assert ) {
// Apply change
$child.css( prop, adjustment );
cssCurrent = parseFloat( $child.css( prop ) );
+ message += " (actual " + round( cssCurrent, 2 ) + "px, expected " +
+ round( expected, 2 ) + "px)";
// Require a difference of no more than one pixel
difference = Math.abs( cssCurrent - expected );
- if ( difference <= 1 ) {
- assert.ok( true, message );
-
- // ...or fail with actual and expected values
- } else {
- assert.ok( false, message + " (actual " + cssCurrent + ", expected " + expected + ")" );
- }
+ assert.ok( difference <= 1, message );
},
getUnits = function( prop ) {
units[ prop ] = {
@@ -240,8 +236,12 @@ QUnit.test( "css() non-px relative values (gh-1711)", function( assert ) {
"pc": parseFloat( $child.css( prop, "100pc" ).css( prop ) ) / 100,
"cm": parseFloat( $child.css( prop, "100cm" ).css( prop ) ) / 100,
"mm": parseFloat( $child.css( prop, "100mm" ).css( prop ) ) / 100,
- "%": parseFloat( $child.css( prop, "100%" ).css( prop ) ) / 100
+ "%": parseFloat( $child.css( prop, "500%" ).css( prop ) ) / 500
};
+ },
+ round = function( num, fractionDigits ) {
+ var base = Math.pow( 10, fractionDigits );
+ return Math.round( num * base ) / base;
};
jQuery( "#nothiddendiv" ).css( { height: 1, padding: 0, width: 400 } );
@@ -267,7 +267,7 @@ QUnit.test( "css() non-px relative values (gh-1711)", function( assert ) {
add( "lineHeight", 20, "pt" );
add( "lineHeight", 30, "pc" );
add( "lineHeight", 1, "cm" );
- add( "lineHeight", -20, "mm" );
+ add( "lineHeight", -44, "mm" );
add( "lineHeight", 50, "%" );
} );