Add API for inspecting virtual dom nodes
This allows writing tests like the following:
import VirtualDom.Inspect as Inspect
App.render
|> Inspect.select "div > #header img.logo"
|> List.head
|> (flip Maybe.andThen) (Inspect.attr "src")
|> assertEqual (Just "img/pivotal.png")
I can't think of a good reason to use this in non-test code, though. Would having this available encourage people to do bad things?
This probably merits some discussion before merging.
... >:( not happy about the Travis failure, there will be some browserify config to mess with to get that fixed.
But please comment about the rest of this.
There are a few issues on elm-html about this including https://github.com/evancz/elm-html/issues/16 and https://github.com/evancz/elm-html/issues/25. I have mixed feelings about supporting this a ton. That's the relevant existing discussion.
Maybe it would be better to have this as a separate library that's focused on testing? There are some other limitations to testing that I'll hopefully be writing up soon--maybe there's a better solution in that larger context.
What's the plan with this PR? Any chance that it gets merged?
I think I'm convinced that this is not a good idea right now. @ygor I'll reply in more detail to your thread on elm-discuss.