diff --git a/common/src/app/common/data.cljc b/common/src/app/common/data.cljc index 70f775b4c3..715bd97544 100644 --- a/common/src/app/common/data.cljc +++ b/common/src/app/common/data.cljc @@ -1156,5 +1156,6 @@ (defn append-class [class current-class] - (str (if (some? class) (str class " ") "") - current-class)) + (if (seq class) + (str class " " current-class) + current-class)) diff --git a/common/test/common_tests/data_test.cljc b/common/test/common_tests/data_test.cljc index f0487ed71d..d85e835af9 100644 --- a/common/test/common_tests/data_test.cljc +++ b/common/test/common_tests/data_test.cljc @@ -791,7 +791,8 @@ (t/deftest append-class-test (t/is (= "foo bar" (d/append-class "foo" "bar"))) (t/is (= "bar" (d/append-class nil "bar"))) - (t/is (= " bar" (d/append-class "" "bar")))) + ;; empty string is treated like nil — no leading space + (t/is (= "bar" (d/append-class "" "bar")))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Additional helpers (5th batch)