@@ -207,7 +207,7 @@ test( "css() explicit and relative values", 29, function() {
207207} ) ;
208208
209209test ( "css(String, Object)" , function ( ) {
210- expect ( 19 ) ;
210+ expect ( 20 ) ;
211211 var j , div , display , ret , success ;
212212
213213 jQuery ( "#nothiddendiv" ) . css ( "top" , "-1em" ) ;
@@ -242,15 +242,18 @@ test("css(String, Object)", function() {
242242 equal ( ret , div , "Make sure setting undefined returns the original set." ) ;
243243 equal ( div . css ( "display" ) , display , "Make sure that the display wasn't changed." ) ;
244244
245- // Test for Bug #5509
246245 success = true ;
247246 try {
248- jQuery ( "#foo" ) . css ( "backgroundColor" , "rgba(0, 0, 0, 0.1)" ) ;
247+ jQuery ( "#foo" ) . css ( "backgroundColor" , "rgba(0, 0, 0, 0.1)" ) ;
249248 }
250249 catch ( e ) {
251250 success = false ;
252251 }
253- ok ( success , "Setting RGBA values does not throw Error" ) ;
252+ ok ( success , "Setting RGBA values does not throw Error (#5509)" ) ;
253+
254+ jQuery ( "#foo" ) . css ( "font" , "7px/21px sans-serif" ) ;
255+ strictEqual ( jQuery ( "#foo" ) . css ( "line-height" ) , "21px" ,
256+ "Set font shorthand property (#14759)" ) ;
254257} ) ;
255258
256259test ( "css(Array)" , function ( ) {
@@ -981,10 +984,20 @@ test( ":visible/:hidden selectors", function() {
981984 t ( "Is Hidden" , "#form input:hidden" , [ "hidden1" , "hidden2" ] ) ;
982985} ) ;
983986
984- test ( "Override !important when changing styles (#14394)" , function ( ) {
987+ test ( "Keep the last style if the new one isn't recognized by the browser (#14836)" , function ( ) {
988+ expect ( 2 ) ;
989+
990+ var el ;
991+ el = jQuery ( "<div></div>" ) . css ( "color" , "black" ) . css ( "color" , "fake value" ) ;
992+ equal ( el . css ( "color" ) , "black" , "The old style is kept when setting an unrecognized value" ) ;
993+ el = jQuery ( "<div></div>" ) . css ( "color" , "black" ) . css ( "color" , " " ) ;
994+ equal ( el . css ( "color" ) , "black" , "The old style is kept when setting to a space" ) ;
995+ } ) ;
996+
997+ test ( "Reset the style if set to an empty string" , function ( ) {
985998 expect ( 1 ) ;
986- var el = jQuery ( "<div style='display: block !important;' ></div>" ) . css ( "display " , "none " ) ;
987- equal ( el . css ( "display " ) , "none " , "New style replaced !important " ) ;
999+ var el = jQuery ( "<div></div>" ) . css ( "color " , "black" ) . css ( "color" , " " ) ;
1000+ equal ( el . css ( "color " ) , "" , "The style can be reset by setting to an empty string " ) ;
9881001} ) ;
9891002
9901003asyncTest ( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)" , 24 , function ( ) {
0 commit comments