From 0c12cb3910c446960a274fb0eab11b8830bed71f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski?= Date: Mon, 10 Mar 2014 19:53:50 +0100 Subject: [PATCH] Css: Fix tests It's not easy to find a CSS property that is implemented even in ancient browsers and that returns a consistent result among browsers when passed through .css(). color didn't work since Firefox normalizes it an empty value to rgb(0, 0, 0). --- test/unit/css.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/test/unit/css.js b/test/unit/css.js index a65bf1dbe..4ac545244 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -930,16 +930,19 @@ test( "Keep the last style if the new one isn't recognized by the browser (#1483 expect( 2 ); var el; - el = jQuery( "
" ).css( "color", "black" ).css( "color", "fake value" ); - equal( el.css( "color" ), "black", "The old style is kept when setting an unrecognized value" ); - el = jQuery( "
" ).css( "color", "black" ).css( "color", " " ); - equal( el.css( "color" ), "black", "The old style is kept when setting to a space" ); + el = jQuery( "
" ).css( "position", "absolute" ).css( "position", "fake value" ); + equal( el.css( "position" ), "absolute", "The old style is kept when setting an unrecognized value" ); + el = jQuery( "
" ).css( "position", "absolute" ).css( "position", " " ); + equal( el.css( "position" ), "absolute", "The old style is kept when setting to a space" ); }); test( "Reset the style if set to an empty string", function() { expect( 1 ); - var el = jQuery( "
" ).css( "color", "black" ).css( "color", "" ); - equal( el.css( "color" ), "", "The style can be reset by setting to an empty string" ); + var el = jQuery( "
" ).css( "position", "absolute" ).css( "position", "" ); + // Some browsers return an empty string; others "static". Both those cases mean the style + // was reset successfully so accept them both. + equal( el.css( "position" ) || "static", "static", + "The style can be reset by setting to an empty string" ); }); asyncTest( "Clearing a Cloned Element's Style Shouldn't Clear the Original Element's Style (#8908)", 24, function() { -- 2.39.5