aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAzatoth <azatoth@gmail.com>2011-04-12 00:17:07 -0400
committerjeresig <jeresig@gmail.com>2011-04-12 00:17:07 -0400
commit1299e89dcd803ee0ed48622c716dc3d4c8567cb7 (patch)
treeede1fdf1745c5fd0ebfa4e306f71fbcf371964b6 /test
parent31b3c44db3b26274b1ad0efd46952ecc2a9380cc (diff)
downloadjquery-1299e89dcd803ee0ed48622c716dc3d4c8567cb7.tar.gz
jquery-1299e89dcd803ee0ed48622c716dc3d4c8567cb7.zip
QUnit test for overriding important css declarations, references #4427
Diffstat (limited to 'test')
-rw-r--r--test/data/testsuite.css4
-rw-r--r--test/unit/css.js15
2 files changed, 19 insertions, 0 deletions
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("<div/>", {
+ "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)" );
+
+});