virtual-dom icon indicating copy to clipboard operation
virtual-dom copied to clipboard

Add API for inspecting virtual dom nodes

Open avh4 opened this issue 10 years ago • 5 comments

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.

avh4 avatar Oct 03 '15 07:10 avh4

... >:( 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.

avh4 avatar Oct 03 '15 07:10 avh4

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.

evancz avatar Oct 03 '15 08:10 evancz

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.

avh4 avatar Oct 03 '15 17:10 avh4

What's the plan with this PR? Any chance that it gets merged?

ygor avatar Dec 14 '15 22:12 ygor

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.

avh4 avatar Dec 15 '15 03:12 avh4