|
| 1 | +var Comb = require('../lib/csscomb'); |
| 2 | +var assert = require('assert'); |
| 3 | + |
| 4 | +describe('options/rule-indent', function() { |
| 5 | + var comb; |
| 6 | + beforeEach(function() { |
| 7 | + comb = new Comb(); |
| 8 | + }); |
| 9 | + it('Invalid Number value should not change space after brace', function() { |
| 10 | + comb.configure({ 'rule-indent': 3.5 }); |
| 11 | + assert.equal( |
| 12 | + comb.processString('a {\n color: red }'), |
| 13 | + 'a {\n color: red }' |
| 14 | + ); |
| 15 | + }); |
| 16 | + it('Invalid String value should not change space after brace', function() { |
| 17 | + comb.configure({ 'rule-indent': 'foobar' }); |
| 18 | + assert.equal( |
| 19 | + comb.processString('a {\n color: red }'), |
| 20 | + 'a {\n color: red }' |
| 21 | + ); |
| 22 | + }); |
| 23 | + it('True Boolean value should set 4 spaces indent', function() { |
| 24 | + comb.configure({ 'rule-indent': true }); |
| 25 | + assert.equal( |
| 26 | + comb.processString('a {\n color: red }'), |
| 27 | + 'a {\n color: red }' |
| 28 | + ); |
| 29 | + }); |
| 30 | + it('Valid Number value should set equal space after brace', function() { |
| 31 | + comb.configure({ 'rule-indent': 3 }); |
| 32 | + assert.equal( |
| 33 | + comb.processString('a {\n color: red }'), |
| 34 | + 'a {\n color: red }' |
| 35 | + ); |
| 36 | + }); |
| 37 | + it('Valid String value should set equal space after brace', function() { |
| 38 | + comb.configure({ 'rule-indent': '\t' }); |
| 39 | + assert.equal( |
| 40 | + comb.processString( |
| 41 | + 'a{color:red;background:#fff}\n' + |
| 42 | + 'a { color: red; background: #fff; }\n' + |
| 43 | + 'a {\ncolor:red;\n\nbackground: #fff}\n' + |
| 44 | + 'a { /* foo */ color:red; /* bar */\n\nbackground: #fff\n}\n' |
| 45 | + ), |
| 46 | + 'a{\n\tcolor:red;\n\tbackground:#fff}\n' + |
| 47 | + 'a {\n\tcolor: red;\n\tbackground: #fff; }\n' + |
| 48 | + 'a {\n\tcolor:red;\n\n\tbackground: #fff}\n' + |
| 49 | + 'a { /* foo */\n\tcolor:red; /* bar */\n\n\tbackground: #fff\n}\n' |
| 50 | + ); |
| 51 | + }); |
| 52 | +}); |
0 commit comments