             [kioo.test :refer [render-dom]]
             [goog.dom :as gdom])
   (:require-macros [kioo.core :refer [component  snippet template
-                                    defsnippet deftemplate supress-whitespace]]
+                                    defsnippet deftemplate supress-whitespace
+                                      register-selector!]]
                    [cljs.test :refer [are is deftest testing]]))
 
+(register-selector! test-sel kioo.core/first-match)
 
 (deftest render-test
   (testing "basic render test"

          will-mount (atom "fail")
          did-mount (atom "fail")
          comp (component "simple-div.html"
                          {[:div] (lifecycle
                                   {:init-state (fn [this] (reset! init-state "success") {})
                                    :default-props (fn [this] (reset! default-props "success"))
                                    :should-update
                                    (fn [this next-props next-state]
                                      (reset! should-update "success")
                                      true)
                                    :will-mount (fn [this] (reset! will-mount "success"))
                                    :did-mount (fn [this] (reset! did-mount "success"))
                                    :will-receive-props (fn [this next-props]
                                                          (reset! will-receive-props "success"))
                                    :will-update (fn [this next-props next-state]
                                                   (reset! will-update "success"))
                                    :did-update (fn [this prev-props prev-state]
                                                  (reset! did-update "success"))})})]
      (render-dom comp)
      (is (= "success" @init-state))
      (is (= "success" @will-mount))
      (is (= "success" @did-mount))

      ;;need to workout how to test these
      ;(is (= "success" @default-props))
      ;(is (= "success" @should-update))
      ;(is (= "success" @will-receive-props))
      ;(is (= "success" @will-update))
      ;(is (= "success" @did-update))
      ))
  (testing "checking for camel cased attributes"
    (let [comp (component "camel-case.html"
                          {[:td] (content "test")})]
      (is (= "<table><tbody><tr><td colspan=\"2\">test</td></tr></tbody></table>" (render-dom comp))))))



      (is (= "<div id=\"tmp\">test</div>" (render-dom comp)))))
  (testing "content replace"
    (let [comp (component "simple-div.html"
                 {[:div] (content "success")})]
      (is (= "<div id=\"tmp\">success</div>" (render-dom comp)))))
  (testing "first-of-type naked symbol"
    (let [comp (component "list.html" [:ul [:li first-of-type]] {})]
