|
| 1 | +var Comb = require('../lib/csscomb'); |
| 2 | +var assert = require('assert'); |
| 3 | + |
| 4 | +describe('csscomb methods', function() { |
| 5 | + var comb; |
| 6 | + var input; |
| 7 | + var output; |
| 8 | + var expected; |
| 9 | + |
| 10 | + it('Passing no config to constructor should not configure anything', function() { |
| 11 | + comb = new Comb(); |
| 12 | + assert.equal(undefined, comb._handlers); |
| 13 | + }); |
| 14 | + |
| 15 | + it('Passing valid config name to constructor should configure using correct config', function() { |
| 16 | + comb = new Comb('zen'); |
| 17 | + input = 'a { color: tomato; top: 0; }'; |
| 18 | + expected = 'a {top: 0; color: tomato; }'; |
| 19 | + output = comb.processString(input); |
| 20 | + |
| 21 | + assert.equal(expected, output); |
| 22 | + }); |
| 23 | + |
| 24 | + it('Passing config object to constructor should configure using that object', function() { |
| 25 | + comb = new Comb({ 'always-semicolon': true }); |
| 26 | + input = 'a { color: tomato }'; |
| 27 | + expected = 'a { color: tomato; }'; |
| 28 | + output = comb.processString(input); |
| 29 | + |
| 30 | + assert.equal(expected, output); |
| 31 | + }); |
| 32 | + |
| 33 | + it('new Comb() should be chainable', function() { |
| 34 | + input = 'a { color: tomato; top: 0; }'; |
| 35 | + expected = 'a {top: 0; color: tomato; }'; |
| 36 | + output = new Comb('zen').processString(input); |
| 37 | + |
| 38 | + assert.equal(expected, output); |
| 39 | + }); |
| 40 | + |
| 41 | + it('configure() should be chainable', function() { |
| 42 | + input = 'a { color: tomato }'; |
| 43 | + expected = 'a { color: tomato; }'; |
| 44 | + output = new Comb().configure({ 'always-semicolon': true }).processString(input); |
| 45 | + |
| 46 | + assert.equal(expected, output); |
| 47 | + }); |
| 48 | +}); |
0 commit comments