object ReactTestUtils extends ReactTestUtils

Annotations
@deprecated
Deprecated

(Since version 2.2.0 / React 18) Migrate to React 18 and ReactTestUtils2. This will be replaced by ReactTestUtils2 in scalajs-react 3.0.0.

Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ReactTestUtils
  2. ReactTestUtils
  3. ReactTestUtilExtensions
  4. ReactTestUtilExtensions1
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. type CompType = ComponentRaw { type Raw <: japgolly.scalajs.react.facade.React.ComponentClassUntyped }
    Definition Classes
    ReactTestUtils
  2. type Mounted = MountedRaw
    Definition Classes
    ReactTestUtils
  3. type MountedOutput = MountedWithRoot[Id, util.DefaultEffects.Async, Object, Object, RawMounted[Object, Object], Object, Object]
    Definition Classes
    ReactTestUtils
  4. type Unmounted[M] = UnmountedSimple[_, M]
    Definition Classes
    ReactTestUtils
  5. trait WithRenderedDsl[M, R] extends AnyRef
  6. trait WithRenderedDslF[F[_], M, R] extends AnyRef

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def act[A](body: => A): A

    When writing UI tests, tasks like rendering, user events, or data fetching can be considered as "units" of interaction with a user interface.

    When writing UI tests, tasks like rendering, user events, or data fetching can be considered as "units" of interaction with a user interface. React provides a helper called act() that makes sure all updates related to these "units" have been processed and applied to the DOM before you make any assertions:

    act {
      // render components
    }
    // make assertions

    This helps make your tests run closer to what real users would experience when using your application.

    Definition Classes
    ReactTestUtils
  5. def actAsync[F[_], A](body: F[A])(implicit F: Async[F]): F[A]

    When writing UI tests, tasks like rendering, user events, or data fetching can be considered as "units" of interaction with a user interface.

    When writing UI tests, tasks like rendering, user events, or data fetching can be considered as "units" of interaction with a user interface. React provides a helper called act() that makes sure all updates related to these "units" have been processed and applied to the DOM before you make any assertions:

    await act(async () => {
      // render components
    });
    // make assertions

    This helps make your tests run closer to what real users would experience when using your application.

    Definition Classes
    ReactTestUtils
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  11. def findAllInRenderedTree(tree: Mounted, test: (MountedOutput) => Boolean): Vector[MountedOutput]

    Traverse all components in tree and accumulate all components where test(component) is true.

    Traverse all components in tree and accumulate all components where test(component) is true. This is not that useful on its own, but it's used as a primitive for other test utils.

    Definition Classes
    ReactTestUtils
  12. def findRenderedComponentWithType(tree: Mounted, c: CompType): MountedOutput

    Same as scryRenderedComponentsWithType() but expects there to be one result and returns that one result, or throws exception if there is any other number of matches besides one.

    Same as scryRenderedComponentsWithType() but expects there to be one result and returns that one result, or throws exception if there is any other number of matches besides one.

    Definition Classes
    ReactTestUtils
  13. def findRenderedDOMComponentWithClass(tree: Mounted, className: String): MountedOutput

    Like scryRenderedDOMComponentsWithClass() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.

    Like scryRenderedDOMComponentsWithClass() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.

    Definition Classes
    ReactTestUtils
  14. def findRenderedDOMComponentWithTag(tree: Mounted, tagName: String): MountedOutput

    Like scryRenderedDOMComponentsWithTag() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.

    Like scryRenderedDOMComponentsWithTag() but expects there to be one result, and returns that one result, or throws exception if there is any other number of matches besides one.

    Definition Classes
    ReactTestUtils
  15. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  17. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  18. def modifyProps[P, U <: component.Generic.Unmounted[P, M], M <: MountedImpure[P, _]](c: internal.CoreGeneral.GenericComponent[P, Props, U], m: M)(f: (P) => P): M
    Definition Classes
    ReactTestUtils
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def newBodyElement(): Element
    Definition Classes
    ReactTestUtils
  21. def newDocumentElement(): Element
    Definition Classes
    ReactTestUtils
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. def raw: facade.ReactTestUtils
    Annotations
    @inline()
  25. implicit final def reactTestExtMountedImpure[A[_], P, S](m: MountedSimple[Id, A, P, S]): ReactTestExt_MountedSimple[Id, A, P, S]
    Definition Classes
    ReactTestUtilExtensions
  26. implicit final def reactTestExtMountedSimple[F[_], A[_], P, S](m: MountedSimple[F, A, P, S]): ReactTestExt_MountedSimple[F, A, P, S]
    Definition Classes
    ReactTestUtilExtensions1
  27. def removeNewBodyElement(e: Element): Unit
    Definition Classes
    ReactTestUtils
  28. def removeNewDocumentElement(e: Element): Unit
    Definition Classes
    ReactTestUtils
  29. def removeReactInternals(html: String): String

    Turn <div data-reactroot="">hello&lt/div> into <div>hello&lt/div>

    Turn <div data-reactroot="">hello&lt/div> into <div>hello&lt/div>

    Definition Classes
    ReactTestUtils
  30. def renderIntoBody[M](u: Unmounted[M]): M

    Renders a component into the document body via ReactDOM.render().

    Renders a component into the document body via ReactDOM.render().

    Unlike ReactTestUtils.renderIntoDocument(), this allows DOM focus to work.

    Definition Classes
    ReactTestUtils
  31. def renderIntoDocument(e: VdomElement): MountedOutput
    Definition Classes
    ReactTestUtils
  32. def renderIntoDocument[M](unmounted: Unmounted[M]): M

    Render a component into a detached DOM node in the document.

    Render a component into a detached DOM node in the document. This function requires a DOM.

    Definition Classes
    ReactTestUtils
  33. def replaceProps[P, U <: component.Generic.Unmounted[P, M], M <: MountedImpure[P, _]](c: internal.CoreGeneral.GenericComponent[P, Props, U], m: M)(p: P): M
    Definition Classes
    ReactTestUtils
  34. def scryRenderedComponentsWithType(tree: Mounted, c: CompType): Vector[MountedOutput]

    Finds all instances of components with type equal to componentClass.

    Finds all instances of components with type equal to componentClass.

    Definition Classes
    ReactTestUtils
  35. def scryRenderedDOMComponentsWithClass(tree: Mounted, className: String): Vector[MountedOutput]

    Finds all instance of components in the rendered tree that are DOM components with the class name matching className.

    Finds all instance of components in the rendered tree that are DOM components with the class name matching className.

    Definition Classes
    ReactTestUtils
  36. def scryRenderedDOMComponentsWithTag(tree: Mounted, tagName: String): Vector[MountedOutput]

    Finds all instance of components in the rendered tree that are DOM components with the tag name matching tagName.

    Finds all instance of components in the rendered tree that are DOM components with the tag name matching tagName.

    Definition Classes
    ReactTestUtils
  37. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  38. def toString(): String
    Definition Classes
    AnyRef → Any
  39. def unmountRawComponent(c: |[ComponentUntyped, Null]): Unit
    Definition Classes
    ReactTestUtils
  40. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  41. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  42. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  43. def withNewBodyElement[A](use: (Element) => A): A
    Definition Classes
    ReactTestUtils
  44. def withNewBodyElementAsync[F[_], A](use: (Element) => F[A])(implicit F: Async[F]): F[A]
    Definition Classes
    ReactTestUtils
  45. def withNewBodyElementFuture[A](use: (Element) => Future[A])(implicit ec: ExecutionContext): Future[A]
    Definition Classes
    ReactTestUtils
  46. def withNewDocumentElement[A](use: (Element) => A): A
    Definition Classes
    ReactTestUtils
  47. def withNewDocumentElementAsync[F[_], A](use: (Element) => F[A])(implicit F: Async[F]): F[A]
    Definition Classes
    ReactTestUtils
  48. def withNewDocumentElementFuture[A](use: (Element) => Future[A])(implicit ec: ExecutionContext): Future[A]
    Definition Classes
    ReactTestUtils
  49. def withRendered[M](u: Unmounted[M], intoBody: Boolean): WithRenderedDsl[M, Element]

    Renders a component then unmounts and cleans up after use.

    Renders a component then unmounts and cleans up after use.

    intoBody

    Whether to use renderIntoBody() or ReactTestUtils.renderIntoDocument().

    Definition Classes
    ReactTestUtils
  50. def withRenderedAsync[M](u: Unmounted[M], intoBody: Boolean): WithRenderedDslF[util.DefaultEffects.Async, M, Element]

    Renders a component then unmounts and cleans up after use.

    Renders a component then unmounts and cleans up after use.

    intoBody

    Whether to use renderIntoBodyAsync() or renderIntoDocumentAsync().

    Definition Classes
    ReactTestUtils
  51. def withRenderedFuture[M, A](u: Unmounted[M], intoBody: Boolean)(f: (M) => Future[A])(implicit ec: ExecutionContext): Future[A]

    Renders a component then unmounts and cleans up after use.

    Renders a component then unmounts and cleans up after use.

    intoBody

    Whether to use renderIntoBodyFuture() or renderIntoDocumentFuture().

    Definition Classes
    ReactTestUtils
  52. def withRenderedIntoBody[M](u: Unmounted[M]): WithRenderedDsl[M, Element]

    Renders a component into the document body via ReactDOM.render(), then unmounts and cleans up after use.

    Renders a component into the document body via ReactDOM.render(), then unmounts and cleans up after use.

    Unlike ReactTestUtils.renderIntoDocument(), this allows DOM focus to work.

    Definition Classes
    ReactTestUtils
  53. def withRenderedIntoBodyAsync[M](u: Unmounted[M]): WithRenderedDslF[util.DefaultEffects.Async, M, Element]

    Renders a component into the document body via ReactDOM.render(), and asynchronously waits for the Async to complete before unmounting.

    Renders a component into the document body via ReactDOM.render(), and asynchronously waits for the Async to complete before unmounting.

    Definition Classes
    ReactTestUtils
  54. def withRenderedIntoBodyFuture[M, A](u: Unmounted[M])(f: (M) => Future[A])(implicit ec: ExecutionContext): Future[A]

    Renders a component into the document body via ReactDOM.render(), and asynchronously waits for the Future to complete before unmounting.

    Renders a component into the document body via ReactDOM.render(), and asynchronously waits for the Future to complete before unmounting.

    Definition Classes
    ReactTestUtils
  55. def withRenderedIntoDocument[M](u: Unmounted[M]): WithRenderedDsl[M, Element]

    Renders a component into detached DOM via ReactTestUtils.renderIntoDocument(), then unmounts and cleans up after use.

    Renders a component into detached DOM via ReactTestUtils.renderIntoDocument(), then unmounts and cleans up after use.

    Definition Classes
    ReactTestUtils
  56. def withRenderedIntoDocumentAsync[M](u: Unmounted[M]): WithRenderedDslF[util.DefaultEffects.Async, M, Element]

    Renders a component into the document body via ReactDOM.render(), and asynchronously waits for the Async to complete before unmounting.

    Renders a component into the document body via ReactDOM.render(), and asynchronously waits for the Async to complete before unmounting.

    Definition Classes
    ReactTestUtils
  57. def withRenderedIntoDocumentFuture[M, A](u: Unmounted[M])(f: (M) => Future[A])(implicit ec: ExecutionContext): Future[A]

    Renders a component into detached DOM via ReactTestUtils.renderIntoDocument(), and asynchronously waits for the Future to complete before unmounting.

    Renders a component into detached DOM via ReactTestUtils.renderIntoDocument(), and asynchronously waits for the Future to complete before unmounting.

    Definition Classes
    ReactTestUtils

Deprecated Value Members

  1. def withNewBodyElementAsyncCallback[F[_], A](use: (Element) => F[A])(implicit F: Async[F]): F[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) Use .withNewBodyElementAsync

  2. def withNewDocumentElementAsyncCallback[F[_], A](use: (Element) => F[A])(implicit F: Async[F]): F[A]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) Use .withNewDocumentElementAsync

  3. def withRenderedAsyncCallback[M](u: Unmounted[M], intoBody: Boolean): WithRenderedDslF[util.DefaultEffects.Async, M, Element]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) Use .withRenderedAsync

  4. def withRenderedIntoBodyAsyncCallback[M](u: Unmounted[M]): WithRenderedDslF[util.DefaultEffects.Async, M, Element]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) Use .withRenderedIntoBodyAsync

  5. def withRenderedIntoDocumentAsyncCallback[M](u: Unmounted[M]): WithRenderedDslF[util.DefaultEffects.Async, M, Element]
    Annotations
    @deprecated
    Deprecated

    (Since version 2.0.0) Use .withRenderedIntoDocumentAsync

Inherited from ReactTestUtils

Inherited from AnyRef

Inherited from Any

Ungrouped