2016-07-19 04:46:33 +00:00
|
|
|
(ns re-frame.event-test
|
|
|
|
(:require [cljs.test :refer-macros [is deftest]]
|
|
|
|
[re-frame.db :as db]
|
|
|
|
[re-frame.core :as re-frame]))
|
|
|
|
|
|
|
|
;=====test basic subscriptions ======
|
|
|
|
|
|
|
|
;; disabled as it doesn't really test anything
|
|
|
|
#_(deftest test-event-def
|
|
|
|
"tests that an error thrown generates an informational warning"
|
|
|
|
(re-frame/clear-all-events!)
|
|
|
|
|
2016-08-03 02:53:01 +00:00
|
|
|
(re-frame/reg-event-db
|
2016-07-19 04:46:33 +00:00
|
|
|
:test-event
|
|
|
|
(fn [db [event-kw stack]]
|
|
|
|
(throw (js/Error. "thrown in handler"))
|
|
|
|
db))
|
|
|
|
|
|
|
|
(defn test-fn1
|
|
|
|
[]
|
|
|
|
(re-frame/dispatch [:test-event]))
|
|
|
|
|
|
|
|
(defn test-fn2
|
|
|
|
[]
|
|
|
|
(test-fn1))
|
|
|
|
|
|
|
|
(test-fn2)
|
|
|
|
)
|
|
|
|
|
|
|
|
|