eeue56 / elm-html-test

Test elm-html in Elm!
http://package.elm-lang.org/packages/eeue56/elm-html-test/latest
BSD 3-Clause "New" or "Revised" License
67 stars 15 forks source link

Surprising behavior with namespaced Svg Attributes #14

Open gregziegan opened 7 years ago

gregziegan commented 7 years ago

Does this test library also support testing svg view attributes?

Say I have this svg:

viewImage : Int -> Int -> String -> Svg msg
viewImage width height url =
    image
        [ Attr.width (toString width)
        , Attr.height (toString height)
        , Attr.xlinkHref url
        ]
        []

The xlink:href attribute does not show up in the failed test.

image

Perhaps this is just a bug with certain svg attributes, and if so i can rename this issue/try to make a PR to fix the behavior.

eeue56 commented 7 years ago

Likely that attribute is generated in a different way to what you'd expect. Because those attributes are namespaced, they might not be gathered in the same way. See this -> https://github.com/elm-lang/svg/blob/master/src/Svg/Attributes.elm#L1182

avh4 commented 6 years ago

It looks like elm-html-test doesn't support namespaced attributes yet. Test.Html.Selector.attribute doesn't handle namespaced attributes and will return an invalid selector, and other parts of the code also appear not to handle namespaces yet (though elm-html-in-elm does handle namespaces).