-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtsi-css.test.el
114 lines (103 loc) · 1.61 KB
/
tsi-css.test.el
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
;; set up some test libraries/utils/variables
(load "tsi.test")
;; require our language-specific file
(require 'tsi-css)
;; our custom matcher doesn't set a major mode, so we associate fundamental-mode with
;; a tree-sitter grammar here
(add-to-list 'tree-sitter-major-mode-language-alist '(fundamental-mode . css))
;; tell tsi.el to use the tsi-css indent function
(setq tsi--test-indent-fn 'tsi-css--indent-line)
(describe
"indenting rules"
(it "properly indents CSS rules inside selectors"
(expect
"
.foo {
color: tomato;
}
"
:to-be-indented))
(it "properly indents CSS rule values"
(expect
"
.foo {
color:
tomato;
}
"
:to-be-indented))
(it "properly indents arguments to CSS functions"
(expect
"
.foo {
color: rgb(
0, 0, 0
);
}
"
:to-be-indented)
(expect
"
.foo {
color: rgb(
0,
0,
0
);
}
"
:to-be-indented)))
(describe
"indenting selectors"
(it "properly indents lists of selectors"
(expect
"
.foo,
.bar {
color: tomato;
}
"
:to-be-indented))
(it "properly indents nested selectors"
(expect
"
.foo {
.bar {
color: tomato;
}
}
"
:to-be-indented)
(expect
"
.foo {
.bar,
.baz {
color: tomato;
}
}
"
:to-be-indented)))
(describe
"indenting comments"
(it "properly indents comments at the head of the file"
(expect
"
/****
* hello there
****/
.foo {
}
"
:to-be-indented))
(it "properly indents comments inside of a selector"
(expect
"
.foo {
/*
* hello there
*/
}
"
:to-be-indented)))
(buttercup-run-discover)