I have a button that, if set to be disabled, does not emit any Msgs and I want to write a test that this is true.
Currently I have this “disabled functionality” by conditionally adding the onClick handler from Html.Events.onClick only if the configuration record of the button has disabled set to False.
basically the code looks like this:
if not options.disabled then
-- add onClick handler from Html.Events
else
-- do not add onClick handler
The following is the test I would like to have:
test "Does not emit a Msg" <|
\_ ->
button "disabled button"
|> onClick Clicked
|> disabled True
|> toHtml
|> Query.fromHtml
|> Event.simulate (Event.click)
|> Event.expect never
Is there a way to actually implement the above (currently hypothetical) test?