aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorStefan Kangas2020-09-10 20:40:34 +0200
committerStefan Kangas2020-09-10 20:40:34 +0200
commit4ba71eee8d8991c95028df40cb784cb9cb2e964d (patch)
tree9826418e930e28560e53e726fc4ab1b4bfc791b0 /test/lisp
parent498773447ad0640b500572915a15958ac7320f2d (diff)
downloademacs-4ba71eee8d8991c95028df40cb784cb9cb2e964d.tar.gz
emacs-4ba71eee8d8991c95028df40cb784cb9cb2e964d.zip
Convert indent test for css-mode into automatic test
* test/lisp/textmodes/css-mode-tests.el (css-mode-test-indent): New test. (css-mode-tests-data-dir): New variable. * test/manual/indent/css-mode.css: Move from here... * test/lisp/textmodes/css-mode-resources/test-indent.css: ...to here.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/textmodes/css-mode-resources/test-indent.css100
-rw-r--r--test/lisp/textmodes/css-mode-tests.el14
2 files changed, 114 insertions, 0 deletions
diff --git a/test/lisp/textmodes/css-mode-resources/test-indent.css b/test/lisp/textmodes/css-mode-resources/test-indent.css
new file mode 100644
index 00000000000..041aeec1b15
--- /dev/null
+++ b/test/lisp/textmodes/css-mode-resources/test-indent.css
@@ -0,0 +1,100 @@
1/* asdfasdf */
2
3.xxx
4{
5}
6
7article[role="main"] {
8 width: 60%;
9}
10
11a, b:hover, c {
12 color: black !important;
13}
14
15a, b:hover { /* bug:20282 */
16 c {
17 color: black;
18 }
19 color: black;
20}
21
22a.b:c,d.e:f,g[h]:i,j[k]:l,.m.n:o,.p.q:r,.s[t]:u,.v[w]:x { /* bug:20282 */
23 background-color: white;
24}
25
26/* asdfasdf */
27@foo x2 {
28 bla:toto;
29}
30.x2
31{
32 /* foo: bar; */ foo2: bar2;
33 bar1: url("http://toto/titi");
34 bar2: url('http://toto/titi');
35 bar3: url(http://toto/titi);
36}
37
38div.x3
39{
40}
41
42article:hover
43{
44 color: black;
45}
46
47/* bug:13425 */
48div:first-child,
49div:last-child,
50div[disabled],
51div::before {
52 font: 15px "Helvetica Neue",
53 Helvetica,
54 Arial,
55 "Nimbus Sans L",
56 sans-serif;
57 font: 15px "Helvetica Neue", Helvetica, Arial,
58 "Nimbus Sans L", sans-serif;
59 background: no-repeat right
60 5px center;
61 transform: matrix(1.0, 2.0,
62 3.0, 4.0,
63 5.0, 6.0);
64 transform: matrix(
65 1.0, 2.0,
66 3.0, 4.0,
67 5.0, 6.0
68 );
69}
70
71/* Multi-line selector including both a pseudo-class and
72 parenthesis. */
73.form-group:not(.required) label,
74.birth-date .row > * {
75 &::after {
76 display: inline;
77 font-weight: normal;
78 }
79}
80
81@font-face {
82 src: url("Sans-Regular.eot") format("eot"),
83 url("Sans-Regular.woff") format("woff"),
84 url("Sans-Regular.ttf") format("truetype");
85}
86
87@font-face {
88 src:
89 url("Sans-Regular.eot") format("eot"),
90 url("Sans-Regular.woff") format("woff");
91}
92
93.foo-bar--baz {
94 --foo-variable: 5px;
95 --_variable_with_underscores: #fff;
96 --_variable-starting-with-underscore: none;
97 margin: var(--foo-variable);
98 color: var(--_variable_with_underscores);
99 display: var(--_variable-starting-with-underscore);
100}
diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el
index 38cb73b3557..f627d1c02c9 100644
--- a/test/lisp/textmodes/css-mode-tests.el
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -30,6 +30,12 @@
30(require 'ert) 30(require 'ert)
31(require 'seq) 31(require 'seq)
32 32
33(defvar css-mode-tests-data-dir
34 (file-truename
35 (expand-file-name "css-mode-resources/"
36 (file-name-directory (or load-file-name
37 buffer-file-name)))))
38
33(ert-deftest css-test-property-values () 39(ert-deftest css-test-property-values ()
34 ;; The `float' property has a flat value list. 40 ;; The `float' property has a flat value list.
35 (should 41 (should
@@ -411,5 +417,13 @@
411 (point)) 417 (point))
412 "black"))))) 418 "black")))))
413 419
420(ert-deftest css-mode-test-indent ()
421 (with-current-buffer
422 (find-file-noselect (expand-file-name "test-indent.css"
423 css-mode-tests-data-dir))
424 (let ((orig (buffer-string)))
425 (indent-region (point-min) (point-max))
426 (should (equal (buffer-string) orig)))))
427
414(provide 'css-mode-tests) 428(provide 'css-mode-tests)
415;;; css-mode-tests.el ends here 429;;; css-mode-tests.el ends here