-
Notifications
You must be signed in to change notification settings - Fork 5
/
test.js
31 lines (24 loc) · 668 Bytes
/
test.js
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
// simple test
var source = 'ul{li{color:white;}}',
expect = /^ul\s*li\s*{/i,
sass = require('./lib/index.js');
var ret = sass.renderSync({ file: 'xxx.scss', data: source });
if ( !ret.css.match( expect ) ) {
throw new Error( 'Some thing wrong.' );
} else {
console.log( 'Simple test passed!');
}
var ret = sass.renderSync({
file: 'aaa.scss',
data: '@import "xxx";\n'+source,
importer: function(url, pre, done) {
return {
contents: "body{color: red}"
}
}
});
if ( !~ret.css.indexOf('color: white;') ) {
throw new Error( 'Some thing wrong.' );
} else {
console.log( 'importer is supported');
}