Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pull in elm-html-test (and elm-html-in-elm and elm-html-query) #41

Merged
merged 39 commits into from
Nov 14, 2018

Conversation

avh4
Copy link
Collaborator

@avh4 avh4 commented Oct 20, 2018

No description provided.

@avh4 avh4 self-assigned this Oct 20, 2018
@avh4 avh4 mentioned this pull request Oct 20, 2018
friegger added a commit to friegger/synoptico that referenced this pull request Oct 25, 2018
- elm-html-test is not yet ready for 0.19, see elm-explorations/test#41
avh4 added 3 commits November 1, 2018 19:18
Fixed virtual DOM node decoding for normal nodes, text nodes, and lazy/thunk nodes
Update virtual-doc event handling code—event handlers are now VirtualDom.Handler instead of Json.Decode.Decoder
Fixed event handling when map, lazy, and keyed are used.
@rtfeldman
Copy link
Collaborator

Just wanted to comment - great work on this @avh4! 😻 😻 😻

avh4 added 9 commits November 12, 2018 21:03
The event handlers are decoded in decodeFacts.  The removed code could potentially be useful when using `Test.Html.Selector.attribute` with an event handler attribute, but the API doesn’t allow that, since `Test.Html.Selector.attribute` takes `Attribute Never` as its parameter.
@avh4 avh4 changed the title WIP: pull in elm-html-test (and elm-html-in-elm and elm-html-query) pull in elm-html-test (and elm-html-in-elm and elm-html-query) Nov 13, 2018
@avh4
Copy link
Collaborator Author

avh4 commented Nov 13, 2018

@rtfeldman I think this is ready to merge if you want to look it over. cc @mgold

Copy link
Collaborator

@rtfeldman rtfeldman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so beautiful!!! ❤️

I'm totally happy to merge it as-is, but will give others time to look it over.

Copy link
Collaborator

@drathier drathier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a joy to read. It's a huge PR, but it's so clean code it doesn't matter. No idea how much was written by whom (I feel like I found at least 2 distinct coding styles in this PR), but it doesn't really matter.

Wrote down a few comments, deal with them if you feel like it, I'm happy to merge this either way.



// NOTE: this is duplicating constants also defined in Test.Internal.KernelConstants
// so if you make any changes here, be sure to synchronize them there!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm so happy you wrote this comment at the other site as well, pointing here! I fully expected there to be no such comment on the other side, because PR's at work would never have done that.

else
isDescendant
(prependChildren current rest)
potentialDescendant
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would've expected this to be naively recursive. Nice one.

-}
simulate : ( String, Value ) -> Query.Single msg -> Event msg
simulate =
Event
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we get some named arguments here? It's not entirely clear to me what the arguments represent, mainly the pair.

|> QueryInternal.failWithQuery showTrace
("Event.expectEvent: Expected the msg \u{001B}[32m"
++ Internal.toString msg
++ "\u{001B}[39m from the event \u{001B}[31m"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we extract these escape codes into named values, so I can read what colors they represent?

Expect.fail <|
String.join "\n" <|
List.concat
[ [ "Internal Error: failed to decode the virtual dom. Please report this at <https://github.com/elm-explorations/test/issues>." ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error message has a link to where the user can report the bug. Could we get that link in all the other "please report this bug" messages?

= Find (List Selector)
| FindAll (List Selector)
| Children (List Selector)
-- First and Index are separate so we can report Query.first in error messages
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this comment. The attention to detail is gold.

queryName
++ " always expects to find 1 element, but it found "
++ String.fromInt resultCount
++ " instead.\n\n\nHINT: If you actually expected "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the hint!

@avh4
Copy link
Collaborator Author

avh4 commented Nov 13, 2018

@drathier I believe all the changes you suggested are on code that was copied unchanged from other packages. I agree with them all, but think those would be best as a separate PR. Feel free to make one if you want!

@rtfeldman rtfeldman self-assigned this Nov 13, 2018
gampleman and others added 2 commits November 13, 2018 13:19
Co-Authored-By: rtfeldman <richard.t.feldman@gmail.com>
Co-Authored-By: rtfeldman <richard.t.feldman@gmail.com>
@ericTsiliacos
Copy link

Thank you SO MUCH @avh4! You are amazing!

@drathier
Copy link
Collaborator

I (most likely) won't do a PR to fix those comments. It's up for grabs for anyone else 🙌

@avh4
Copy link
Collaborator Author

avh4 commented Nov 14, 2018

I (most likely) won't do a PR to fix those comments. It's up for grabs for anyone else 🙌

will add it to my list for a future twitch stream :)

@rtfeldman rtfeldman merged commit 18705b7 into master Nov 14, 2018
@rtfeldman rtfeldman deleted the elm-html-test branch November 14, 2018 03:13
@rtfeldman
Copy link
Collaborator

Published as 1.2.0!

Thanks again @avh4! 🏆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants