Skip to content

Commit

Permalink
Enable React 18 mode for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Deraen committed Nov 15, 2024
1 parent 33d49e4 commit 5aff494
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions test/reagenttest/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[reagent.core :as r]
[reagent.dom :as rdom]
[reagent.dom.server :as server]
[reagent.dom.client :as rdomc]
[reagent.debug :as debug]
[reagent.impl.template :as tmpl]))

Expand Down Expand Up @@ -36,24 +37,26 @@
([comp f]
(with-mounted-component comp *test-compiler* f))
([comp compiler f]
(let [div (.createElement js/document "div")]
(let [div (.createElement js/document "div")
root (rdomc/create-root div)]
(try
(let [c (if compiler
(rdom/render comp div compiler)
(rdom/render comp div))]
(rdomc/render root comp compiler)
(rdomc/render root comp))]
(f c div))
(finally
(rdom/unmount-component-at-node div)
(.unmount root)
(r/flush))))))

(defn with-mounted-component-async
[comp done compiler f]
(let [div (.createElement js/document "div")
root (rdomc/create-root div)
c (if compiler
(rdom/render comp div compiler)
(rdom/render comp div))]
(rdomc/render root comp compiler)
(rdomc/render root comp))]
(f c div (fn []
(rdom/unmount-component-at-node div)
(.unmount root)
(r/flush)
(done)))))

Expand Down

0 comments on commit 5aff494

Please sign in to comment.