Skip to content

Commit

Permalink
Use new test utils in more test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Deraen committed Nov 28, 2024
1 parent 0808005 commit 7201852
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 2 additions & 0 deletions demo/reagentdemo/intro.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
[:p "Change it here: " [atom-input val]]])))

(defn timer-component []
;; FIXME: For some reason these timeouts trigger multiple
;; renders and each render triggers a new timeout.
(let [seconds-elapsed (r/atom 0)]
(fn []
(js/setTimeout #(swap! seconds-elapsed inc) 1000)
Expand Down
10 changes: 1 addition & 9 deletions test/reagenttest/testreagent.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
[clojure.test :as t :refer-macros [is deftest testing]]
[goog.object :as gobj]
[goog.string :as gstr]
[promesa.core :as p]
[react :as react]
[reagent.core :as r]
[reagent.debug :as debug :refer [dev?]]
Expand Down Expand Up @@ -726,7 +725,6 @@
(as-string [:div 1])))
(is (= [1 1 1] [@n1 @n2 @n3]))))

#_
(u/deftest ^:dom lifecycle
(let [n1 (atom 0)
t (atom 0)
Expand Down Expand Up @@ -1046,7 +1044,6 @@
(.-componentStack ^js @info))))))))

#_{:clj-kondo/ignore [:deprecated-var]}
#_
(u/deftest ^:dom test-dom-node
(let [node (atom nil)
ref (atom nil)
Expand All @@ -1072,6 +1069,7 @@
(is (= "<p>#object[reagent.ratom.RAtom {:val 1}]</p>"
(as-string [:p (r/atom 1)]))))

;; FIXME: r/after-render won't work
#_
(u/deftest ^:dom test-after-render
(let [spy (atom 0)
Expand Down Expand Up @@ -1164,7 +1162,6 @@
[:div "child," (gobj/get (.-context this) "foo")]))}))

;; Class component only
#_
(deftest ^:dom context-test
(u/async
(u/with-render [div [context-wrapper [context-child]]]
Expand Down Expand Up @@ -1270,7 +1267,6 @@
(is (re-find #"Warning: Exception thrown while comparing argv's in shouldComponentUpdate:"
(first (:warn @reagent.debug/warnings)))))))))

#_
(u/deftest ^:dom get-derived-state-from-props-test
(let [prop (r/atom 0)
;; Usually one can use Cljs object as React state. However,
Expand Down Expand Up @@ -1317,7 +1313,6 @@
(u/act (swap! prop inc))
(is (= "Error" (.-innerText div)))))))

#_
(u/deftest ^:dom get-snapshot-before-update-test
(let [ref (react/createRef)
prop (r/atom 0)
Expand All @@ -1344,7 +1339,6 @@
(is (= {:height 20} @did-update))
(.removeChild js/document.body div)))))

#_
(u/deftest ^:dom issue-462-test
(let [val (r/atom 0)
render (atom 0)
Expand Down Expand Up @@ -1389,7 +1383,6 @@
(finally
(r/set-default-compiler! nil)))))))

#_
(deftest ^:dom functional-component-poc-state-hook
(let [;; Probably not the best idea to keep
;; refernce to state hook update fn, but
Expand Down Expand Up @@ -1435,7 +1428,6 @@
(u/act (@set-count! 17))
(is (= "Counts 6 17" (.-innerText div)))))))

#_
(u/deftest ^:dom test-input-el-ref
(let [ref-1 (atom nil)
ref-1-fn #(reset! ref-1 %)
Expand Down

0 comments on commit 7201852

Please sign in to comment.