diff options
| author | Simen Heggestøyl | 2017-09-28 18:47:07 +0200 |
|---|---|---|
| committer | Simen Heggestøyl | 2017-09-28 18:55:06 +0200 |
| commit | 0f9a78e7700ab3eed370c2f616d7932d953dd100 (patch) | |
| tree | 642b065f6f45df4c8f8a8ecd3880fc5f699f34db | |
| parent | 88a0dd71f10ffb63fba08c062e948551c3e876c2 (diff) | |
| download | emacs-0f9a78e7700ab3eed370c2f616d7932d953dd100.tar.gz emacs-0f9a78e7700ab3eed370c2f616d7932d953dd100.zip | |
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'.
| -rw-r--r-- | test/lisp/textmodes/css-mode-tests.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el index f93fdbbc5af..47cf5f9244b 100644 --- a/test/lisp/textmodes/css-mode-tests.el +++ b/test/lisp/textmodes/css-mode-tests.el | |||
| @@ -80,6 +80,27 @@ | |||
| 80 | (equal (seq-sort #'string-lessp (css--value-class-lookup 'position)) | 80 | (equal (seq-sort #'string-lessp (css--value-class-lookup 'position)) |
| 81 | '("bottom" "calc()" "center" "left" "right" "top")))) | 81 | '("bottom" "calc()" "center" "left" "right" "top")))) |
| 82 | 82 | ||
| 83 | (ert-deftest css-test-current-defun-name () | ||
| 84 | (with-temp-buffer | ||
| 85 | (insert "body { top: 0; }") | ||
| 86 | (goto-char 7) | ||
| 87 | (should (equal (css-current-defun-name) "body")) | ||
| 88 | (goto-char 18) | ||
| 89 | (should (equal (css-current-defun-name) "body")))) | ||
| 90 | |||
| 91 | (ert-deftest css-test-current-defun-name-nested () | ||
| 92 | (with-temp-buffer | ||
| 93 | (insert "body > .main a { top: 0; }") | ||
| 94 | (goto-char 20) | ||
| 95 | (should (equal (css-current-defun-name) "body > .main a")))) | ||
| 96 | |||
| 97 | (ert-deftest css-test-current-defun-name-complex () | ||
| 98 | (with-temp-buffer | ||
| 99 | (insert "input[type=submit]:hover { color: red; }") | ||
| 100 | (goto-char 30) | ||
| 101 | (should (equal (css-current-defun-name) | ||
| 102 | "input[type=submit]:hover")))) | ||
| 103 | |||
| 83 | ;;; Completion | 104 | ;;; Completion |
| 84 | 105 | ||
| 85 | (defun css-mode-tests--completions () | 106 | (defun css-mode-tests--completions () |