From 82c3f5893dd007df683bd176b917978f9005ff70 Mon Sep 17 00:00:00 2001 From: Jakub Pawlowicz Date: Wed, 22 Apr 2015 22:12:29 +0100 Subject: [PATCH] Fixes #541 - outline-style auto in shorthand. Apparently two values that overlap between style and color are 'auto' and 'none'. We handled only the latter one correctly. --- History.md | 5 +++++ lib/properties/break-up.js | 2 +- test/fixtures/bootstrap-min.css | 2 +- test/properties/break-up-test.js | 20 ++++++++++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/History.md b/History.md index 525524c8..ee26831b 100644 --- a/History.md +++ b/History.md @@ -9,6 +9,11 @@ * Moves URL rebasing & rewriting into lib/urls. * Fixed issue [#436](https://github.com/jakubpawlowicz/clean-css/issues/436) - refactors URI rewriting. +[3.2.3 / 2015-xx-xx](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.2...3.2) +================== + +* Fixed issue [#541](https://github.com/jakubpawlowicz/clean-css/issues/541) - `outline-style:auto` in shorthand. + [3.2.2 / 2015-04-21](https://github.com/jakubpawlowicz/clean-css/compare/v3.2.1...v3.2.2) ================== diff --git a/lib/properties/break-up.js b/lib/properties/break-up.js index 3d8abcbb..bfb95d3c 100644 --- a/lib/properties/break-up.js +++ b/lib/properties/break-up.js @@ -292,7 +292,7 @@ function widthStyleColor(property, compactable, validator) { if (values.length > 0) { matches = values.filter(_widthFilter(validator)); - match = matches.length > 1 && matches[0] == 'none' ? matches[1] : matches[0]; + match = matches.length > 1 && (matches[0] == 'none' || matches[0] == 'auto') ? matches[1] : matches[0]; if (match) { width.value = [match]; values.splice(values.indexOf(match), 1); diff --git a/test/fixtures/bootstrap-min.css b/test/fixtures/bootstrap-min.css index c870aa69..ce44ad31 100644 --- a/test/fixtures/bootstrap-min.css +++ b/test/fixtures/bootstrap-min.css @@ -318,7 +318,7 @@ body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit} a{color:#337ab7;text-decoration:none} a:focus,a:hover{color:#23527c;text-decoration:underline} -a:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto;outline-offset:-2px} +a:focus{outline:dotted thin;outline:-webkit-focus-ring-color auto 5px;outline-offset:-2px} .carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto} .img-rounded{border-radius:6px} .img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out} diff --git a/test/properties/break-up-test.js b/test/properties/break-up-test.js index 710df1df..e9f68ceb 100644 --- a/test/properties/break-up-test.js +++ b/test/properties/break-up-test.js @@ -686,6 +686,26 @@ vows.describe(breakUp) assert.deepEqual(components[2].value, [['1px']]); } }, + 'with auto style': { + 'topic': function () { + return _breakUp([[['outline'], ['#fff'], ['auto'], ['1px']]]); + }, + 'has 3 components': function (components) { + assert.lengthOf(components, 3); + }, + 'has outline-color': function (components) { + assert.deepEqual(components[0].name, 'outline-color'); + assert.deepEqual(components[0].value, [['#fff']]); + }, + 'has outline-style': function (components) { + assert.deepEqual(components[1].name, 'outline-style'); + assert.deepEqual(components[1].value, [['auto']]); + }, + 'has outline-width': function (components) { + assert.deepEqual(components[2].name, 'outline-width'); + assert.deepEqual(components[2].value, [['1px']]); + } + }, 'missing values': { 'topic': function () { return _breakUp([[['outline'], ['solid']]]); -- 2.34.1