File tree Expand file tree Collapse file tree 6 files changed +77
-2
lines changed
Expand file tree Collapse file tree 6 files changed +77
-2
lines changed Original file line number Diff line number Diff line change 55 ],
66 "colon-space" : true ,
77 "color-case" : " lower" ,
8+ "color-shorthand" : true ,
89 "leading-zero" : false ,
910 "rule-indent" : true ,
1011 "block-indent" : true ,
Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ Example configuration:
3636 " exclude" : [" node_modules/**" ],
3737 " colon-space" : true,
3838 " color-case" : " lower" ,
39+ " color-shorthand" : true,
3940 " leading-zero" : false,
4041 " rule-indent" : true,
4142 " block-indent" : true,
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ var Comb = function() {
1313 this . _options = [
1414 'always-semicolon' ,
1515 'color-case' ,
16+ 'color-shorthand' ,
1617 'leading-zero' ,
1718 'strip-spaces' ,
1819 'stick-brace' ,
Original file line number Diff line number Diff line change 1+ module . exports = {
2+
3+ /**
4+ * Sets handler value.
5+ *
6+ * @param {Boolean } value Option value
7+ * @returns {Object }
8+ */
9+ setValue : function ( value ) {
10+ if ( value === true || value === false ) {
11+ this . _value = value ;
12+ return this ;
13+ }
14+ } ,
15+
16+ /**
17+ * Processes tree node.
18+ * @param {String } nodeType
19+ * @param {node } node
20+ */
21+ process : function ( nodeType , node ) {
22+ if ( nodeType === 'vhash' ) {
23+ if ( this . _value ) {
24+ node [ 0 ] = node [ 0 ] . replace ( / ( \w ) \1( \w ) \2( \w ) \3/ i, '$1$2$3' ) ;
25+ } else {
26+ node [ 0 ] = node [ 0 ] . replace ( / ^ ( \w ) ( \w ) ( \w ) $ / , '$1$1$2$2$3$3' ) ;
27+ }
28+ }
29+ }
30+
31+ } ;
Original file line number Diff line number Diff line change 1+ var Comb = require ( '../lib/csscomb' ) ;
2+ var assert = require ( 'assert' ) ;
3+
4+ describe ( 'options/color-shorthand' , function ( ) {
5+ var comb ;
6+
7+ beforeEach ( function ( ) {
8+ comb = new Comb ( ) ;
9+ } ) ;
10+
11+ it ( 'Should shrink hexadecimal colors to 3 symbols' , function ( ) {
12+ comb . configure ( { 'color-shorthand' : true } ) ;
13+ assert . equal (
14+ comb . processString (
15+ 'div { color: #aabbcc }'
16+ ) ,
17+ 'div { color: #abc }'
18+ ) ;
19+ } ) ;
20+
21+ it ( 'Should expand hexadecimal colors to 6 symbols' , function ( ) {
22+ comb . configure ( { 'color-shorthand' : false } ) ;
23+ assert . equal (
24+ comb . processString (
25+ 'div { color: #7ad }'
26+ ) ,
27+ 'div { color: #77aadd }'
28+ ) ;
29+ } ) ;
30+
31+ it ( 'Should save case while processing' , function ( ) {
32+ comb . configure ( { 'color-shorthand' : true } ) ;
33+ assert . equal (
34+ comb . processString (
35+ 'div { color: #fFAafF }'
36+ ) ,
37+ 'div { color: #fAf }'
38+ ) ;
39+ } ) ;
40+
41+ } ) ;
Original file line number Diff line number Diff line change 1717 .radio-button_theme_normal .radio-button__radio : after
1818 {
1919 background : # fFf ;
20- background : -webkit-linear-gradient (top, # Fff 0 , # eeE 100% );
20+ background : -webkit-linear-gradient (top, # FffFff 0 , # eeeeEe 100% );
2121 background : -moz-linear-gradient (top, # fff 0 , # eEe 100% );
2222 background : -o-linear-gradient (top, # fff 0 , # eee 100% );
23- background : linear-gradient (to bottom, # fff 0 , # eEe 100% );
23+ background : linear-gradient (to bottom, # ffffff 0 , # eeEeee 100% );
2424 }
2525
2626 /* _focused_yes */
You can’t perform that action at this time.
0 commit comments