eeue56 / eeue56/elm-html-test

Query.find matches the same element twice

Open
#73 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elm
Stars
68
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have a test that fails complaining about `Query.find always expects to find 1 element, but it found 2 instead.`. The HTML in question is actually generated from a utility function, and the very same test(copy/paste) passes in another component that utilized the same function.

The query bit of my test is (where actual is `Html Msg`):
```
actual
|> Query.fromHtml
|> Query.find
[ Selector.tag "div"
, Selector.classes [ "loading", "loading-flash" ]
, Selector.id ("loading")
, Selector.style "display" ""
]
|> Query.has []
```
Below is the output.
```
â–¼ Query.fromHtml





Search for a colleague:




Test One


Test Two


Test Three






You've selected












Send anonymously


(optional)




Send















â–¼ Query.find [ tag "div", classes "loading loading-flash", attribute "id" "loading", styles display: ]

1)










2)










✗ Query.find always expects to find 1 element, but it found 2 instead.

HINT: If you actually expected 2 elements, use Query.findAll instead of Query.find.

```

Kind regards,
Charl Marais

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.