This module allows you to simulate events on Html nodes, the Msg generated by the event is returned so you can test it
Gets a Msg produced by a node when an event is simulated.
type Msg
= Change String
test "Input produces expected Msg" <|
\() ->
Html.input [ onInput Change ] [ ]
|> Query.fromHtml
|> Events.simulate (Input "cats")
|> Expect.equal (Ok <| Change "cats")Passes if given event equals the triggered event
type Msg
= Change String
test "Input produces expected Msg" <|
\() ->
Html.input [ onInput Change ] [ ]
|> Query.fromHtml
|> Events.simulate (Input "cats")
|> Expect.equal (Ok <| Change "cats")
Event constructors to simulate events