-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.js
72 lines (63 loc) · 2.27 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(function() {
'use strict';
var assert = require('assert');
var Vinyl = require('vinyl');
var gulpRtlcss = require('./index');
it('should convert LTR CSS to RTL', function (cb) {
var stream = gulpRtlcss();
stream.on('data', function (file) {
assert.equal(file.contents.toString(), '.selector { float: right; /* comment */ }');
cb();
});
stream.write(new Vinyl({
path: 'styles.css',
contents: Buffer.from('.selector { float: left; /* comment */ }')
}));
});
it('should accept rtlcss configuration', function (cb) {
var stream = gulpRtlcss({
"options": {
"preserveComments": true,
"preserveDirectives": false,
"swapLeftRightInUrl": true,
"swapLtrRtlInUrl": true,
"swapWestEastInUrl": true,
"autoRename": false,
"greedy": false,
"enableLogging": false,
"minify": false
},
"rules": [ ],
"declarations": [ ],
"properties": [ ],
"map": false
});
stream.on('data', function (file) {
assert.equal(file.contents.toString(), ".pull-left {content: ' ';}");
cb();
});
stream.write(new Vinyl({
path: 'styles.css',
contents: Buffer.from(".pull-left {content: ' ';}")
}));
});
it('should honour rtlcss directives', function (cb) {
var stream = gulpRtlcss();
stream.on('data', function (file) {
assert.equal(file.contents.toString(), ".toRight {\n" +
" text-align: left;\n" +
"}\n");
cb();
});
stream.write(new Vinyl({
path: 'styles.css',
contents: Buffer.from(".toRight {\n" +
" /*rtl:remove*/\n" +
" direction: rtl;\n" +
" \n" +
" /*rtl:ignore*/\n" +
" text-align: left;\n" +
"}\n")
}));
});
})();