@@ -8,7 +8,6 @@ import japgolly.scalajs.react.test.ReactTestUtils._
88import japgolly .scalajs .react .test .TestUtil ._
99import japgolly .scalajs .react .test .{DomTester , TestReactRoot }
1010import japgolly .scalajs .react .vdom .html_<^ ._
11- import org .scalajs .dom .html .Input
1211import scala .collection .mutable
1312import scala .scalajs .js
1413import utest ._
@@ -1590,80 +1589,80 @@ object HooksTest extends AsyncTestSuite {
15901589 }
15911590 }
15921591
1593- private def testUseRefVdom (): Unit = {
1594- var text = " uninitialised"
1595- val comp = ScalaFnComponent .withHooks[Unit ]
1596- .useRefToVdom[Input ]
1597- .useState(" x" )
1598- .render { (_, inputRef, s) =>
1599- def onChange (e : ReactEventFromInput ): Callback =
1600- s.setState(e.target.value)
1601-
1602- def btn : Callback =
1603- for {
1604- i <- inputRef.get.asCBO
1605- // _ <- Callback.log(s"i.value = [${i.value}]")
1606- } yield {
1607- text = i.value
1608- }
1609-
1610- < .div(
1611- < .input.text.withRef(inputRef)(^ .value := s.value, ^ .onChange ==> onChange),
1612- < .button(^ .onClick --> btn)
1613- )
1614- }
1615-
1616- test(comp()) { t =>
1617- t.assertInputText(" x" )
1618- for {
1619- _ <- t.clickButton()
1620- _ = assertEq(text, " x" )
1621- _ <- t.setInputText(" hehe" )
1622- _ = t.assertInputText(" hehe" )
1623- _ <- t.clickButton()
1624- _ = assertEq(text, " hehe" )
1625- } yield ()
1626- }
1627- }
1592+ // private def testUseRefVdom(): Unit = {
1593+ // var text = "uninitialised"
1594+ // val comp = ScalaFnComponent.withHooks[Unit]
1595+ // .useRefToVdom[Input]
1596+ // .useState("x")
1597+ // .render { (_, inputRef, s) =>
1598+ // def onChange(e: ReactEventFromInput): Callback =
1599+ // s.setState(e.target.value)
16281600
1629- private def testMonadicUseRefVdom (): Unit = {
1630- var text = " uninitialised"
1631- val comp = ScalaFnComponent [Unit ] { _ =>
1632- for {
1633- inputRef <- useRefToVdom[Input ]
1634- s <- useState(" x" )
1635- } yield {
1636-
1637- def onChange (e : ReactEventFromInput ): Callback =
1638- s.setState(e.target.value)
1601+ // def btn: Callback =
1602+ // for {
1603+ // i <- inputRef.get.asCBO
1604+ // // _ <- Callback.log(s"i.value = [${i.value}]")
1605+ // } yield {
1606+ // text = i.value
1607+ // }
16391608
1640- def btn : Callback =
1641- for {
1642- i <- inputRef.get.asCBO
1643- // _ <- Callback.log(s"i.value = [${i.value}]")
1644- } yield {
1645- text = i.value
1646- }
1609+ // <.div(
1610+ // <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange),
1611+ // <.button(^.onClick --> btn)
1612+ // )
1613+ // }
1614+
1615+ // test(comp()) { t =>
1616+ // t.assertInputText("x")
1617+ // for {
1618+ // _ <- t.clickButton()
1619+ // _ = assertEq(text, "x")
1620+ // _ <- t.setInputText("hehe")
1621+ // _ = t.assertInputText("hehe")
1622+ // _ <- t.clickButton()
1623+ // _ = assertEq(text, "hehe")
1624+ // } yield ()
1625+ // }
1626+ // }
1627+
1628+ // private def testMonadicUseRefVdom(): Unit = {
1629+ // var text = "uninitialised"
1630+ // val comp = ScalaFnComponent[Unit] { _ =>
1631+ // for {
1632+ // inputRef <- useRefToVdom[Input]
1633+ // s <- useState("x")
1634+ // } yield {
1635+
1636+ // def onChange(e: ReactEventFromInput): Callback =
1637+ // s.setState(e.target.value)
1638+
1639+ // def btn: Callback =
1640+ // for {
1641+ // i <- inputRef.get.asCBO
1642+ // // _ <- Callback.log(s"i.value = [${i.value}]")
1643+ // } yield {
1644+ // text = i.value
1645+ // }
16471646
1648- < .div(
1649- < .input.text.withRef(inputRef)(^ .value := s.value, ^ .onChange ==> onChange),
1650- < .button(^ .onClick --> btn)
1651- )
1652- }
1653- }
1647+ // <.div(
1648+ // <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange),
1649+ // <.button(^.onClick --> btn)
1650+ // )
1651+ // }
1652+ // }
16541653
1655- test(comp()) { t =>
1656- t.assertInputText(" x" )
1657- for {
1658- _ <- t.clickButton()
1659- _ = assertEq(text, " x" )
1660- _ <- t.setInputText(" hehe" )
1661- _ = t.assertInputText(" hehe" )
1662- _ <- t.clickButton()
1663- _ = assertEq(text, " hehe" )
1664- } yield ()
1665- }
1666- }
1654+ // test(comp()) { t =>
1655+ // t.assertInputText("x")
1656+ // for {
1657+ // _ <- t.clickButton()
1658+ // _ = assertEq(text, "x")
1659+ // _ <- t.setInputText("hehe")
1660+ // _ = t.assertInputText("hehe")
1661+ // _ <- t.clickButton()
1662+ // _ = assertEq(text, "hehe")
1663+ // } yield ()
1664+ // }
1665+ // }
16671666
16681667 private def testUseReducer (): Unit = {
16691668 def add (n : Int ): (Int , Int ) => Int = _ + _ + n
@@ -2500,41 +2499,41 @@ object HooksTest extends AsyncTestSuite {
25002499 }
25012500 }
25022501
2503- private def testRenderWithReuseAndUseRefToVdom (): Unit = {
2504- var text = " uninitialised"
2505- val comp = ScalaFnComponent .withHooks[Unit ]
2506- .useRefToVdom[Input ]
2507- .useState(" x" )
2508- .renderWithReuse { (_, inputRef, s) =>
2509- def onChange (e : ReactEventFromInput ): Callback =
2510- s.setState(e.target.value)
2511-
2512- def btn : Callback =
2513- for {
2514- i <- inputRef.get.asCBO
2515- // _ <- Callback.log(s"i.value = [${i.value}]")
2516- } yield {
2517- text = i.value
2518- }
2502+ // private def testRenderWithReuseAndUseRefToVdom(): Unit = {
2503+ // var text = "uninitialised"
2504+ // val comp = ScalaFnComponent.withHooks[Unit]
2505+ // .useRefToVdom[Input]
2506+ // .useState("x")
2507+ // .renderWithReuse { (_, inputRef, s) =>
2508+ // def onChange(e: ReactEventFromInput): Callback =
2509+ // s.setState(e.target.value)
25192510
2520- < .div(
2521- < .input.text.withRef(inputRef)(^ .value := s.value, ^ .onChange ==> onChange),
2522- < .button(^ .onClick --> btn)
2523- )
2524- }
2511+ // def btn: Callback =
2512+ // for {
2513+ // i <- inputRef.get.asCBO
2514+ // // _ <- Callback.log(s"i.value = [${i.value}]")
2515+ // } yield {
2516+ // text = i.value
2517+ // }
25252518
2526- test(comp()) { t =>
2527- t.assertInputText(" x" )
2528- for {
2529- _ <- t.clickButton()
2530- _ = assertEq(text, " x" )
2531- _ <- t.setInputText(" hehe" )
2532- _ = t.assertInputText(" hehe" )
2533- _ <- t.clickButton()
2534- _ = assertEq(text, " hehe" )
2535- } yield ()
2536- }
2537- }
2519+ // <.div(
2520+ // <.input.text.withRef(inputRef)(^.value := s.value, ^.onChange ==> onChange),
2521+ // <.button(^.onClick --> btn)
2522+ // )
2523+ // }
2524+
2525+ // test(comp()) { t =>
2526+ // t.assertInputText("x")
2527+ // for {
2528+ // _ <- t.clickButton()
2529+ // _ = assertEq(text, "x")
2530+ // _ <- t.setInputText("hehe")
2531+ // _ = t.assertInputText("hehe")
2532+ // _ <- t.clickButton()
2533+ // _ = assertEq(text, "hehe")
2534+ // } yield ()
2535+ // }
2536+ // }
25382537
25392538 private def testUseReused (): Unit = {
25402539 implicit val reusePIByRounding : Reusability [PI ] = Reusability .by(_.pi / 2 )
@@ -2841,11 +2840,11 @@ object HooksTest extends AsyncTestSuite {
28412840 " useRef" - {
28422841 " manual" - testUseRefManual()
28432842 " manualBy" - testUseRefManualBy()
2844- " vdom" - testUseRefVdom()
2843+ // "vdom" - testUseRefVdom()
28452844 }
28462845 " useRef (monadic)" - {
28472846 " manual" - testMonadicUseRefManual()
2848- " vdom" - testMonadicUseRefVdom()
2847+ // "vdom" - testMonadicUseRefVdom()
28492848 }
28502849 " useReducer" - testUseReducer()
28512850 " useReducer (monadic)" - testMonadicUseReducer()
@@ -2910,7 +2909,7 @@ object HooksTest extends AsyncTestSuite {
29102909 " main" - testRenderWithReuse()
29112910 " never" - testRenderWithReuseNever()
29122911 " useRef" - testRenderWithReuseAndUseRef()
2913- " useRefToVdom" - testRenderWithReuseAndUseRefToVdom()
2912+ // "useRefToVdom" - testRenderWithReuseAndUseRefToVdom()
29142913 }
29152914 " renderWithReuse (monadic alternative using Render.memo)" - {
29162915 " main" - testMonadicRenderWithReuse()
0 commit comments