elm-explorations / elm-explorations/test

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

Open
#134 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
244
Forks
40
Avg merge
1d 23h
Merged PRs (30d)
2

Description

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

▼ Query.findAll [ tag "svg" ]

1)

2)

3)

▼ Query.index 0

1)

▼ 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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.