-
Notifications
You must be signed in to change notification settings - Fork 374
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
Add versions of 'htmlAnyContain', 'htmlAllContain', 'htmlNoneContain' which match strings verbatim #1786
base: master
Are you sure you want to change the base?
Conversation
@@ -204,6 +204,9 @@ module Yesod.Test | |||
, htmlAllContain | |||
, htmlAnyContain | |||
, htmlNoneContain | |||
, htmlAllContainPreEscaped | |||
, htmlAnyContainPreEscaped | |||
, htmlNoneContainPreEscaped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
html*PreEscaped
preferable to e.g. html*ContainRaw
? PreEscaped
was used since that's what it's called in the Blaze docs.
@@ -201,6 +201,9 @@ main = hspec $ do | |||
yit "finding html" $ do | |||
get ("/html" :: Text) | |||
statusIs 200 | |||
htmlAnyContainPreEscaped "meta" "content=\"site description\"" | |||
htmlAllContainPreEscaped "meta" "content=\"site description" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice if there are more concise examples than this but I couldn't come up with any
d6ab90c
to
03184b6
Compare
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Except for the escaping, this is the exact same code as htmlAllContain
, should we refactor this?
03184b6
to
9b44e8c
Compare
@@ -201,6 +201,9 @@ main = hspec $ do | |||
yit "finding html" $ do | |||
get ("/html" :: Text) | |||
statusIs 200 | |||
htmlAnyContainPreEscaped "meta" "content=\"site description\"" | |||
htmlAllContainPreEscaped "meta" "content=\"site description" | |||
htmlNoneContainPreEscaped "meta" "foobar" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Fixes #1784
Before submitting your PR, check that you've:
@since
declarations to the Haddocks for new, public APIsAfter submitting your PR: