From 84dca83051e6d5da1d959f5cec428cb349e09087 Mon Sep 17 00:00:00 2001 From: Viktor Podzigun Date: Thu, 29 Aug 2019 12:59:20 +0200 Subject: [PATCH] Removed calls to old React.createClass method --- .../admin/client/role/RoleControllerSpec.scala | 10 ++++++---- .../admin/client/system/user/SystemUserPanelSpec.scala | 9 +++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/client/src/test/scala/scommons/admin/client/role/RoleControllerSpec.scala b/client/src/test/scala/scommons/admin/client/role/RoleControllerSpec.scala index b5ed6ef..421e225 100644 --- a/client/src/test/scala/scommons/admin/client/role/RoleControllerSpec.scala +++ b/client/src/test/scala/scommons/admin/client/role/RoleControllerSpec.scala @@ -1,6 +1,5 @@ package scommons.admin.client.role -import io.github.shogowada.scalajs.reactjs.React import io.github.shogowada.scalajs.reactjs.redux.Redux.Dispatch import scommons.admin.client.api.role.RoleData import scommons.admin.client.role.RoleActions._ @@ -10,6 +9,7 @@ import scommons.client.controller.{PathParams, RouteParams} import scommons.client.ui.Buttons import scommons.client.ui.tree.{BrowseTreeItemData, BrowseTreeNodeData} import scommons.client.util.BrowsePath +import scommons.react._ import scommons.react.test.TestSpec class RoleControllerSpec extends TestSpec { @@ -105,9 +105,11 @@ class RoleControllerSpec extends TestSpec { val expectedActions = Map( Buttons.EDIT.command -> roleUpdateRequestAction ) - val roleControllerReactClass = React.createClass[Unit, Unit]({ _ => - <.div()("test") - }) + val roleControllerReactClass = new FunctionComponent[Unit] { + protected def render(props: Props): ReactElement = { + <.div()("test") + } + }.apply() val rolePermissionController = mock[RolePermissionController] (rolePermissionController.apply _).expects() .returning(roleControllerReactClass) diff --git a/client/src/test/scala/scommons/admin/client/system/user/SystemUserPanelSpec.scala b/client/src/test/scala/scommons/admin/client/system/user/SystemUserPanelSpec.scala index 11b2c8f..f3daef3 100644 --- a/client/src/test/scala/scommons/admin/client/system/user/SystemUserPanelSpec.scala +++ b/client/src/test/scala/scommons/admin/client/system/user/SystemUserPanelSpec.scala @@ -1,6 +1,5 @@ package scommons.admin.client.system.user -import io.github.shogowada.scalajs.reactjs.React import io.github.shogowada.scalajs.reactjs.elements.ReactElement import io.github.shogowada.scalajs.reactjs.redux.Redux.Dispatch import org.joda.time.DateTime @@ -256,10 +255,12 @@ class SystemUserPanelSpec extends AsyncTestSpec val systemId = props.selectedParams.systemId.get def assertSystemUserRolePanel(component: ReactElement): Assertion = { - val wrapped = React.createClass[Unit, Unit] { _ => - <.div()(component) + val wrapped = new FunctionComponent[Unit] { + protected def render(props: Props): ReactElement = { + <.div()(component) + } } - val result = shallowRender(<(wrapped)()()) + val result = shallowRender(<(wrapped())()()) assertNativeComponent(result, <.div()(), { children: List[ShallowInstance] => val List(comp) = children