|
| 1 | +var Comb = require('../lib/csscomb'); |
| 2 | +var assert = require('assert'); |
| 3 | +var fs = require('fs'); |
| 4 | + |
| 5 | +describe('options/always-semicolon (scss)', function() { |
| 6 | + var comb; |
| 7 | + var input; |
| 8 | + var expected; |
| 9 | + |
| 10 | + function readFile(path) { |
| 11 | + return fs.readFileSync('test/always-semicolon-less/' + path, 'utf8'); |
| 12 | + } |
| 13 | + |
| 14 | + beforeEach(function() { |
| 15 | + comb = new Comb(); |
| 16 | + comb.configure({ 'always-semicolon': true }); |
| 17 | + }); |
| 18 | + |
| 19 | + it('Should not add semicolon to condition (single-line style)', function() { |
| 20 | + input = readFile('condition.less'); |
| 21 | + |
| 22 | + assert.equal(comb.processString(input, 'less'), input); |
| 23 | + }); |
| 24 | + |
| 25 | + it('Should not add semicolon to condition (multi-line style)', function() { |
| 26 | + input = readFile('condition-multiline.less'); |
| 27 | + |
| 28 | + assert.equal(comb.processString(input, 'less'), input); |
| 29 | + }); |
| 30 | + |
| 31 | + it('Should add semicolon to last included mixin if missing. Test 1 (single-line style)', function() { |
| 32 | + input = readFile('include-1.less'); |
| 33 | + expected = readFile('include-1.expected.less'); |
| 34 | + |
| 35 | + assert.equal(comb.processString(input, 'less'), expected); |
| 36 | + }); |
| 37 | + |
| 38 | + it('Should add semicolon to last included mixin if missing. Test 1 (multi-line style)', function() { |
| 39 | + input = readFile('include-1-multiline.less'); |
| 40 | + expected = readFile('include-1-multiline.expected.less'); |
| 41 | + |
| 42 | + assert.equal(comb.processString(input, 'less'), expected); |
| 43 | + }); |
| 44 | + |
| 45 | + it('Should add semicolon to last included mixin if missing. Test 2 (single-line style)', function() { |
| 46 | + input = readFile('include-2.less'); |
| 47 | + expected = readFile('include-2.expected.less'); |
| 48 | + |
| 49 | + assert.equal(comb.processString(input, 'less'), expected); |
| 50 | + }); |
| 51 | + |
| 52 | + it('Should add semicolon to last included mixin if missing. Test 2 (multi-line style)', function() { |
| 53 | + input = readFile('include-2-multiline.less'); |
| 54 | + expected = readFile('include-2-multiline.expected.less'); |
| 55 | + |
| 56 | + assert.equal(comb.processString(input, 'less'), expected); |
| 57 | + }); |
| 58 | + |
| 59 | + it('Should add semicolon to last included mixin if missing. Test 3 (single-line style)', function() { |
| 60 | + input = readFile('include-3.less'); |
| 61 | + expected = readFile('include-3.expected.less'); |
| 62 | + |
| 63 | + assert.equal(comb.processString(input, 'less'), expected); |
| 64 | + }); |
| 65 | + |
| 66 | + it('Should add semicolon to last included mixin if missing. Test 3 (multi-line style)', function() { |
| 67 | + input = readFile('include-3-multiline.less'); |
| 68 | + expected = readFile('include-3-multiline.expected.less'); |
| 69 | + |
| 70 | + assert.equal(comb.processString(input, 'less'), expected); |
| 71 | + }); |
| 72 | + |
| 73 | + it('Should add semicolon to last included mixin if missing. Test 4 (single-line style)', function() { |
| 74 | + input = readFile('include-4.less'); |
| 75 | + expected = readFile('include-4.expected.less'); |
| 76 | + |
| 77 | + assert.equal(comb.processString(input, 'less'), expected); |
| 78 | + }); |
| 79 | + |
| 80 | + it('Should add semicolon to last included mixin if missing. Test 4 (multi-line style)', function() { |
| 81 | + input = readFile('include-4-multiline.less'); |
| 82 | + expected = readFile('include-4-multiline.expected.less'); |
| 83 | + |
| 84 | + assert.equal(comb.processString(input, 'less'), expected); |
| 85 | + }); |
| 86 | + |
| 87 | + it('Should add semicolon to last included mixin if missing. Test 5 (single-line style)', function() { |
| 88 | + input = readFile('include-5.less'); |
| 89 | + expected = readFile('include-5.expected.less'); |
| 90 | + |
| 91 | + assert.equal(comb.processString(input, 'less'), expected); |
| 92 | + }); |
| 93 | + |
| 94 | + it('Should add semicolon to last included mixin if missing. Test 5 (multi-line style)', function() { |
| 95 | + input = readFile('include-5-multiline.less'); |
| 96 | + expected = readFile('include-5-multiline.expected.less'); |
| 97 | + |
| 98 | + assert.equal(comb.processString(input, 'less'), expected); |
| 99 | + }); |
| 100 | +}); |
0 commit comments