avh4 / elm-program-test

Test Elm programs
https://elm-program-test.netlify.com/
MIT License
93 stars 28 forks source link

selection radio controls #116

Open BrianHicks opened 4 years ago

BrianHicks commented 4 years ago

I wrote a little helper to select radio controls in a test I'm writing:

checkRadio : String -> ProgramTest model msg effect -> ProgramTest model msg effect
checkRadio value =
    ProgramTest.simulateDomEvent
        (Query.find
            [ Selector.tag "input"
            , Selector.attribute (Attributes.type_ "radio")
            , Selector.attribute (Attributes.value value)
            ]
        )
        ( "change"
        , Encode.object [ ( "target", Encode.object [ ( "checked", Encode.bool True ) ] ) ]
        )

I went to open a PR here and it looks like there needs to be some more value there around looking in labels. I'm not sure what the right thing to do here is, so… here's the code I have so far! What else would need to happen? Radio buttons seem like an OK thing to add, but is that an OK assumption?