aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/textmodes/css-mode.el2
-rw-r--r--test/lisp/textmodes/css-mode-tests.el6
2 files changed, 7 insertions, 1 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 1de4ff0fca9..f2481da8aa1 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1037,7 +1037,7 @@ This recognizes CSS-color-4 extensions."
1037STR is the incoming CSS hex color. 1037STR is the incoming CSS hex color.
1038This function simply drops any transparency." 1038This function simply drops any transparency."
1039 ;; Either #RGB or #RRGGBB, drop the "A" or "AA". 1039 ;; Either #RGB or #RRGGBB, drop the "A" or "AA".
1040 (if (> (length str) 4) 1040 (if (> (length str) 5)
1041 (substring str 0 7) 1041 (substring str 0 7)
1042 (substring str 0 4))) 1042 (substring str 0 4)))
1043 1043
diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el
index 47cf5f9244b..1e58751f140 100644
--- a/test/lisp/textmodes/css-mode-tests.el
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -295,6 +295,12 @@
295 (insert input ")")) 295 (insert input ")"))
296 (should (equal (css--hsl-color) "#ff0000"))))) 296 (should (equal (css--hsl-color) "#ff0000")))))
297 297
298(ert-deftest css-test-hex-color ()
299 (should (equal (css--hex-color "#abc") "#abc"))
300 (should (equal (css--hex-color "#abcd") "#abc"))
301 (should (equal (css--hex-color "#aabbcc") "#aabbcc"))
302 (should (equal (css--hex-color "#aabbccdd") "#aabbcc")))
303
298(ert-deftest css-test-named-color () 304(ert-deftest css-test-named-color ()
299 (dolist (text '("@mixin black" "@include black")) 305 (dolist (text '("@mixin black" "@include black"))
300 (with-temp-buffer 306 (with-temp-buffer