-
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
According to the documentation of function Test.Html.Selector.text : String -> Selector
It "Matches elements that have a text attribute with the given value."
which suggests to me that a test for string equality would be performed.
Yet when I try the following test:
module HasTest exposing (..)
import Html
import Test.Html.Query as Query
import Test exposing (Test, test)
import Test.Html.Selector exposing (text)
hasTest : Test
hasTest =
test "Button has the expected text" <|
\() ->
Html.button [] [ Html.text "????????I'm a button!????????" ]
|> Query.fromHtml
|> Query.has [ text "I'm a button!" ]
the test succeeds.
When I look at function Test.Html.Selector.Internal.query
(...)
Text text ->
List.concatMap (fn (ElmHtml.Query.ContainsText text)) elems
(...)
then it calls indeed for a string containing match.
Also considering issue "Regex matching for text #58", should this behavior be corrected or should the documentation be changed/clarified?
Otherwise, how does one test for string equalitiy?
Is it possible to extract somehow the actual string from the query followed by a string equality check like so:
Html.button [] [ Html.text "????????I'm a button!????????" ]
|> Query.fromHtml
|> ...get string value(s)...
|> Expect.equal "I'm a button!"
that should then fail.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels