Bug 7345; Add support for explicit/relative string values in .css - modified from original pull req by brandonaron #78

This commit is contained in:
Dan Heberden 2011-04-04 11:21:15 -07:00
parent 2ed81b44be
commit 123dd72e80
2 changed files with 30 additions and 1 deletions

View file

@ -105,6 +105,27 @@ test("css(String|Hash)", function() {
equals( child[0].style.fontSize, old, "Make sure font-size isn't changed on null." );
});
test("css() explicit and relative values", function() {
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] );
});
test("css(String, Object)", function() {
expect(22);