Support toContain with element.classList #2395
Labels
enhancement
New feature or request
good first issue
Good for newcomers
p2-nice-to-have
Not breaking anything but nice to have (priority)
pr welcome
Clear and concise description of the problem
We are building a lot of components and want to test as many features as possible. One of the things we often have to test is if classes are attached correctly to an HTMLElement. Currently, we use this approach:
This works but does not give us a good error message if the expectation fails. In this case, we just get the message that it is not
true
butfalse
(except we add an error message manually).Suggested solution
It would be great if we could use
.toContain
for this purpose. It would have the benefit of meaningful error messages if the expectation fails (e.g. a list of the actual classes of the element).Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: