Skip to content

Commit

Permalink
More cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Deraen committed Nov 28, 2024
1 parent 7201852 commit 5f1552f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
5 changes: 0 additions & 5 deletions test/reagenttest/testreagent.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,6 @@
(rstr [:p "p:a" [:b "b"] [:i "i"]])))
(is (= nil @a))))

;; TODO: Need to make track-warnings work with Promises?
#_
(u/deftest ^:dom test-keys
(u/async
(p/let [a nil ;; (r/atom "a")
Expand Down Expand Up @@ -1009,7 +1007,6 @@
(is (re-find #"Every element in a seq should have a unique :key"
(-> e :warn first))))))))

#_
(u/deftest ^:dom test-error-boundary
(let [error (r/atom nil)
info (r/atom nil)
Expand Down Expand Up @@ -1240,7 +1237,6 @@
#js {:value "foo"}
[:f> comp]]))))))

#_
(u/deftest ^:dom on-failed-prop-comparison-in-should-update-swallow-exception-and-do-not-update-component
(let [prop (r/atom {:todos 1})
component-was-updated (atom false)
Expand Down Expand Up @@ -1289,7 +1285,6 @@
(u/act (swap! prop inc))
(is (= "Value foo foo" (.-innerText div)))))))

#_
(u/deftest ^:dom get-derived-state-from-error-test
(let [prop (r/atom 0)
component (r/create-class
Expand Down
3 changes: 0 additions & 3 deletions test/reagenttest/testwrap.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@
(swap! b inc)))
(is (= 24 @a @b))))

#_
(u/deftest ^:dom test-wrap
(let [compiler u/*test-compiler*
state (r/atom {:foo {:bar {:foobar 1}}})
Expand Down Expand Up @@ -160,7 +159,6 @@

))))

#_
(u/deftest ^:dom test-cursor
(let [compiler u/*test-compiler*
state (r/atom {:a {:v 1}
Expand Down Expand Up @@ -195,7 +193,6 @@
(is (= 3 @a-count))
(is (= 1 @b-count))))))

#_
(u/deftest ^:dom test-fn-cursor
(let [state (r/atom {:a {:v 1}
:b {:v 2}})
Expand Down
1 change: 0 additions & 1 deletion test/reagenttest/utils.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

(defmacro deftest [test-name & body]
`(do
#_
(cljs.test/deftest
~(with-meta (symbol (str (name test-name) "--class"))
(meta test-name))
Expand Down
19 changes: 19 additions & 0 deletions test/reagenttest/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,25 @@
(let [process (js/require "process")]
(.removeListener process "uncaughtException" l))))))

(defn wrap-capture-window-error-promise [f]
(if (exists? js/window)
(fn []
(let [org js/console.onerror]
(set! js/window.onerror (fn [e]
(log-error e)
true))
(-> (f)
(p/finally
(fn [] (set! js/window.onerror org))))))
(fn []
(let [process (js/require "process")
l (fn [e]
(log-error e))]
(.on process "uncaughtException" l)
(-> (f)
(p/finally
(fn [] (.removeListener process "uncaughtException" l))))))))

(defn act*
"Run f to trigger Reagent updates,
will return Promise which will resolve after
Expand Down

0 comments on commit 5f1552f

Please sign in to comment.