Skip to content

Commit 8e65fec

Browse files
committed
add tests
1 parent 1193552 commit 8e65fec

9 files changed

+57
-0
lines changed

test/cases/media.css

Whitespace-only changes.

test/cases/media.out.css

Whitespace-only changes.

test/cases/nesting.css

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
body
3+
padding: 50px
4+
ul
5+
margin: 0
6+
padding: 0
7+
li
8+
list-style: none
9+
a
10+
color: blue

test/cases/nesting.out.css

Whitespace-only changes.

test/cases/parent.css

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
ul
3+
li
4+
background: #eee
5+
&:hover
6+
background: white
7+
&:active
8+
background: #ddd

test/cases/parent.out.css

Whitespace-only changes.

test/cases/properties.css

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
body
3+
background: #eee
4+
color: white
5+
6+
ul li
7+
list-style: none
8+
margin: 0
9+
padding: 0

test/cases/properties.out.css

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
body {
2+
background: #eee;
3+
color: white;
4+
}
5+
6+
ul li {
7+
list-style: none;
8+
margin: 0;
9+
padding: 0;
10+
}

test/index.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
var compile = require('..');
3+
var fs = require('fs');
4+
var path = require('path');
5+
var read = fs.readFileSync;
6+
var readdir = fs.readdirSync;
7+
8+
readdir('test/cases').forEach(function(file){
9+
if (~file.indexOf('.out')) return;
10+
var base = path.basename(file, '.css');
11+
var input = read('test/cases/' + file, 'utf8');
12+
var output = read('test/cases/' + base + '.out.css', 'utf8');
13+
14+
describe(base, function(){
15+
it('should work', function(){
16+
var out = compile(input);
17+
out.should.equal(output);
18+
})
19+
})
20+
});

0 commit comments

Comments
 (0)