]> code.delx.au - gnu-emacs/blob - test/lisp/textmodes/css-mode-tests.el
Merge from origin/emacs-25
[gnu-emacs] / test / lisp / textmodes / css-mode-tests.el
1 ;;; css-mode-tests.el --- Test suite for CSS mode -*- lexical-binding: t; -*-
2
3 ;; Copyright (C) 2016 Free Software Foundation, Inc.
4
5 ;; Author: Simen Heggestøyl <simenheg@gmail.com>
6 ;; Keywords: internal
7
8 ;; This file is part of GNU Emacs.
9
10 ;; This program is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
14
15 ;; This program is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
22
23 ;;; Commentary:
24
25 ;;; Code:
26
27 (require 'ert)
28 (require 'css-mode)
29
30 (ert-deftest css-test-property-values ()
31 ;; The `float' property has a flat value list.
32 (should
33 (equal (sort (css--property-values "float") #'string-lessp)
34 '("left" "none" "right")))
35
36 ;; The `list-style' property refers to several other properties.
37 (should
38 (equal (sort (css--property-values "list-style") #'string-lessp)
39 (sort (append (css--property-values "list-style-type")
40 (css--property-values "list-style-position")
41 (css--property-values "list-style-image"))
42 #'string-lessp)))
43
44 ;; The `position' property is tricky because it's also the name of a
45 ;; value class.
46 (should
47 (equal (sort (css--property-values "position") #'string-lessp)
48 '("absolute" "fixed" "relative" "static")))
49
50 ;; The `background-position' property should refer to the `position'
51 ;; value class, not the property of the same name.
52 (should
53 (equal (css--property-values "background-position")
54 (css--value-class-lookup 'position)))
55
56 ;; Check that the `color' property doesn't cause infinite recursion
57 ;; because it refers to the value class of the same name.
58 (should (= (length (css--property-values "color")) 18)))
59
60 (ert-deftest css-test-value-class-lookup ()
61 (should
62 (equal (sort (css--value-class-lookup 'position) #'string-lessp)
63 '("bottom" "center" "left" "right" "top"))))
64
65 (provide 'css-mode-tests)
66 ;;; css-mode-tests.el ends here