elm-program-test
elm-program-test copied to clipboard
Attributes containing `"` lead to a failure to show error details
When:
- the view html contains attributes like
Html.Attributes.attribute "contains-double-quote" "\"" - and a selector does not match, then
elm-program-test shows an error like:
PLEASE REPORT THIS AT <https://github.com/avh4/elm-program-test/issues>: renderHtml: couldn't parse failure report: Unexpected Char at row 4, col 10
▼ ProgramTest.clickButton "that does not exist"
Expected one of the following to exist:
- <button> with text
✓ has tag "button"
✗ has containing [ text "that does not exist" ]
- <button> with <img> with alt text
...etc etc...
Here's a commit demonstrating that in the test cases: https://github.com/avh4/elm-program-test/commit/b67267b92110420b918acdfd20742ba7d5cdbf74
I think the cause is here: https://github.com/elm-explorations/test/blob/2.1.1/src/Test/Html/Internal/ElmHtml/ToString.elm#L125
Should be something like |> List.map (\( k, v ) -> k ++ "=\"" ++ String.replace "\"" """ v ++ "\"") instead.
Not sure how to verify that tho, it's unclear how to use a local fork of elm-explorations/test.