@@ -4,18 +4,22 @@ import cats.effect.IO
44import japgolly .microlibs .compiletime .CompileTimeInfo
55import japgolly .microlibs .testutil .TestUtil ._
66import japgolly .scalajs .react ._
7+ import japgolly .scalajs .react .vdom .html_<^ ._
78import japgolly .scalajs .react .test .ReactTestUtils ._
89import japgolly .scalajs .react .util .JsUtil
10+ import org .scalajs .dom .console
911import scala .scalajs .js
1012import scala .scalajs .LinkingInfo .developmentMode
1113import scala .util .Try
1214import utest ._
15+ import japgolly .scalajs .react .test .ReactTestUtils
1316
1417object RuntimeTests extends TestSuite {
1518
16- val compNameAuto = CompileTimeInfo .sysProp(" japgolly.scalajs.react.component.names.implicit" )
17- val compNameAll = CompileTimeInfo .sysProp(" japgolly.scalajs.react.component.names.all" )
18- val configClass = CompileTimeInfo .sysProp(" japgolly.scalajs.react.config.class" )
19+ val compNameAuto = CompileTimeInfo .sysProp(" japgolly.scalajs.react.component.names.implicit" )
20+ val compNameAll = CompileTimeInfo .sysProp(" japgolly.scalajs.react.component.names.all" )
21+ val configClass = CompileTimeInfo .sysProp(" japgolly.scalajs.react.config.class" )
22+ val testWarningsReact = CompileTimeInfo .sysProp(" japgolly.scalajs.react.test.warnings.react" )
1923
2024 val dsCfg1 = configClass.contains(" downstream.DownstreamConfig1" )
2125 val dsCfg2 = configClass.contains(" downstream.DownstreamConfig2" )
@@ -82,5 +86,25 @@ object RuntimeTests extends TestSuite {
8286 .map(_.get)
8387 .unsafeToFuture()
8488 }
89+
90+ " testWarnings" - {
91+
92+ " react" - {
93+ val c = ScalaFnComponent [Int ](i => < .p(< .td(s " i = $i" )))
94+ val t = Try (ReactTestUtils .withRenderedIntoBody(c(123 ))(_ => ()))
95+ assertEq(t.isFailure, testWarningsReact.contains(" react" ))
96+ }
97+
98+ " unlreated" - {
99+ val c = ScalaFnComponent [Int ](i => < .p(s " i = $i" ))
100+ val t = Try (ReactTestUtils .withRenderedIntoBody(c(123 )) { _ =>
101+ console.info(" ." )
102+ console.log(" ." )
103+ console.warn(" ." )
104+ console.error(" ." )
105+ })
106+ assertEq(t.isFailure, false )
107+ }
108+ }
85109 }
86110}
0 commit comments