@@ -3,105 +3,31 @@ var assert = require('assert');
33
44describe ( 'options/combinator-space' , function ( ) {
55 var comb ;
6+
67 beforeEach ( function ( ) {
78 comb = new Comb ( ) ;
89 } ) ;
9- it ( 'Invalid String should not change space around combinator' , function ( ) {
10+
11+ it ( 'Number value should not change space around combinator' , function ( ) {
12+ var input = 'a >b { color: red }' ;
13+ comb . configure ( { 'combinator-space' : 2 } ) ;
14+ assert . equal ( comb . processString ( input ) , input ) ;
15+ } ) ;
16+
17+ it ( 'String value should not change space around combinator' , function ( ) {
18+ var input = 'a >b { color: red }' ;
1019 comb . configure ( { 'combinator-space' : 'foobar' } ) ;
11- assert . equal (
12- comb . processString (
13- 'a >b { color: red }' +
14- 'a ~b { color: red }' +
15- 'a +b { color: red }'
16- ) ,
17- 'a >b { color: red }' +
18- 'a ~b { color: red }' +
19- 'a +b { color: red }'
20- ) ;
20+ assert . equal ( comb . processString ( input ) , input ) ;
2121 } ) ;
22- it ( 'True Boolean value should set space around combinator to one space' , function ( ) {
22+
23+ it ( 'Boolean value should not change space around combinator' , function ( ) {
24+ var input = 'a >b { color: red }' ;
2325 comb . configure ( { 'combinator-space' : true } ) ;
24- assert . equal (
25- comb . processString (
26- 'a>b { color: red }' +
27- 'a> b { color: red }' +
28- 'a >b { color: red }' +
29- 'a+b { color: red }' +
30- 'a+ b { color: red }' +
31- 'a +b { color: red }' +
32- 'a~b { color: red }' +
33- 'a~ b { color: red }' +
34- 'a ~b { color: red }' +
35- 'a ~b+ c>d { color: red }'
36- ) ,
37- 'a > b { color: red }' +
38- 'a > b { color: red }' +
39- 'a > b { color: red }' +
40- 'a + b { color: red }' +
41- 'a + b { color: red }' +
42- 'a + b { color: red }' +
43- 'a ~ b { color: red }' +
44- 'a ~ b { color: red }' +
45- 'a ~ b { color: red }' +
46- 'a ~ b + c > d { color: red }'
47- ) ;
48- } ) ;
49- it ( 'False Boolean value should remove spaces around combinator' , function ( ) {
50- comb . configure ( { 'combinator-space' : false } ) ;
51- assert . equal (
52- comb . processString (
53- 'a>b { color: red }' +
54- 'a> b { color: red }' +
55- 'a >b { color: red }' +
56- 'a+b { color: red }' +
57- 'a+ b { color: red }' +
58- 'a +b { color: red }' +
59- 'a~b { color: red }' +
60- 'a~ b { color: red }' +
61- 'a ~b { color: red }' +
62- 'a ~b+ c>d { color: red }'
63- ) ,
64- 'a>b { color: red }' +
65- 'a>b { color: red }' +
66- 'a>b { color: red }' +
67- 'a+b { color: red }' +
68- 'a+b { color: red }' +
69- 'a+b { color: red }' +
70- 'a~b { color: red }' +
71- 'a~b { color: red }' +
72- 'a~b { color: red }' +
73- 'a~b+c>d { color: red }'
74- ) ;
26+ assert . equal ( comb . processString ( input ) , input ) ;
7527 } ) ;
76- it ( 'String `` value should remove spaces around combinator' , function ( ) {
77- comb . configure ( { 'combinator-space' : '' } ) ;
78- assert . equal (
79- comb . processString (
80- 'a>b { color: red }' +
81- 'a> b { color: red }' +
82- 'a >b { color: red }' +
83- 'a+b { color: red }' +
84- 'a+ b { color: red }' +
85- 'a +b { color: red }' +
86- 'a~b { color: red }' +
87- 'a~ b { color: red }' +
88- 'a ~b { color: red }' +
89- 'a ~b+ c>d { color: red }'
90- ) ,
91- 'a>b { color: red }' +
92- 'a>b { color: red }' +
93- 'a>b { color: red }' +
94- 'a+b { color: red }' +
95- 'a+b { color: red }' +
96- 'a+b { color: red }' +
97- 'a~b { color: red }' +
98- 'a~b { color: red }' +
99- 'a~b { color: red }' +
100- 'a~b+c>d { color: red }'
101- ) ;
102- } ) ;
103- it ( 'String ` ` value should set two spaces around combinator' , function ( ) {
104- comb . configure ( { 'combinator-space' : ' ' } ) ;
28+
29+ it ( 'Array of strings should set proper spaces around combinator' , function ( ) {
30+ comb . configure ( { 'combinator-space' : [ ' ' , '\n' ] } ) ;
10531 assert . equal (
10632 comb . processString (
10733 'a>b { color: red }' +
@@ -115,20 +41,21 @@ describe('options/combinator-space', function() {
11541 'a ~b { color: red }' +
11642 'a ~b+ c>d { color: red }'
11743 ) ,
118- 'a > b { color: red }' +
119- 'a > b { color: red }' +
120- 'a > b { color: red }' +
121- 'a + b { color: red }' +
122- 'a + b { color: red }' +
123- 'a + b { color: red }' +
124- 'a ~ b { color: red }' +
125- 'a ~ b { color: red }' +
126- 'a ~ b { color: red }' +
127- 'a ~ b + c > d { color: red }'
44+ 'a >\nb { color: red }' +
45+ 'a >\nb { color: red }' +
46+ 'a >\nb { color: red }' +
47+ 'a +\nb { color: red }' +
48+ 'a +\nb { color: red }' +
49+ 'a +\nb { color: red }' +
50+ 'a ~\nb { color: red }' +
51+ 'a ~\nb { color: red }' +
52+ 'a ~\nb { color: red }' +
53+ 'a ~\nb +\nc >\nd { color: red }'
12854 ) ;
12955 } ) ;
130- it ( 'Array value should set different spaces around combinator' , function ( ) {
131- comb . configure ( { 'combinator-space' : [ ' ' , '\n' ] } ) ;
56+
57+ it ( 'Array of numbers should set proper spaces around combinator' , function ( ) {
58+ comb . configure ( { 'combinator-space' : [ 0 , 1 ] } ) ;
13259 assert . equal (
13360 comb . processString (
13461 'a>b { color: red }' +
@@ -142,16 +69,16 @@ describe('options/combinator-space', function() {
14269 'a ~b { color: red }' +
14370 'a ~b+ c>d { color: red }'
14471 ) ,
145- 'a >\nb { color: red }' +
146- 'a >\nb { color: red }' +
147- 'a >\nb { color: red }' +
148- 'a +\nb { color: red }' +
149- 'a +\nb { color: red }' +
150- 'a +\nb { color: red }' +
151- 'a ~\nb { color: red }' +
152- 'a ~\nb { color: red }' +
153- 'a ~\nb { color: red }' +
154- 'a ~\nb +\nc >\nd { color: red }'
72+ 'a> b { color: red }' +
73+ 'a> b { color: red }' +
74+ 'a> b { color: red }' +
75+ 'a+ b { color: red }' +
76+ 'a+ b { color: red }' +
77+ 'a+ b { color: red }' +
78+ 'a~ b { color: red }' +
79+ 'a~ b { color: red }' +
80+ 'a~ b { color: red }' +
81+ 'a~ b+ c> d { color: red }'
15582 ) ;
15683 } ) ;
15784
0 commit comments