This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
test.js
40 lines (34 loc) · 1.11 KB
/
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
31
32
33
34
35
36
37
38
39
40
/* eslint-env mocha */
'use strict';
const assert = require('assert');
const calc = require('rework-calc');
const Vinyl = require('vinyl');
const styl = require('.');
it('should preprocess CSS using Styl', cb => {
const stream = styl();
stream.on('data', file => {
assert.equal(file.path, '~/dev/gulp-styl/test/file.css');
assert.equal(file.relative, 'file.css');
assert.equal(file.contents.toString(), '#test {\n width: 50px;\n height: 50px;\n}');
cb();
});
stream.end(new Vinyl({
base: '~/dev/gulp-styl/test',
path: '~/dev/gulp-styl/test/file.styl',
contents: Buffer.from('#test{width:50px;height:@width;}')
}));
});
it('should support using plugins', cb => {
const stream = styl(calc);
stream.on('data', file => {
assert.equal(file.path, '~/dev/gulp-styl/test/file.css');
assert.equal(file.relative, 'file.css');
assert.equal(file.contents.toString(), '#test {\n width: 50px;\n height: 50px;\n}');
cb();
});
stream.end(new Vinyl({
base: '~/dev/gulp-styl/test',
path: '~/dev/gulp-styl/test/file.styl',
contents: Buffer.from('#test{width:calc(25px + 25px);height:@width;}')
}));
});