Skip to content

Commit

Permalink
test: onClick attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
alvivi committed May 5, 2018
1 parent b16b31d commit 304c089
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/Form.elm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Test that cannot be done with the current elm-html-test feature set:

type Msg
= OnBlur
| OnClick
| OnFocus
| OnInput String

Expand All @@ -50,6 +51,12 @@ button =
|> Helpers.fromStyledHtml
|> E.simulate E.blur
|> E.expect OnBlur
, T.test "onClick attribute sets a blur event handler" <|
\() ->
Form.button [ Form.onClick OnClick ] []
|> Helpers.fromStyledHtml
|> E.simulate E.click
|> E.expect OnClick
, T.test "onFocus attribute sets a focus event handler" <|
\() ->
Form.button [ Form.onFocus OnFocus ] []
Expand Down Expand Up @@ -290,6 +297,15 @@ input =
|> Q.find [ S.tag "input" ]
|> E.simulate E.blur
|> E.expect OnBlur
, T.test "onClick attribute sets a click event handler" <|
\() ->
Form.input { id = "id", description = "desc", type_ = "text" }
[ Form.onClick OnClick ]
[]
|> Helpers.fromStyledHtml
|> Q.find [ S.tag "input" ]
|> E.simulate E.click
|> E.expect OnClick
, T.test "onFocus attribute sets a focus event handler" <|
\() ->
Form.input { id = "id", description = "desc", type_ = "text" }
Expand Down

0 comments on commit 304c089

Please sign in to comment.