]> source.dussan.org Git - jquery.git/commitdiff
QUnit test for overriding important css declarations, references #4427
authorAzatoth <azatoth@gmail.com>
Tue, 12 Apr 2011 04:17:07 +0000 (00:17 -0400)
committerjeresig <jeresig@gmail.com>
Tue, 12 Apr 2011 04:17:07 +0000 (00:17 -0400)
test/data/testsuite.css
test/unit/css.js

index cffaaa46ab307c507a5441beb534e7303fe4ace7..7df76834a6fc7a9ef1e3771887f9a5ea710bd13f 100644 (file)
@@ -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;
+}
index b94c6a8d1e037b7c9ca31be405e618e509eef7ff..4578b19767a9500b6c015870dbcd556fa7348fca 100644 (file)
@@ -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)"  );
+
+});