elm-explorations / elm-explorations/test
Query.has and Query.hasNot seem to query children as well
- Dominant language
- Elm
- Stars
- 244
- Forks
- 40
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 2
Description
I'm running into an issue where the following test case is failing when, based on the documentation for the `has` and `hasNot` functions, it should be passing. The following is the test case itself and after is the relevant console log.
```
table
|> Query.fromHtml
|> Query.find [ Selector.tag "thead" ]
|> Query.find [ Selector.tag "tr" ]
|> Query.hasNot [ Selector.attribute (Aria.colIndex 1) ]
```
```
> Table
> colindex on tr
> is not added for a non contiguous heading list
▼ Query.fromHtml
label
label
label
▼ Query.find [ tag "thead" ]
1)
label
label
label
▼ Query.find [ tag "tr" ]
1)
label
label
label
▼ Query.hasNot [ attribute "aria-colindex" "1" ]
> has not attribute "aria-colindex" "1"
```
My thought is that this would pass because the `tr` tag does not have a `aria-colindex` attribute. This is a similar case shown in the documentation for the package, but is not executing as expected. After playing with it a bit I figure out that it was due to the fact that there was a child `th` element that did have a `aria-colindex="1"` which makes the test fail. The only way I've been able to get around this issue is to modify the table's structure to not include the child `th` tags, but this is not ideal.
I'm kind of asking 2 questions here which is
1. Is this functionality expected?
2. If it is, than how would you recommend testing for an attribute to not be on an element?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.