3 var grunt = require('grunt');
4 var fs = require('fs');
7 compile: function(test) {
10 var actual = grunt.file.read('tmp/less.css');
11 var expected = grunt.file.read('test/expected/less.css');
12 test.equal(expected, actual, 'should compile less, with the ability to handle imported files from alternate include paths');
14 actual = grunt.file.read('tmp/concat.css');
15 expected = grunt.file.read('test/expected/concat.css');
16 test.equal(expected, actual, 'should concat output when passed an array');
20 compress: function(test) {
23 var actual = grunt.file.read('tmp/compress.css');
24 var expected = grunt.file.read('test/expected/compress.css');
25 test.equal(expected, actual, 'should compress output when compress option is true');
29 nopaths: function(test) {
32 var actual = grunt.file.read('tmp/nopaths.css');
33 var expected = grunt.file.read('test/expected/nopaths.css');
34 test.equal(expected, actual, 'should default paths to the dirname of the less file');
38 cleancss: function(test) {
41 var actual = grunt.file.read('tmp/cleancss.css');
42 var expected = grunt.file.read('test/expected/cleancss.css');
43 test.equal(expected, actual, 'should cleancss output when cleancss option is true');
45 actual = grunt.file.read('tmp/cleancssReport.css');
46 expected = grunt.file.read('test/expected/cleancssReport.css');
47 test.equal(expected, actual, 'should cleancss output when cleancss option is true and concating is enable');
51 ieCompat: function(test) {
54 var actual = grunt.file.read('tmp/ieCompatFalse.css');
55 var expected = grunt.file.read('test/expected/ieCompatFalse.css');
56 test.equal(expected, actual, 'should generate data-uris no matter the size when ieCompat option is true');
58 actual = grunt.file.read('tmp/ieCompatTrue.css');
59 expected = grunt.file.read('test/expected/ieCompatTrue.css');
60 test.equal(expected, actual, 'should generate data-uris only when under the 32KB mark for Internet Explorer 8');
64 variablesAsLess: function(test) {
67 var actual = grunt.file.read('tmp/variablesAsLess.css');
68 var expected = grunt.file.read('test/expected/variablesAsLess.css');
69 test.equal(expected, actual, 'should process css files imported less files');
73 sourceMap: function(test) {
76 var actual = grunt.file.read('tmp/sourceMap.css');
77 test.ok(actual.indexOf('/*# sourceMappingURL=') !== -1, 'compiled file should include a source map.');
81 sourceMapFilename: function(test) {
84 var sourceMap = grunt.file.readJSON('tmp/sourceMapFilename.css.map');
85 test.equal(sourceMap.sources[0], 'test/fixtures/style3.less', 'should generate a sourceMap with the less file reference.');
89 sourceMapURL: function(test) {
92 var actual = grunt.file.read('tmp/sourceMapWithCustomURL.css');
93 test.ok(actual.indexOf('/*# sourceMappingURL=custom/url/for/sourceMap.css.map') !== -1, 'compiled file should have a custom source map URL.');
96 sourceMapBasepath: function(test) {
99 var sourceMap = grunt.file.readJSON('tmp/sourceMapBasepath.css.map');
100 test.equal(sourceMap.sources[0], 'style3.less', 'should use the basepath for the less file references in the generated sourceMap.');
104 sourceMapRootpath: function(test) {
107 var sourceMap = grunt.file.readJSON('tmp/sourceMapRootpath.css.map');
108 test.equal(sourceMap.sources[0], 'http://example.org/test/fixtures/style3.less', 'should use the rootpath for the less file references in the generated sourceMap.');
112 sourceMapLessInline: function(test) {
115 var expected = grunt.file.read('test/fixtures/style3.less');
116 var sourceMap = grunt.file.readJSON('tmp/sourceMapLessInline.css.map');
117 test.equal(sourceMap.sourcesContent[0], expected, 'should put the less file into the generated sourceMap instead of referencing them.');
121 customFunctions: function(test) {
124 var actual = grunt.file.read('tmp/customFunctions.css');
125 var expected = grunt.file.read('test/expected/customFunctions.css');
126 test.equal(expected, actual, 'should execute custom functions');