react.test_utils library

Classes

ReactShallowRenderer
ReactShallowRenderer wrapper [...]
Simulate
Event simulation interface. [...]
SimulateNative
Native event simulation interface. [...]

Functions

createRenderer() ReactShallowRenderer
Returns a ReactShallowRenderer instance [...]
@JS('React.addons.TestUtils.createRenderer')
findAllInRenderedTree(dynamic tree, ComponentTestFunction test) → List
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 [...]
@JS('React.addons.TestUtils.findAllInRenderedTree')
findRenderedComponentWithType(dynamic tree, ReactComponentFactory componentFactory) → dynamic
Deprecated. Will be removed in the 5.0.0 release. Use findRenderedComponentWithTypeV2 instead. [...]
@Deprecated('5.0.0')
findRenderedComponentWithTypeV2(dynamic tree, ReactComponentFactoryProxy componentFactory) → dynamic
Same as scryRenderedComponentsWithTypeV2 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.
findRenderedDOMComponentWithClass(dynamic tree, String className) → dynamic
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.
@JS('React.addons.TestUtils.findRenderedDOMComponentWithClass')
findRenderedDOMComponentWithTag(dynamic tree, String tag) → dynamic
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.
@JS('React.addons.TestUtils.findRenderedDOMComponentWithTag')
getComponentType(ReactComponentFactory componentFactory) → dynamic
Deprecated. Will be removed in the 5.0.0 release. Use getComponentTypeV2 instead. [...]
@Deprecated('5.0.0')
getComponentTypeV2(ReactComponentFactoryProxy componentFactory) → dynamic
Returns the ReactComponentFactoryProxy.type of a given componentFactory. [...]
isCompositeComponent(dynamic instance) → bool
Returns true if element is a composite component. (created with React.createClass()).
isCompositeComponentWithType(dynamic instance, ReactComponentFactory componentFactory) → bool
Deprecated. Will be removed in the 5.0.0 release. Use isCompositeComponentWithTypeV2 instead. [...]
@Deprecated('5.0.0')
isCompositeComponentWithTypeV2(dynamic instance, ReactComponentFactoryProxy componentFactory) → bool
Returns true if instance is a custom composite component created using React.createClass() that is of the ReactComponentFactoryProxy.type of the provided componentFactory.
isDOMComponent(dynamic instance) → bool
Returns true if instance is a DOM component (such as a
@JS('React.addons.TestUtils.isDOMComponent')
isElement(dynamic object) → bool
Returns true if object is a valid React component.
@JS('React.addons.TestUtils.isElement')
isElementOfType(dynamic element, ReactComponentFactory componentFactory) → bool
Deprecated. Will be removed in the 5.0.0 release. Use isElementOfTypeV2 instead. [...]
@Deprecated('5.0.0')
isElementOfTypeV2(dynamic element, ReactComponentFactoryProxy componentFactory) → bool
Returns true if element is a ReactElement that is of the ReactComponentFactoryProxy.type of the provided componentFactory.
mockComponent(ReactClass componentClass, String mockTagName) ReactClass
Pass a mocked component module to this method to augment it with useful methods that allow it to be used as a dummy React component. Instead of rendering as usual, the component will become a simple
@JS('React.addons.TestUtils.mockComponent')
renderIntoDocument(ReactElement instance) → dynamic
Render a Component into a detached DOM node in the document.
@JS('React.addons.TestUtils.renderIntoDocument')
scryRenderedComponentsWithType(dynamic tree, ReactComponentFactory componentFactory) → List
Deprecated. Will be removed in the 5.0.0 release. Use scryRenderedComponentsWithTypeV2 instead. [...]
@Deprecated('5.0.0')
scryRenderedComponentsWithTypeV2(dynamic tree, ReactComponentFactoryProxy componentFactory) → List
Finds all instances within the provided tree that are of the ReactComponentFactoryProxy.type of the provided componentFactory.
scryRenderedDOMComponentsWithClass(dynamic tree, String className) → List
Finds all instances of components in the rendered tree that are DOM components with the class name matching className.
@JS('React.addons.TestUtils.scryRenderedDOMComponentsWithClass')
scryRenderedDOMComponentsWithTag(dynamic tree, String tagName) → List
Finds all instances of components in the rendered tree that are DOM components with the tag name matching tagName.
@JS('React.addons.TestUtils.scryRenderedDOMComponentsWithTag')

Typedefs

ComponentTestFunction(dynamic component) → bool