   (testing "returns a map of answer to color"
     (is (= (group-user-defined-colors-by-answer field)
            {"good" "green" "bad" "red"}))))
+
+(deftest test-answer->color
+  (testing "returns a map of answer to color if field is select-one
+            and all children have an appearance attribute"
+    (is (= (answer->color field answers)
+           {"good" "green" "bad" "red"})))
+  (testing "returns a map of answer to color based on the qualitative palette
+            if the choices do not all have appearance attributes"
+    (let [answers-to-test (assoc-in answers [1 :appearance] nil)
+          field-to-test (assoc field :children answers-to-test)
+          [good-choice bad-choice] answers-to-test
+          [good-color bad-color] qualitative-palette]
+      (is (= (answer->color field-to-test answers-to-test)
+             {good-choice good-color bad-choice bad-color})))))

(def css-rule-map
  {(-> customizable-style first keyword) "style-definition"})

(def field {:name field-name
            :full-name field-name
            :type "select_one"
            :children [{:appearance "color:green;font-weight:bold;"
                        :name "good"}
                       {:appearance "color:red;"
                        :name "bad"}]})

(deftest test-customizable-style?
  (testing "returns whether a style representation is customizable"

(ns hatti.utils.style-test
  (:require-macros [cljs.test :refer [is deftest testing]])
  (:require [clojure.string :refer [join]]
            [hatti.utils.style :refer [answer->color
                                       customizable-style?
                                       get-css-rule-map
                                       group-user-defined-colors-by-answer
                                       group-user-defined-styles-by-answer
                                       qualitative-palette
                                       user-customizable-styles]]))

(def customizable-style [(first user-customizable-styles)
