forked from stylelint/stylelint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
57 lines (52 loc) · 1.21 KB
/
index.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
'use strict';
const { messages, ruleName } = require('..');
testRule({
ruleName,
config: [
{
'/^background/': ['/^data:/', '/^images/', '/^http/', '/^vendor/'],
},
],
accept: [
{
code: 'a { background: url(images/x.jpg); }',
},
{
code: 'a { background-image: url(vendor/x.jpg); }',
},
{
code: 'a { background: url(https://image/1.png); }',
},
{
code:
'a { background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=); }',
},
{
code: 'a { background-image: #fff url(images/select2.png) no-repeat 100% -22px }',
},
{
code:
'a {background-image: url(images/select2.png) no-repeat 100% -22px, -moz-linear-gradient(bottom, #fff 85%, #eee 99%);}',
},
],
reject: [
{
code: 'a { background-image: url(data/x.jpg); }',
message: messages.rejected('background-image', 'data/x.jpg'),
line: 1,
column: 27,
},
{
code: 'a { background-image: #fff url(magic/select2.png) no-repeat 100% -22px }',
message: messages.rejected('background-image', 'magic/select2.png'),
line: 1,
column: 32,
},
{
code: 'a { background: url(#fff) }',
message: messages.rejected('background', '#fff'),
line: 1,
column: 21,
},
],
});