-
Notifications
You must be signed in to change notification settings - Fork 131
Expand file tree
/
Copy pathtest.js
More file actions
52 lines (47 loc) · 1.75 KB
/
test.js
File metadata and controls
52 lines (47 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
'use strict';
var grunt = require('grunt');
function readFileAndRemoveNewlines(file) {
return grunt.file.read(file).replace(/\n/g, '');
}
function filesEqual(test, filename, filename2, message) {
var expect = readFileAndRemoveNewlines(filename);
var result = readFileAndRemoveNewlines(filename2);
test.equal(expect, result, message);
}
function testFilesEqual(test, filename, message) {
return filesEqual(test, 'test/expected/' + filename, 'tmp/' + filename, message);
}
exports.cssmin = {
main: function(test) {
test.expect(1);
testFilesEqual(test, 'style.css',
'should concat and minify an array of CSS files in order using clean-css');
test.done();
},
imports: function(test) {
test.expect(1);
testFilesEqual(test, 'inline_import.css', 'should inline @import');
test.done();
},
absolute: function(test) {
test.expect(1);
testFilesEqual(test, 'absolute.css', 'should perform the standard tasks when given absolute paths');
test.done();
},
sourceMapIn: function(test) {
test.expect(3);
testFilesEqual(test, 'sourcemap.css', 'should have correct format with sourceMappingURL');
test.ok(grunt.file.exists('tmp/sourcemap.css.map'), 'sourceMap file should exist');
testFilesEqual(test, 'sourcemap.css.map', 'sourceMap should have correct format');
test.done();
},
sourceMapInFunction: function(test) {
test.expect(3);
filesEqual(test, 'test/expected/sourcemap.css', 'tmp2/sourcemap.css',
'should have correct format with sourceMappingURL');
test.ok(grunt.file.exists('tmp2/sourcemap.css.map'), 'sourceMap file should exist');
filesEqual(test, 'test/expected/sourcemap.css.map', 'tmp2/sourcemap.css.map',
'sourceMap should have correct format');
test.done();
}
};