-
-
Notifications
You must be signed in to change notification settings - Fork 929
/
index.mjs
76 lines (73 loc) · 1.85 KB
/
index.mjs
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
73
74
75
76
import rule from '../index.js';
const { messages, ruleName } = rule;
testRule({
ruleName,
config: {
'font-face': ['font-display', 'font-family'],
page: 'margin',
},
accept: [
{
code: "@font-face { font-display: auto; font-family: 'Arvo'; }",
description: '@font-face with both required properties',
},
{
code: "@font-face { font-display: auto; font-family: 'Arvo'; src: url('abc'); /* IE9 */ }",
description: '@font-face with inner comment',
},
{
code: "@FONT-FACE { FONT-DISPLAY: AUTO; FONT-FAMILY: 'ARVO'; }",
description: '@font-face with both required properties (case-sensitive)',
},
{
code: '@page { padding: 0.5cm; margin: 1cm; }',
description: '@page with required property',
},
{
code: '@counter-style counter { system: cyclic; }',
description: 'at-rule not specified in config',
},
{
code: '@mixin invalid-at-rule { @content; }',
description: '@mixin with invalid at-rule',
},
],
reject: [
{
code: '@font-face { font-display: auto; }',
description: '@font-face with missing property',
message: messages.expected('font-face', 'font-family'),
line: 1,
column: 1,
endLine: 1,
endColumn: 11,
},
{
code: '@FONT-FACE { FONT-DISPLAY: AUTO; }',
description: '@font-face with missing property (case-sensitive)',
message: messages.expected('font-face', 'font-family'),
line: 1,
column: 1,
endLine: 1,
endColumn: 11,
},
{
code: "@font-face { font-family: 'Arvo'; font-weight: normal }",
description: '@font-face with missing property',
message: messages.expected('font-face', 'font-display'),
line: 1,
column: 1,
endLine: 1,
endColumn: 11,
},
{
code: '@page { padding: 0.5cm }',
description: '@page with missing property',
message: messages.expected('page', 'margin'),
line: 1,
column: 1,
endLine: 1,
endColumn: 6,
},
],
});