Skip to content

Selector.all does not fail if any descendants match the given selectors #213

@decioferreira

Description

@decioferreira

To reproduce:

Html.fieldset [ Attributes.disabled False ]
    [ Html.button [ Attributes.disabled True ]
        [ Html.text "Reply"
        ]
    ]
    |> Query.fromHtml
    |> Query.has
        [ Selector.all
            [ Selector.tag "fieldset"
            , Selector.attribute (Attributes.disabled True)
            ]
        ]

Another example with a class selector:

Html.fieldset []
    [ Html.button [ Attributes.class "btn btn-large" ]
        [ Html.text "Reply"
        ]
    ]
    |> Query.fromHtml
    |> Query.has
        [ Selector.all
            [ Selector.tag "fieldset"
            , Selector.class "btn"
            ]
        ]

Link to running examples: https://ellie-app.com/m7RYfvvLvjPa1

Actual result: it passes (because there is a descendant that matches the second selector)

Expected result: my understanding is that Selector.all allows us to find a single HTML element that matches all given selectors - if this is not the case, then I would say the description of this function should be clarified

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