Library for testing Reagent based applications
- 🖨️ Extracting component data
- 👆 Clicking on an element
- 📝 Input element filling
- 👀 Component rendering
com.health-samurai/retest {:git/url "https://github.com/HealthSamurai/retest.git"
:sha "f83591af5d0f75dcdb5731dcdc59d5519b4d6c41"}
(defn form-1
[v]
[:div v])
(defn form-2 [_]
(fn [v]
[form-1 v]))
(retest.core/render [form-2 1])
;; => [:div 1]
(defn component
[]
[:div {:data-object :a}
[:div {:data-key :b} "1"]
[:div {:data-array :c}
(for [i [1 2 3]]
[:div {:data-key :d} i])]])
(retest.core/datafy component)
;; =>
;; {:a {:b "1"
;; :c [{:d "1"}
;; {:d "2"}
;; {:d "3"}]}}
(defn component
[]
[:form [:button {:id ::foo :on-click (fn [_] (prn "clicked"))}]])
(retest.core/click component ::foo)
;; => "clicked"
(defn component
[]
[:form
[:input {:id ::foo
:on-change (fn [event]
(prn #?(:clj (-> @event :target :value)
:cljs (.. event -target -value))))}]])
(retest.core/fill component ::foo "value")
;; => "value"