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

proposal filterMap #38

Closed stoeffel closed 7 years ago

stoeffel commented 7 years ago

We often have the use-case where we want to findAll elements with a certain class and then narrowing the search result to a specific subset. We use index to find the right element, but I think those tests tend to be pretty brittle. I think it's better to narrow the results with an actual selector. I chose filterMap as the name for this function, but I'm not super happy with it. I had findAllIn before, which I think is worse.

How do you like this?

stoeffel commented 7 years ago

don't know what's up with travis 🤔.

eeue56 commented 7 years ago

Also, regarding the name: I agree. What about keep?

eeue56 commented 7 years ago

The build was failing on travis due to the infamous caching issue. Cleaned caches and rebuilt

stoeffel commented 7 years ago

I like keep. would you be okay with renaming and taking one selector?

eeue56 commented 7 years ago

That looks good to me 👍 One thought - how often have you needed to do the opposite? e.g exclude a given selector from a collection?

stoeffel commented 7 years ago

One thought - how often have you needed to do the opposite? e.g exclude a given selector from a collection?

I didn't have to do that yet, but I can see a use-case for that. We could add drop in the future.

eeue56 commented 7 years ago

Let's just merge this for now and see how we go 👍

stoeffel commented 7 years ago

published with v5.1.0