LegacyReactTestUtils

japgolly.scalajs.react.test.LegacyReactTestUtils$
See theLegacyReactTestUtils companion trait

Attributes

Companion
trait
Deprecated
true
Graph
Supertypes
class Object
trait Matchable
class Any
Show all
Self type

Members list

Type members

Classlikes

trait WithRenderedDsl[M, R]

Attributes

Supertypes
class Object
trait Matchable
class Any
trait WithRenderedDslF[F[_], M, R]

Attributes

Supertypes
class Object
trait Matchable
class Any

Inherited types

type CompType = ComponentRaw { type Raw <: ComponentClassUntyped; }

Attributes

Inherited from:
LegacyReactTestUtils
type Mounted = MountedRaw

Attributes

Inherited from:
LegacyReactTestUtils
type MountedOutput = Mounted[Object, Object]

Attributes

Inherited from:
LegacyReactTestUtils
type Unmounted[M] = UnmountedSimple[_, M]

Attributes

Inherited from:
LegacyReactTestUtils

Value members

Concrete methods

def raw: ReactTestUtils.type

Deprecated methods

def withNewBodyElementAsyncCallback[F[_], A](use: Element => F[A])(implicit F: Async[F]): F[A]

Attributes

Deprecated
true
def withNewDocumentElementAsyncCallback[F[_], A](use: Element => F[A])(implicit F: Async[F]): F[A]

Attributes

Deprecated
true
def withRenderedAsyncCallback[M](u: Unmounted[M], intoBody: Boolean): WithRenderedDslF[Async, M, Element]

Attributes

Deprecated
true

Attributes

Deprecated
true

Attributes

Deprecated
true

Inherited methods

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. 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:

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.

Attributes

Inherited from:
LegacyReactTestUtils
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. 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:

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.

Attributes

Inherited from:
LegacyReactTestUtils
def findAllInRenderedTree(tree: Mounted, test: MountedOutput => Boolean): Vector[MountedOutput]

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.

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.

Attributes

Inherited from:
LegacyReactTestUtils

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.

Attributes

Inherited from:
LegacyReactTestUtils

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.

Attributes

Inherited from:
LegacyReactTestUtils

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.

Attributes

Inherited from:
LegacyReactTestUtils
def modifyProps[P, U <: UnmountedSimple[P, M], M <: MountedSimple[Id, Async, P, _]](c: ComponentSimple[P, Props, U], m: M)(f: P => P): M

Attributes

Inherited from:
LegacyReactTestUtils
def newBodyElement(): Element

Attributes

Inherited from:
LegacyReactTestUtils
def newDocumentElement(): Element

Attributes

Inherited from:
LegacyReactTestUtils
def removeNewBodyElement(e: Element): Unit

Attributes

Inherited from:
LegacyReactTestUtils
def removeNewDocumentElement(e: Element): Unit

Attributes

Inherited from:
LegacyReactTestUtils
def removeReactInternals(html: String): String

Turn &lt;div data-reactroot=""&gt;hello&lt/div&gt; into &lt;div&gt;hello&lt/div&gt;

Turn &lt;div data-reactroot=""&gt;hello&lt/div&gt; into &lt;div&gt;hello&lt/div&gt;

Attributes

Inherited from:
LegacyReactTestUtils
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 LegacyReactTestUtils.renderIntoDocument, this allows DOM focus to work.

Attributes

Inherited from:
LegacyReactTestUtils
def renderIntoDocument(e: VdomElement): MountedOutput

Attributes

Inherited from:
LegacyReactTestUtils
def renderIntoDocument[M](unmounted: Unmounted[M]): M

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

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

Attributes

Inherited from:
LegacyReactTestUtils
def replaceProps[P, U <: UnmountedSimple[P, M], M <: MountedSimple[Id, Async, P, _]](c: ComponentSimple[P, Props, U], m: M)(p: P): M

Attributes

Inherited from:
LegacyReactTestUtils

Finds all instances of components with type equal to componentClass.

Finds all instances of components with type equal to componentClass.

Attributes

Inherited from:
LegacyReactTestUtils
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.

Attributes

Inherited from:
LegacyReactTestUtils
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.

Attributes

Inherited from:
LegacyReactTestUtils
def unmountRawComponent(c: ComponentUntyped | Null): Unit

Attributes

Inherited from:
LegacyReactTestUtils
def withNewBodyElement[A](use: Element => A): A

Attributes

Inherited from:
LegacyReactTestUtils
def withNewBodyElementAsync[F[_], A](use: Element => F[A])(implicit F: Async[F]): F[A]

Attributes

Inherited from:
LegacyReactTestUtils
def withNewBodyElementFuture[A](use: Element => Future[A])(implicit ec: ExecutionContext): Future[A]

Attributes

Inherited from:
LegacyReactTestUtils
def withNewDocumentElement[A](use: Element => A): A

Attributes

Inherited from:
LegacyReactTestUtils
def withNewDocumentElementAsync[F[_], A](use: Element => F[A])(implicit F: Async[F]): F[A]

Attributes

Inherited from:
LegacyReactTestUtils
def withNewDocumentElementFuture[A](use: Element => Future[A])(implicit ec: ExecutionContext): Future[A]

Attributes

Inherited from:
LegacyReactTestUtils
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.

Value parameters

intoBody

Whether to use renderIntoBody or LegacyReactTestUtils.renderIntoDocument.

Attributes

Inherited from:
LegacyReactTestUtils
def withRenderedAsync[M](u: Unmounted[M], intoBody: Boolean): WithRenderedDslF[Async, M, Element]

Renders a component then unmounts and cleans up after use.

Renders a component then unmounts and cleans up after use.

Value parameters

intoBody

Whether to use renderIntoBodyAsync() or renderIntoDocumentAsync().

Attributes

Inherited from:
LegacyReactTestUtils
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.

Value parameters

intoBody

Whether to use renderIntoBodyFuture() or renderIntoDocumentFuture().

Attributes

Inherited from:
LegacyReactTestUtils
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 LegacyReactTestUtils.renderIntoDocument, this allows DOM focus to work.

Attributes

Inherited from:
LegacyReactTestUtils
def withRenderedIntoBodyAsync[M](u: Unmounted[M]): WithRenderedDslF[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.

Attributes

Inherited from:
LegacyReactTestUtils
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.

Attributes

Inherited from:
LegacyReactTestUtils

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

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

Attributes

Inherited from:
LegacyReactTestUtils
def withRenderedIntoDocumentAsync[M](u: Unmounted[M]): WithRenderedDslF[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.

Attributes

Inherited from:
LegacyReactTestUtils
def withRenderedIntoDocumentFuture[M, A](u: Unmounted[M])(f: M => Future[A])(implicit ec: ExecutionContext): Future[A]

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

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

Attributes

Inherited from:
LegacyReactTestUtils

Implicits

Inherited implicits

final implicit def reactTestExtMountedImpure[A[_], P, S](m: MountedSimple[Id, A, P, S]): ReactTestExt_MountedSimple[Id, A, P, S]

Attributes

Inherited from:
ReactTestUtilExtensions
final implicit def reactTestExtMountedSimple[F[_], A[_], P, S](m: MountedSimple[F, A, P, S]): ReactTestExt_MountedSimple[F, A, P, S]

Attributes

Inherited from:
ReactTestUtilExtensions1