-
Notifications
You must be signed in to change notification settings - Fork 411
Closed
Description
Describe the feature you'd like:
I think that it would make sense for toBeVisible
to perform, in addition to its CSS-based checks, checks that confirm that the element is in the document.
test('toBeVisible with removed element', () => {
document.body.innerHTML = "<div id='el'>content</div>"
const el = document.getElementById('el')
expect(el).toBeVisible()
el.remove()
expect(el).not.toBeVisible() // this line fails, element is "visible"
})
If we think about it from a CSS standpoint, yes, there is no CSS that is preventing the element from being visible. But from the user's perspective, the element is definitely not visible. For this reason I think it makes sense to change the behavior of .toBeVisible
to include the checks from .toBeInTheDocument
.
gnapse, pascalduez, nvdarekar, essaji, ianizaguirre and 1 more
Metadata
Metadata
Assignees
Labels
No labels