aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/css.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2015-05-07 23:16:18 -0400
committerRichard Gibson <richard.gibson@gmail.com>2015-10-18 16:58:38 -0400
commit487d5ca913c237aafe9efa1179749b46382fddbf (patch)
tree80ba81e17553a2076ccc3e49999f533a8ad0ea27 /test/unit/css.js
parentc752a5030bc00eb5b45dea9c28963f824a5c4f44 (diff)
downloadjquery-487d5ca913c237aafe9efa1179749b46382fddbf.tar.gz
jquery-487d5ca913c237aafe9efa1179749b46382fddbf.zip
CSS: Correct misrepresentation of "auto" horizontal margins as 0
Fixes gh-2237 Closes gh-2276 (cherry picked from commit 214e1634ab9b1d13d53647dd5de3bdf7a091d49c) Conflicts: src/css.js src/css/support.js test/unit/support.js
Diffstat (limited to 'test/unit/css.js')
-rw-r--r--test/unit/css.js26
1 files changed, 20 insertions, 6 deletions
diff --git a/test/unit/css.js b/test/unit/css.js
index 5c9f3e01f..343459dfb 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -728,17 +728,31 @@ QUnit.test( "internal ref to elem.runtimeStyle (bug #7608)", function( assert )
assert.ok( result, "elem.runtimeStyle does not throw exception" );
} );
-QUnit.test( "marginRight computed style (bug #3333)", function( assert ) {
- assert.expect( 1 );
+QUnit.test( "computed margins (trac-3333; gh-2237)", function( assert ) {
+ assert.expect( 2 );
+
+ var $div = jQuery( "#foo" ),
+ $child = jQuery( "#en" );
- var $div = jQuery( "#foo" );
$div.css( {
"width": "1px",
"marginRight": 0
} );
-
- assert.equal( $div.css( "marginRight" ), "0px", "marginRight correctly calculated with a width and display block" );
-} );
+ assert.equal( $div.css( "marginRight" ), "0px",
+ "marginRight correctly calculated with a width and display block" );
+
+ $div.css({
+ position: "absolute",
+ top: 0,
+ left: 0,
+ width: "100px"
+ });
+ $child.css({
+ width: "50px",
+ margin: "auto"
+ });
+ assert.equal( $child.css( "marginLeft" ), "25px", "auto margins are computed to pixels" );
+});
QUnit.test( "box model properties incorrectly returning % instead of px, see #10639 and #12088", function( assert ) {
assert.expect( 2 );