From: Azatoth Date: Tue, 12 Apr 2011 04:17:07 +0000 (-0400) Subject: QUnit test for overriding important css declarations, references #4427 X-Git-Tag: 1.6b1~21^2~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1299e89dcd803ee0ed48622c716dc3d4c8567cb7;p=jquery.git QUnit test for overriding important css declarations, references #4427 --- diff --git a/test/data/testsuite.css b/test/data/testsuite.css index cffaaa46a..7df76834a 100644 --- a/test/data/testsuite.css +++ b/test/data/testsuite.css @@ -109,3 +109,7 @@ div#show-tests * { display: none; } #nothiddendiv { font-size: 16px; } #nothiddendivchild.em { font-size: 2em; } #nothiddendivchild.prct { font-size: 150%; } + +div.isimportant { + background-color: rgb(255, 255, 255) !important; +} diff --git a/test/unit/css.js b/test/unit/css.js index b94c6a8d1..4578b1976 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -377,3 +377,18 @@ test("marginRight computed style (bug #3333)", function() { equals($div.css("marginRight"), "0px", "marginRight correctly calculated with a width and display block"); }); + +test("$().css override !important css declarations (bug #4427)", function(){ + expect(4); + var div = jQuery("
", { + "class": "isimportant" // background-color: #fff !important + }); + div.css("backgroundColor", "rgb(0, 255, 0)"); + equals( div.css("backgroundColor"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + equals( div.css("background-color"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + + div.css("background-color", "rgb(0, 255, 0)"); + equals( div.css("backgroundColor"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + equals( div.css("background-color"), "rgb(0, 255, 0)", "Background color is overrided to rgb(0, 255, 0)" ); + +});