diff --git a/yesod-test/test/main.hs b/yesod-test/test/main.hs index 808ccf65..4276c850 100644 --- a/yesod-test/test/main.hs +++ b/yesod-test/test/main.hs @@ -319,6 +319,21 @@ main = hspec $ do setUrl ("label-contain-error" :: Text) byLabelContain "hobby" "fishing") assertEq "failure wasn't called" (isLeft bad) True + yit "bySelectorLabelContain looks for the selector and label which contain the given label name" $ do + get ("/selector-label-contain" :: Text) + request $ do + setMethod "POST" + setUrl ("check-hobby" :: Text) + bySelectorLabelContain "#hobby-container" "hobby" "fishing" + res <- maybe "Couldn't get response" simpleBody <$> getResponse + assertEq "hobby isn't set" res "fishing" + yit "bySelectorLabelContain throws an error if the selector matches multiple elements" $ do + get ("selector-label-contain-error" :: Text) + (bad :: Either SomeException ()) <- try (request $ do + setMethod "POST" + setUrl ("check-hobby" :: Text) + bySelectorLabelContain "#hobby-container" "hobby" "fishing") + assertEq "failure wasn't called" (isLeft bad) True yit "byLabelPrefix matches over the prefix of the labels" $ do get ("/label-prefix" :: Text) request $ do @@ -576,6 +591,10 @@ app = liteApp $ do return ("" :: Text) onStatic "label-contain-error" $ dispatchTo $ return ("" :: Text) + onStatic "selector-label-contain" $ dispatchTo $ + return ("
" :: Text) + onStatic "selector-label-contain-error" $ dispatchTo $ + return ("" :: Text) onStatic "label-prefix" $ dispatchTo $ return ("" :: Text) onStatic "label-prefix-error" $ dispatchTo $