File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,11 +10,18 @@ module.exports = {
1010 if ( ! value ) return ;
1111
1212 this . _order = { } ;
13- value . forEach ( function ( group , groupIndex ) {
14- group . forEach ( function ( prop , propIndex ) {
15- this . _order [ prop ] = { group : groupIndex , prop : propIndex } ;
13+
14+ if ( typeof value [ 0 ] === 'string' ) {
15+ value . forEach ( function ( prop , propIndex ) {
16+ this . _order [ prop ] = { group : 0 , prop : propIndex } ;
17+ } , this ) ;
18+ } else {
19+ value . forEach ( function ( group , groupIndex ) {
20+ group . forEach ( function ( prop , propIndex ) {
21+ this . _order [ prop ] = { group : groupIndex , prop : propIndex } ;
22+ } , this ) ;
1623 } , this ) ;
17- } , this ) ;
24+ }
1825
1926 return this ;
2027 } ,
Original file line number Diff line number Diff line change @@ -13,6 +13,16 @@ describe('options/sort-order', function() {
1313 comb = new Comb ( ) ;
1414 } ) ;
1515
16+ it ( 'Should be in expected order in case properties are not grouped' , function ( ) {
17+ var config = { 'sort-order' : [ 'position' , 'z-index' ] } ;
18+
19+ var input = readFile ( 'single-group.css' ) ;
20+ var expected = readFile ( 'single-group.expected.css' ) ;
21+
22+ comb . configure ( config ) ;
23+ assert . equal ( comb . processString ( input ) , expected ) ;
24+ } ) ;
25+
1626 it ( 'Should be in expected order in case of 1 group' , function ( ) {
1727 var config = { 'sort-order' : [
1828 [ 'position' , 'z-index' ]
You can’t perform that action at this time.
0 commit comments