Skip to content

Commit e093d6b

Browse files
committed
Separate tests
1 parent 45fc088 commit e093d6b

File tree

6 files changed

+530
-529
lines changed

6 files changed

+530
-529
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"jest": true
88
},
99
"globals": {
10-
"groupTest": true
10+
"groupTest": true,
11+
"runTest": true
1112
}
1213
}

__tests__/clean-empty-lines.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use strict';
2+
3+
test(
4+
'Should remove empty lines',
5+
() => runTest('empty-lines-remove',
6+
{
7+
'clean-empty-lines': true,
8+
}
9+
)
10+
);
11+
12+
test(
13+
`Shouldn't mess with line breaks`,
14+
() => runTest('empty-lines-preserve-1',
15+
{
16+
'clean-empty-lines': true,
17+
}
18+
)
19+
);
20+
21+
test(
22+
`Shouldn't remove empty lines`,
23+
() => runTest('empty-lines-preserve-2',
24+
{
25+
'clean-empty-lines': false,
26+
}
27+
)
28+
);

__tests__/order.js

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
'use strict';
2+
3+
const config = {
4+
order: [
5+
'declarations',
6+
'rules',
7+
],
8+
};
9+
10+
test(
11+
'Should not remove comments in rules if they are only children',
12+
() => runTest('rules-with-comments-only', config)
13+
);
14+
15+
test(
16+
`Should not remove first comment in the rule if it's not on separate line (order)`,
17+
() => runTest('first-comment-in-the-rule', config)
18+
);
19+
20+
test(
21+
'Should not remove last comments in the rule',
22+
() => runTest('last-comments', config)
23+
);
24+
25+
test(
26+
'Should assign comments before and after nodes correctly (order)',
27+
() => runTest('nodes-comments.css',
28+
{
29+
order: [
30+
'custom-properties',
31+
'dollar-variables',
32+
'declarations',
33+
],
34+
}
35+
)
36+
);
37+
38+
test(
39+
'Should sort by keywords',
40+
() => runTest('keywords',
41+
{
42+
order: [
43+
'custom-properties',
44+
'dollar-variables',
45+
'declarations',
46+
'rules',
47+
'at-rules',
48+
],
49+
}
50+
)
51+
);
52+
53+
test(
54+
'At-rules combination from most specified to least specified',
55+
() => runTest('at-rules',
56+
{
57+
order: [
58+
{
59+
type: 'at-rule',
60+
name: 'include',
61+
parameter: 'media',
62+
hasBlock: true,
63+
},
64+
{
65+
type: 'at-rule',
66+
name: 'include',
67+
parameter: 'media',
68+
},
69+
{
70+
type: 'at-rule',
71+
name: 'include',
72+
hasBlock: true,
73+
},
74+
{
75+
type: 'at-rule',
76+
name: 'include',
77+
},
78+
{
79+
type: 'at-rule',
80+
hasBlock: true,
81+
},
82+
{
83+
type: 'at-rule',
84+
},
85+
],
86+
}
87+
)
88+
);
89+
90+
test(
91+
'At-rules mixed combination',
92+
() => runTest('at-rules-mixed',
93+
{
94+
order: [
95+
{
96+
type: 'at-rule',
97+
name: 'include',
98+
hasBlock: true,
99+
},
100+
{
101+
type: 'at-rule',
102+
name: 'include',
103+
},
104+
{
105+
type: 'at-rule',
106+
hasBlock: true,
107+
},
108+
{
109+
type: 'at-rule',
110+
name: 'include',
111+
parameter: 'media',
112+
},
113+
{
114+
type: 'at-rule',
115+
name: 'include',
116+
parameter: 'media',
117+
hasBlock: true,
118+
},
119+
],
120+
}
121+
)
122+
);
123+
124+
test(
125+
'Should sort inside nested rules',
126+
() => runTest('nested-rule',
127+
{
128+
order: [
129+
'custom-properties',
130+
'declarations',
131+
'rules',
132+
],
133+
}
134+
)
135+
);
136+
137+
test(
138+
'Should sort inside nested at-rules',
139+
() => runTest('nested-at-rule',
140+
{
141+
order: [
142+
'custom-properties',
143+
'declarations',
144+
'at-rules',
145+
],
146+
}
147+
)
148+
);
149+
150+
test(
151+
'Should move unspecified nodes to the bottom',
152+
() => runTest('unspecified-nodes',
153+
{
154+
order: [
155+
'custom-properties',
156+
'declarations',
157+
],
158+
}
159+
)
160+
);
161+
162+
test(
163+
'Should preserve indentation',
164+
() => runTest('indent',
165+
{
166+
order: [
167+
'declarations',
168+
'rules',
169+
'at-rules',
170+
],
171+
}
172+
)
173+
);

0 commit comments

Comments
 (0)