aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/css.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2017-08-28 13:23:04 -0400
committerGitHub <noreply@github.com>2017-08-28 13:23:04 -0400
commit692f9d4db30c9c6c4f6bc76005cf153586202fa6 (patch)
treee90a47a8b012a0758c0079918e9fe049831aeaad /test/unit/css.js
parentb1b949d35ee995ee75c6968715a7f8c8ea601157 (diff)
downloadjquery-692f9d4db30c9c6c4f6bc76005cf153586202fa6.tar.gz
jquery-692f9d4db30c9c6c4f6bc76005cf153586202fa6.zip
CSS: Avoid unit-conversion interference from CSS upper bounds
Fixes gh-2144 Closes gh-3745
Diffstat (limited to 'test/unit/css.js')
-rw-r--r--test/unit/css.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/css.js b/test/unit/css.js
index 4533e4692..79cce0549 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -271,6 +271,22 @@ QUnit.test( "css() non-px relative values (gh-1711)", function( assert ) {
add( "lineHeight", 50, "%" );
} );
+QUnit.test( "css() mismatched relative values with bounded styles (gh-2144)", function( assert ) {
+ assert.expect( 1 );
+
+ var right,
+ $container = jQuery( "<div/>" )
+ .css( { position: "absolute", width: "400px", fontSize: "4px" } )
+ .appendTo( "#qunit-fixture" ),
+ $el = jQuery( "<div/>" )
+ .css( { position: "absolute", left: "50%", right: "50%" } )
+ .appendTo( $container );
+
+ $el.css( "right", "-=25em" );
+ assert.equal( Math.round( parseFloat( $el.css( "right" ) ) ), 100,
+ "Constraints do not interfere with unit conversion" );
+} );
+
QUnit.test( "css(String, Object)", function( assert ) {
assert.expect( 19 );
var j, div, display, ret, success;