1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-24 10:38:38 +00:00

Add tests for `css-current-defun-name'

* test/lisp/textmodes/css-mode-tests.el (css-test-current-defun-name)
(css-test-current-defun-name-nested)
(css-test-current-defun-name-complex): New tests for
`css-current-defun-name'.
This commit is contained in:
Simen Heggestøyl 2017-09-28 18:47:07 +02:00
parent 88a0dd71f1
commit 0f9a78e770

View File

@ -80,6 +80,27 @@
(equal (seq-sort #'string-lessp (css--value-class-lookup 'position))
'("bottom" "calc()" "center" "left" "right" "top"))))
(ert-deftest css-test-current-defun-name ()
(with-temp-buffer
(insert "body { top: 0; }")
(goto-char 7)
(should (equal (css-current-defun-name) "body"))
(goto-char 18)
(should (equal (css-current-defun-name) "body"))))
(ert-deftest css-test-current-defun-name-nested ()
(with-temp-buffer
(insert "body > .main a { top: 0; }")
(goto-char 20)
(should (equal (css-current-defun-name) "body > .main a"))))
(ert-deftest css-test-current-defun-name-complex ()
(with-temp-buffer
(insert "input[type=submit]:hover { color: red; }")
(goto-char 30)
(should (equal (css-current-defun-name)
"input[type=submit]:hover"))))
;;; Completion
(defun css-mode-tests--completions ()