@@ -4,7 +4,6 @@ import japgolly.scalajs.react._
44import japgolly .scalajs .react .facade .{React => RawReact , ReactDOM => RawReactDOM }
55import japgolly .scalajs .react .hooks .Hooks
66import japgolly .scalajs .react .internal .CoreGeneral ._
7- import japgolly .scalajs .react .test .ReactTestUtilsConfig .aroundReact
87import japgolly .scalajs .react .util .DefaultEffects .{Async => DA , Sync => DS }
98import japgolly .scalajs .react .util .Effect ._
109import japgolly .scalajs .react .util .JsUtil
@@ -106,30 +105,13 @@ object LegacyReactTestUtils extends LegacyReactTestUtils {
106105
107106 def _withRenderedAsync [F [_], M , A ](u : Unmounted [M ], parent : Element , f : (M , Element ) => F [A ])
108107 (implicit F : Async [F ]): F [A ] =
109- aroundReactAsync {
108+ ReactTestUtilsConfig .aroundReact.async {
110109 F .flatMap(F .delay(act(RawReactDOM .render(u.raw, parent)))) { c =>
111110 val m = u.mountRawOrNull(c)
112111 F .finallyRun(f(m, parent), F .delay(act(unmountRawComponent(c))))
113112 }
114113 }
115114
116- def aroundReactAsync [F [_], A ](body : F [A ])(implicit F : Async [F ]): F [A ] = {
117- val start = F .delay {
118- val stop = aroundReact.start()
119- F .delay(stop())
120- }
121- F .flatMap(start) { stop =>
122- F .finallyRun(body, stop)
123- }
124- }
125-
126- def aroundReactFuture [A ](body : => Future [A ])(implicit ec : ExecutionContext ): Future [A ] = {
127- val stop = aroundReact.start()
128- val f = body
129- f.onComplete { _ => stop() }
130- f
131- }
132-
133115 } // Internals
134116}
135117
@@ -279,7 +261,7 @@ trait LegacyReactTestUtils extends japgolly.scalajs.react.test.internal.ReactTes
279261 new WithRenderedDsl [M , Element ] {
280262 override def apply [A ](f : (M , Element ) => A ): A =
281263 withNewBodyElement { parent =>
282- aroundReact.sync {
264+ ReactTestUtilsConfig . aroundReact.sync {
283265 val c = act(RawReactDOM .render(u.raw, parent))
284266 try
285267 f(u.mountRawOrNull(c), parent)
@@ -308,7 +290,7 @@ trait LegacyReactTestUtils extends japgolly.scalajs.react.test.internal.ReactTes
308290 */
309291 def withRenderedIntoBodyFuture [M , A ](u : Unmounted [M ])(f : M => Future [A ])(implicit ec : ExecutionContext ): Future [A ] =
310292 withNewBodyElementFuture { parent =>
311- aroundReactFuture {
293+ ReactTestUtilsConfig .aroundReact.future {
312294 val c = act(RawReactDOM .render(u.raw, parent))
313295 val m = u.mountRawOrNull(c)
314296 attemptFuture(f(m)).andThen { case _ => act(unmountRawComponent(c)) }
@@ -357,7 +339,7 @@ trait LegacyReactTestUtils extends japgolly.scalajs.react.test.internal.ReactTes
357339 def withRenderedIntoDocument [M ](u : Unmounted [M ]): WithRenderedDsl [M , Element ] =
358340 new WithRenderedDsl [M , Element ] {
359341 override def apply [A ](f : (M , Element ) => A ): A =
360- aroundReact.sync {
342+ ReactTestUtilsConfig . aroundReact.sync {
361343 val c = act(raw.renderIntoDocument(u.raw))
362344 try {
363345 val p = parentElement(c)
@@ -377,7 +359,7 @@ trait LegacyReactTestUtils extends japgolly.scalajs.react.test.internal.ReactTes
377359 * and asynchronously waits for the Future to complete before unmounting.
378360 */
379361 def withRenderedIntoDocumentFuture [M , A ](u : Unmounted [M ])(f : M => Future [A ])(implicit ec : ExecutionContext ): Future [A ] =
380- aroundReactFuture {
362+ ReactTestUtilsConfig .aroundReact.future {
381363 val c = act(raw.renderIntoDocument(u.raw))
382364 val m = u.mountRawOrNull(c)
383365 attemptFuture(f(m)).andThen { case _ => act(unmountRawComponent(c)) }
0 commit comments