diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2011-08-16 18:00:44 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2011-08-16 18:00:44 -0400 |
commit | 015328787cd2e52efbc77d1254ebcac13cc4ac53 (patch) | |
tree | 3901aec082b1d14f0a1f586566ec417f06543b9a /test/unit | |
parent | b22c9046529852c7ce567df13397849e11e2b9cc (diff) | |
download | jquery-015328787cd2e52efbc77d1254ebcac13cc4ac53.tar.gz jquery-015328787cd2e52efbc77d1254ebcac13cc4ac53.zip |
Fixes #10021. Allow negative relative values for `.css()` (e.g., `"+=-20px"`) since `.animate()` already allows it. Useful for when the relative value is a variable.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/css.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/unit/css.js b/test/unit/css.js index c01acdd68..acad497eb 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -109,7 +109,7 @@ test("css(String|Hash)", function() { }); test("css() explicit and relative values", function() { - expect(27); + expect(29); var $elem = jQuery("#nothiddendiv"); $elem.css({ width: 1, height: 1, paddingLeft: "1px", opacity: 1 }); @@ -141,6 +141,12 @@ test("css() explicit and relative values", function() { $elem.css( "width", "-=9px" ); equals( $elem.width(), 1, "'-=9px' on width (params)" ); + $elem.css( "width", "-=-9px" ); + equals( $elem.width(), 10, "'-=-9px' on width (params)" ); + + $elem.css( "width", "+=-9px" ); + equals( $elem.width(), 1, "'+=-9px' on width (params)" ); + $elem.css({ paddingLeft: "+=4" }); equals( $elem.css("paddingLeft"), "5px", "'+=4' on paddingLeft (hash)" ); |