Skip to content

Commit

Permalink
Removed calls to old React.createClass method
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-podzigun committed Aug 29, 2019
1 parent f7c79c4 commit 84dca83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
@@ -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._
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 84dca83

Please sign in to comment.