                 {}
                 {'ui/query (fn [] "Hello world")})
       (is (= "Hello world" (text (sel1 "#result")))))
+    (testing "to callback binding to global cells"
+      (install! {:text "Hello world"}
+                "{:upcased-text #= (ui/upcase #= :text)}"
+                "[:div#result #= :upcased-text]"
+                {}
+                {'ui/upcase (fn [_ text]
+                              (str/upper-case text))})
+      (is (= "HELLO WORLD" (text (sel1 "#result")))))
     (testing "to callback binding to data"
       (install! {:text "Hello world"}
                 "{:upcased-text #= (ui/upcase #= :text)}"


(deftest test-compile-ui
  (testing "Markup generation"
    (testing "Static markup"
      (install! {} "{:text \"Hello\"}" "[:div#text \"Hello\"]" {} {})
      (is (= "Hello" (text (sel1 "#text"))))))
  (testing "Data binding"
    (testing "One way cell binding"
      (install! {} "{:text \"Hello\"}" "[:div#text #= :text]" {} {})
      (is (= "Hello" (text (sel1 "#text")))))
    (testing "Nested markup"
      (install! {} "{:text \"Hello\"}" "[:div [:div#text #= :text]]" {} {})
      (is (= "Hello" (text (sel1 "#text")))))
    (testing "Two-way cell binding"
      (install! {} "{:text \"Hello\"}"
                "[:div
                 [:ui/button \"btn\" #= :text]

      (async done
        (go (is (= "Bye" (text (sel1 "#result"))))
            (done))))
    (testing "to nested data"
      (install! {} "{:user {:name \"John Smith\"}}"
                "[:div#user-name #= [:user :name]]"
                {} {})
      (is (= "John Smith" (text (sel1 "#user-name")))))
    (testing "to flat data using key sequence"
      (install! {} "{:text \"Hello world\"}"
                "[:div#result #= [:text]]"
                {} {})
      (is (= "Hello world" (text (sel1 "#result"))))))
  (testing "Callback"
    (testing "invoked with no arguments"
      (let [clicked (atom false)]
        (install! {} "{:text \"Hello\"}"
                  "[:div
