diff options
author | Dan Heberden <danheberden@gmail.com> | 2011-04-04 16:48:24 -0700 |
---|---|---|
committer | Dan Heberden <danheberden@gmail.com> | 2011-04-04 16:48:24 -0700 |
commit | 44a3b5839e6db9e3735b3d2d3035c6f79b3bcbe8 (patch) | |
tree | c5e6e2e6747273822041a6e150fa03636fc51938 /test | |
parent | 123dd72e808800d670769f9bca75c6f2c866326b (diff) | |
download | jquery-44a3b5839e6db9e3735b3d2d3035c6f79b3bcbe8.tar.gz jquery-44a3b5839e6db9e3735b3d2d3035c6f79b3bcbe8.zip |
Improve relative string performance in .css and some code cleanup
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/css.js | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/test/unit/css.js b/test/unit/css.js index c4724fcd0..08f50ef25 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -106,24 +106,35 @@ test("css(String|Hash)", function() { }); test("css() explicit and relative values", function() { + expect(9); var $elem = jQuery('#nothiddendiv'); - + $elem.css({ width: 1, height: 1 }); - ok( [$elem.width(), $elem.height()], [1,1] ); - $elem.css({ width: "+=9", height: "+=9" }); - ok( [$elem.width(), $elem.height()], [10,10] ); - $elem.css({ width: "-=9", height: "-=9" }); - ok( [$elem.width(), $elem.height()], [1,1] ); - $elem.css({ width: "+=9px", height: "+=9px" }); - ok( [$elem.width(), $elem.height()], [10,10] ); - $elem.css({ width: "-=9px", height: "-=9px" }); - ok( [$elem.width(), $elem.height()], [1,1] ); - $elem.css("width", "+=9").css("height", "+=9"); - ok( [$elem.width(), $elem.height()], [10,10] ); - $elem.css("width", "+9").css("height", "+9"); - ok( [$elem.width(), $elem.height()], [9,9] ); - $elem.css("width", "-9").css("height", "-9"); - ok( [$elem.width(), $elem.height()], [0,0] ); + equals( $elem.width(), 1, "Initial css set or width/height works (hash)" ); + + $elem.css({ width: "+=9" }); + equals( $elem.width(), 10, "'+=9' on width (hash)" ); + + $elem.css({ width: "-=9" }); + equals( $elem.width(), 1, "'-=9' on width (hash)" ); + + $elem.css({ width: "+=9px" }); + equals( $elem.width(), 10, "'+=9px' on width (hash)" ); + + $elem.css({ width: "-=9px" }); + equals( $elem.width(), 1, "'-=9px' on width (hash)" ); + + $elem.css( "width", "+=9" ); + equals( $elem.width(), 10, "'+=9' on width (params)" ); + + $elem.css( "width", "-=9" ) ; + equals( $elem.width(), 1, "'-=9' 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)" ); }); test("css(String, Object)", function() { |