Skip to content

Test.Html.Query.has wrongfully returns a failed expectation even when the clauses in the Selector are there #134

@sashaafm

Description

@sashaafm

Hello, I'm seeing the following error in a test:


    ▼ Query.findAll [ tag "svg" ]

        1)  <svg class="some-class-type-1 some-class-icon v-align-middle" height="20" width="20">
                <circle cx="10" cy="10" fill="#fb8532" r="9" shape-rendering="geometricPrecision" stroke="black" stroke-width="0.5">
                </circle>
            </svg>

        2)  <svg class="some-class-type-2 some-class-icon v-align-middle" height="20" width="20">
                <circle cx="10" cy="10" fill="#f66a0a" r="9" shape-rendering="geometricPrecision" stroke="black" stroke-width="0.5">
                </circle>
            </svg>

        3)  <svg class="some-class-type-0 some-class-icon v-align-middle" height="20" width="20">
                <circle cx="10" cy="10" fill="#ffdf5d" r="9" shape-rendering="geometricPrecision" stroke="black" stroke-width="0.5">
                </circle>
            </svg>


    ▼ Query.index 0

        1)  <svg class="some-class-type-1 some-class-icon v-align-middle" height="20" width="20">
                <circle cx="10" cy="10" fill="#fb8532" r="9" shape-rendering="geometricPrecision" stroke="black" stroke-width="0.5">
                </circle>
            </svg>


    ▼ Query.has [ class "some-class-type-1" ]

    ✗ has class "some-class-type-1"

as you can see Query.index 0 finds an svg with some-class-type-1, and I use a Query.has [ class "some-class-type-1" ]. However, it reports as not having that class some-class-type-1. AFAIK, this is a bug because Query.has is supposed to return a successful expectation if the Selector clauses given to it are true, which they seem to be in this case.

I'm providing the test code below:

model
|> view
|> Query.fromHtml
|> Query.findAll [ Selector.class "row" ]
|> Query.keep (Selector.tag "svg")
|> Expect.all
     [ Query.index 0
         >> Query.has [ Selector.class "some-class-type-1" ]
     , Query.index 1
         >> Query.has [ Selector.class "some-class-type-2"]
     , Query.index 2
         >> Query.has [ Selector.class "some-class-type-0"]
     ]

If there's any further information I can give please do tell.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions