UNPKG

835 BJavaScriptView Raw
1
2var fs = require('fs'),
3 test = require('tape'),
4 through = require('through2'),
5 rules = require('../');
6
7
8test('works', function(t) {
9 var expected = [
10 {"content":"div {\n background: red;\n}"},
11 {"content":".cls {\n color: green;\n}"},
12 {"content":"#id {\n font-size: 10px;\n}"},
13 {"content":"@media screen and (min-width: 1000px) {\n a {\n text-decoration: underline;\n }\n}"},
14 {"content":"a:hover {\n font-weight: bold; \n}"},
15 {"content":"section \n\n\n{\n margin: 0;\n /* comment wthin a rule */\n padding: 5px;\n}"},
16 {"content":"body > * {\n \n}"}
17 ]
18
19 t.plan(expected.length);
20
21 var rs = rules();
22 rs.pipe(through.obj(function(chunk, enc, next) {
23 t.same(chunk, expected.shift());
24 next();
25 }));
26
27 fs.createReadStream(__dirname + '/gauntlet.css').pipe(rs);
28
29})