From: GoalSmashers Date: Fri, 27 Sep 2013 15:36:53 +0000 (+0200) Subject: Fixes #149 - shorthand font property with optional styles. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=53e38d20dec5c420a5fc01cfb6ae5355c10e60d4;p=clean-css.git Fixes #149 - shorthand font property with optional styles. * It does not offer optimal minification by not handling 'font:normal normal normal 0 && !/[.\d]/.test(next)) + return match; + if (weight == 'normal') - return property + ':400' + suffix; + return property + ':400' + suffix + next; else if (weight == 'bold') - return property + ':700' + suffix; + return property + ':700' + suffix + next; else return match; }); diff --git a/test/unit-test.js b/test/unit-test.js index 096aac97..bdb61069 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -600,10 +600,15 @@ vows.describe('clean-units').addBatch({ 'font:normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif', 'font:400 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif' ], + 'font weight in font declarations with fraction units': [ + 'font:bold .9rem Helvetica', + 'font:700 .9rem Helvetica' + ], 'multiple changes': [ - 'p{font-weight:bold;width:100%;font:normal}', - 'p{font-weight:700;width:100%;font:400}' - ] + 'p{font-weight:bold;width:100%;font:normal 12px Helvetica}', + 'p{font-weight:700;width:100%;font:400 12px Helvetica}' + ], + 'font weight in extended font declarations': 'font:normal normal normal 13px/20px Helvetica' }), 'urls': cssContext({ 'keep urls without parentheses unchanged': 'a{background:url(/images/blank.png) 0 0 no-repeat}',