Add new fileByLabel-related functions
This commit is contained in:
parent
ed9306323c
commit
d03e92ff9b
@ -81,6 +81,9 @@ module Yesod.Test
|
|||||||
, byLabelSuffix
|
, byLabelSuffix
|
||||||
, fileByLabel
|
, fileByLabel
|
||||||
, fileByLabelExact
|
, fileByLabelExact
|
||||||
|
, fileByLabelContain
|
||||||
|
, fileByLabelPrefix
|
||||||
|
, fileByLabelSuffix
|
||||||
|
|
||||||
-- *** CSRF Tokens
|
-- *** CSRF Tokens
|
||||||
-- | In order to prevent CSRF exploits, yesod-form adds a hidden input
|
-- | In order to prevent CSRF exploits, yesod-form adds a hidden input
|
||||||
@ -766,6 +769,42 @@ fileByLabelExact :: T.Text -- ^ The text contained in the @\<label>@.
|
|||||||
-> RequestBuilder site ()
|
-> RequestBuilder site ()
|
||||||
fileByLabelExact = fileByLabelWithMatch (==)
|
fileByLabelExact = fileByLabelWithMatch (==)
|
||||||
|
|
||||||
|
-- |
|
||||||
|
-- Contain version of 'fileByLabelExact'
|
||||||
|
--
|
||||||
|
-- Note: Just like 'fileByLabel', this function throws an error if it finds multiple labels
|
||||||
|
--
|
||||||
|
-- @since 1.6.1
|
||||||
|
fileByLabelContain :: T.Text -- ^ The text contained in the @\<label>@.
|
||||||
|
-> FilePath -- ^ The path to the file.
|
||||||
|
-> T.Text -- ^ The MIME type of the file, e.g. "image/png".
|
||||||
|
-> RequestBuilder site ()
|
||||||
|
fileByLabelContain = fileByLabelWithMatch T.isInfixOf
|
||||||
|
|
||||||
|
-- |
|
||||||
|
-- Prefix version of 'fileByLabelExact'
|
||||||
|
--
|
||||||
|
-- Note: Just like 'fileByLabel', this function throws an error if it finds multiple labels
|
||||||
|
--
|
||||||
|
-- @since 1.6.1
|
||||||
|
fileByLabelPrefix :: T.Text -- ^ The text contained in the @\<label>@.
|
||||||
|
-> FilePath -- ^ The path to the file.
|
||||||
|
-> T.Text -- ^ The MIME type of the file, e.g. "image/png".
|
||||||
|
-> RequestBuilder site ()
|
||||||
|
fileByLabelPrefix = fileByLabelWithMatch T.isPrefixOf
|
||||||
|
|
||||||
|
-- |
|
||||||
|
-- Suffix version of 'fileByLabelExact'
|
||||||
|
--
|
||||||
|
-- Note: Just like 'fileByLabel', this function throws an error if it finds multiple labels
|
||||||
|
--
|
||||||
|
-- @since 1.6.1
|
||||||
|
fileByLabelSuffix :: T.Text -- ^ The text contained in the @\<label>@.
|
||||||
|
-> FilePath -- ^ The path to the file.
|
||||||
|
-> T.Text -- ^ The MIME type of the file, e.g. "image/png".
|
||||||
|
-> RequestBuilder site ()
|
||||||
|
fileByLabelSuffix = fileByLabelWithMatch T.isSuffixOf
|
||||||
|
|
||||||
-- | Lookups the hidden input named "_token" and adds its value to the params.
|
-- | Lookups the hidden input named "_token" and adds its value to the params.
|
||||||
-- Receives a CSS selector that should resolve to the form element containing the token.
|
-- Receives a CSS selector that should resolve to the form element containing the token.
|
||||||
--
|
--
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user