Provides an FFI bindings for the
Enzyme library. This is a pretty thin
wrapper around Enzyme with a few convenience functions added. For a
convenient API, use
debug :: forall m n. MonadEffect m => Wrapper n -> m String
Prints the shallow DOM tree up to any nested React components. See https://enzymejs.github.io/enzyme/docs/api/ReactWrapper/debug.html for more info.
parent :: forall m n. MonadEffect m => Wrapper n -> m (Wrapper n)
Returns parent of the given
simulate' :: forall m r. MonadEffect m => String -> Record r -> Wrapper SingleNode -> m Unit
Simulates a certain event type on a given
Wrapper. The event argument
is a record that gets merged with a simulated React synthetic event before
being passed to the component’s event handler. See
NOTE: This doesn’t actually emit an event, but just triggers the event
handler on the wrapper.
NOTE 2: This function only works for native HTML elements. For emitting
events on custom React components, use
simulateCustom' :: forall m a. MonadEffect m => String -> a -> Wrapper SingleNode -> m Unit
Simulates an event on a custom React component (i.e. not an HTML element).
For reasons to complicated to discuss here, the regular
work on custom components, so we provide this workaround.
unsafeSetState :: forall state m. MonadAff m => state -> Wrapper SingleNode -> m Unit
Sets the state of the given
Wrapper. This is asynchronous, so runs
NOTE: this is a type-unsafe operation. There is no check to make sure the state being set here has the type of the actual state the component in question is using.
update :: forall m n. MonadEffect m => Wrapper n -> m Unit
Updates the given
Wrapper to reflect the latest state. Call this
function whenever you think there could be an async change of state that
caused a re-render. For some reason, Enzyme won't pick up the changes