Add versions of 'htmlAnyContain', 'htmlAllContain', 'htmlNoneContain' which match strings verbatim#1786
Open
eahlberg wants to merge 3 commits intoyesodweb:masterfrom
Open
Add versions of 'htmlAnyContain', 'htmlAllContain', 'htmlNoneContain' which match strings verbatim#1786eahlberg wants to merge 3 commits intoyesodweb:masterfrom
eahlberg wants to merge 3 commits intoyesodweb:masterfrom
Conversation
eahlberg
commented
Oct 11, 2022
| , htmlNoneContain | ||
| , htmlAllContainPreEscaped | ||
| , htmlAnyContainPreEscaped | ||
| , htmlNoneContainPreEscaped |
Contributor
Author
There was a problem hiding this comment.
html*PreEscaped preferable to e.g. html*ContainRaw? PreEscaped was used since that's what it's called in the Blaze docs.
eahlberg
commented
Oct 11, 2022
| get ("/html" :: Text) | ||
| statusIs 200 | ||
| htmlAnyContainPreEscaped "meta" "content=\"site description\"" | ||
| htmlAllContainPreEscaped "meta" "content=\"site description" |
Contributor
Author
There was a problem hiding this comment.
It'd be nice if there are more concise examples than this but I couldn't come up with any
d6ab90c to
03184b6
Compare
eahlberg
commented
Oct 11, 2022
| case matches of | ||
| [] -> failure $ "Nothing matched css query: " <> query | ||
| _ -> liftIO $ HUnit.assertBool ("Not all "++T.unpack query++" contain "++search ++ " matches: " ++ show matches) $ | ||
| DL.all (DL.isInfixOf search) (map (TL.unpack . decodeUtf8) matches) |
Contributor
Author
There was a problem hiding this comment.
Except for the escaping, this is the exact same code as htmlAllContain, should we refactor this?
03184b6 to
9b44e8c
Compare
eahlberg
commented
Oct 12, 2022
| statusIs 200 | ||
| htmlAnyContainPreEscaped "meta" "content=\"site description\"" | ||
| htmlAllContainPreEscaped "meta" "content=\"site description" | ||
| htmlNoneContainPreEscaped "meta" "foobar" |
Contributor
Author
There was a problem hiding this comment.
This checks absence in the same was as the test for htmlNoneContain, I think it'd be better with a test case which illustrates the difference between the two functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1784
Before submitting your PR, check that you've:
@sincedeclarations to the Haddocks for new, public APIsAfter submitting your PR: