-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.test.js
executable file
·71 lines (65 loc) · 1.19 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
67
68
69
70
71
import plugin from "./index.js";
import { testRule } from "stylelint-test-rule-node";
const plugins = [plugin];
const {
ruleName,
rule: { messages }
} = plugin;
testRule({
plugins,
ruleName,
config: [ 'span', 'div' ],
accept: [
{ code: 'span.foo, h1.bar > h2.baz > h3.qux {}' },
{ code: 'span.foo {}' },
{ code: 'div.foo {}' },
{ code: 'h1 {}' },
],
reject: [
{
code: 'div {}',
message: messages.unexpected('div'),
line: 1,
column: 1
},
{
code: 'div, div.foo {}',
message: messages.unexpected('div'),
line: 1,
column: 1
},
{
code: '.foo div {}',
message: messages.unexpected('div'),
line: 1,
column: 6
},
{
code: 'div:hover {}',
message: messages.unexpected('div'),
line: 1,
column: 1
},
{
code: 'div::before {}',
message: messages.unexpected('div'),
line: 1,
column: 1
},
{
code: 'div:first-child {}',
message: messages.unexpected('div'),
line: 1,
column: 1
},
]
});
testRule({
plugins,
ruleName,
config: [ '/./' ],
accept: [
// https://github.com/Moxio/stylelint-selector-tag-no-without-class/issues/5
{ code: '@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }' },
]
});