packages feed

yesod-test 1.5.1.0 → 1.5.1.1

raw patch · 5 files changed

+21/−5 lines, 5 files

Files

ChangeLog.md view
@@ -1,3 +1,7 @@+## 1.5.1.1++* Fix `addToken_` needing a trailing space and allows multiples spaces in css selector.+	 ## 1.5.1.0  * Better error provenance for stuff invoking withResponse' [#1191](https://github.com/yesodweb/yesod/pull/1191)
Yesod/Test.hs view
@@ -577,7 +577,7 @@ -- >   addToken_ "#formID" addToken_ :: Query -> RequestBuilder site () addToken_ scope = do-  matches <- htmlQuery' rbdResponse ["Tried to get CSRF token with addToken'"] $ scope <> "input[name=_token][type=hidden][value]"+  matches <- htmlQuery' rbdResponse ["Tried to get CSRF token with addToken'"] $ scope <> " input[name=_token][type=hidden][value]"   case matches of     [] -> failure $ "No CSRF token found in the current page"     element:[] -> addPostParam "_token" $ head $ attribute "value" $ parseHTML element
Yesod/Test/CssQuery.hs view
@@ -51,14 +51,14 @@  -- Below this line is the Parsec parser for css queries. cssQuery :: Parser [[SelectorGroup]]-cssQuery = sepBy rules (char ',' >> optional (char ' '))+cssQuery = many (char ' ') >> sepBy rules (char ',' >> many (char ' '))  rules :: Parser [SelectorGroup] rules = many $ directChildren <|> deepChildren  directChildren :: Parser SelectorGroup directChildren =-    string "> " >> DirectChildren <$> pOptionalTrailingSpace parseSelectors+    string "> " >> (many (char ' ')) >> DirectChildren <$> pOptionalTrailingSpace parseSelectors  deepChildren :: Parser SelectorGroup deepChildren = pOptionalTrailingSpace $ DeepChildren <$> parseSelectors@@ -102,4 +102,4 @@ pSquare p = char '[' *> p <* char ']'  pOptionalTrailingSpace :: Parser a -> Parser a-pOptionalTrailingSpace p = p <* optional (char ' ')+pOptionalTrailingSpace p = p <* many (char ' ')
test/main.hs view
@@ -140,6 +140,18 @@                 htmlAnyContain "p" "World"                 htmlAnyContain "p" "Moon"                 htmlNoneContain "p" "Sun"+            yit "finds the CSRF token by css selector" $ do+                get ("/form" :: Text)+                statusIs 200++                request $ do+                    setMethod "POST"+                    setUrl ("/form" :: Text)+                    byLabel "Some Label" "12345"+                    fileByLabel "Some File" "test/main.hs" "text/plain"+                    addToken_ "body"+                statusIs 200+                bodyEquals "12345"          ydescribe "utf8 paths" $ do             yit "from path" $ do
yesod-test.cabal view
@@ -1,5 +1,5 @@ name:               yesod-test-version:            1.5.1.0+version:            1.5.1.1 license:            MIT license-file:       LICENSE author:             Nubis <nubis@woobiz.com.ar>