elm-explorations / elm-explorations/test
Query.find returns different results based on selector order
- Dominant language
- Elm
- Stars
- 244
- Forks
- 40
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
Query.find seems to apply sets of selectors sequentially.
The first selector produces a set of results, on which the second selector runs, etc.
So for the example `
1) `Query.find [ tag "div", class "test" ]` will return 4 matches, all of which will be `
(one for each containing div and the matching div itself)
2) `Query.find [ class "test", tag "div" ]` will return 1 match, `
This functionality is essentially chaining multiple `Query.find` calls in a row rather than as a single operation.
The documentation of the function does not suggest this behaviour, and gives the impression of an and-like functionality:
> Find exactly one descendant element which matches all the given selectors. If no descendants match, or if more than one matches, the test will fail.
The code responsible can be found here:
https://github.com/elm-explorations/test/blob/1.2.2/src/Test/Html/Selector/Internal.elm
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.