summaryrefslogtreecommitdiff
path: root/test/lisp/textmodes
diff options
context:
space:
mode:
authorSimen Heggestøyl <simenheg@gmail.com>2018-01-13 09:41:47 +0100
committerSimen Heggestøyl <simenheg@gmail.com>2018-01-21 14:20:56 +0100
commitcff45e6f4e6a684d233140b5ab3edbf73fa5edae (patch)
treeb1e5ad9b3946aa9d62b188ed6f67ca3c6931b314 /test/lisp/textmodes
parent64c846738617d1d037eac0cefb6586c04317b0a1 (diff)
downloademacs-cff45e6f4e6a684d233140b5ab3edbf73fa5edae.tar.gz
emacs-cff45e6f4e6a684d233140b5ab3edbf73fa5edae.tar.bz2
emacs-cff45e6f4e6a684d233140b5ab3edbf73fa5edae.zip
Parse percent values in CSS alpha components
* lisp/textmodes/css-mode.el (css--rgb-color): Support parsing percent values in the alpha component. * test/lisp/textmodes/css-mode-tests.el (css-test-rgb-to-named-color-or-hex, css-test-rgb-parser): Update for the above changes.
Diffstat (limited to 'test/lisp/textmodes')
-rw-r--r--test/lisp/textmodes/css-mode-tests.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el
index 537a88ec52b..272d281217e 100644
--- a/test/lisp/textmodes/css-mode-tests.el
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -293,7 +293,9 @@
("rgb(255, 255, 255)" "white")
("rgb(255, 255, 240)" "ivory")
("rgb(18, 52, 86)" "#123456")
- ("rgba(18, 52, 86, 0.5)" "#12345680")))
+ ("rgba(18, 52, 86, 0.5)" "#12345680")
+ ("rgba(18, 52, 86, 50%)" "#12345680")
+ ("rgba(50%, 50%, 50%, 50%)" "#80808080")))
(with-temp-buffer
(css-mode)
(insert (nth 0 item))
@@ -330,11 +332,11 @@
(ert-deftest css-test-rgb-parser ()
(with-temp-buffer
(css-mode)
- (dolist (input '("255, 0, 127"
- "255, /* comment */ 0, 127"
- "255 0 127"
- "255, 0, 127, 0.75"
- "255 0 127 / 0.75"
+ (dolist (input '("255, 0, 128"
+ "255, /* comment */ 0, 128"
+ "255 0 128"
+ "255, 0, 128, 0.75"
+ "255 0 128 / 0.75"
"100%, 0%, 50%"
"100%, 0%, 50%, 0.115"
"100% 0% 50%"
@@ -342,7 +344,7 @@
(erase-buffer)
(save-excursion
(insert input ")"))
- (should (equal (css--rgb-color) "#ff007f")))))
+ (should (equal (css--rgb-color) "#ff0080")))))
(ert-deftest css-test-hsl-parser ()
(with-temp-buffer