-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.test.js
66 lines (58 loc) · 2.11 KB
/
index.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
var postcss = require('postcss');
var plugin = require('./lib').default;
function run(input, output, opts) {
return postcss([plugin(opts)]).process(input)
.then(result => {
expect(result.css).toEqual(output);
expect(result.warnings().length).toBe(0);
});
}
it('turns subtle("seigaiha") into a local file reference', () => {
return run(
'a{ background: subtle("seigaiha"); }',
'a{ background: url("/build/css/seigaiha.png"); }',
{ localPath: '.', serverPath: '/build/css' }
);
});
it('turns subtle("new_year_background") into a local file reference', () => {
return run(
'a{ background: subtle("new_year_background"); }',
'a{ background: url("/build/css/new_year_background.png"); }',
{ localPath: '.', serverPath: '/build/css' }
);
});
it('turns subtle("new_year_background") into a local file reference (local ref)', () => {
return run(
'a{ background: subtle("new_year_background"); }',
'a{ background: url("css/new_year_background.png"); }',
{ localPath: '.', serverPath: 'css/' }
);
});
it('turns subtle("new_year_background") into a local file reference (http ref)', () => {
return run(
'a{ background: subtle("new_year_background"); }',
'a{ background: url("http://localhost/css/new_year_background.png"); }',
{ localPath: '.', serverPath: 'http://localhost/css/' }
);
});
it('turns subtle("new_year_background") into a local file reference (.. ref)', () => {
return run(
'a{ background: subtle("new_year_background"); }',
'a{ background: url("../css/new_year_background.png"); }',
{ localPath: '.', serverPath: '../css' }
);
});
it('turns subtle("new_year_background") into a local file reference (https ref)', () => {
return run(
'a{ background: subtle("new_year_background"); }',
'a{ background: url("https://test.blah/css/new_year_background.png"); }',
{ localPath: '.', serverPath: 'https://test.blah/css' }
);
});
it('turns subtle("new_year_background") into a local file reference (// ref)', () => {
return run(
'a{ background: subtle("new_year_background"); }',
'a{ background: url("//css/new_year_background.png"); }',
{ localPath: '.', serverPath: '//css' }
);
});