Test views by writing expectations about Html values.
import Html
import Html.Attributes exposing (class)
import Test exposing (test)
import Test.Html.Query as Query
import Test.Html.Selector exposing (text, tag)
test "Button has the expected text" <|
\() ->
Html.div [ class "container" ]
[ Html.button [] [ Html.text "I'm a button!" ] ]
|> Query.fromHtml
|> Query.find [ tag "button" ]
|> Query.has [ text "I'm a button!" ]These tests are designed to be written in a pipeline like this:
Query.fromHtml on your Html to begin querying it.Query.find, Query.findAll, and Query.children to find the elements to test.Query.has and Query.count.These are normal expectations, so you can use them with fuzz just as easily as with test!
| Version | Notes |
|---|---|
| 1.0.0 | Initial release |