-
Notifications
You must be signed in to change notification settings - Fork 410
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers
Description
As discussed in #4, this library needs a .toBeVisible
custom matcher. It operates on an element, receives no extra arguments, and passes if the element is visible to the user.
expect(element).toBeVisible()
How?
This should be implemented by checking the element's computed style, and make sure that display
is not none
, and also visibility
is not hidden
or collapsed
.
Why?
Doing the equivalent assertion using vanilla DOM APIs is cumbersome:
// Two assertions needed, both dealing with verbose APIs
expect(getComputedStyle(element).getPropertyValue('display')).not.toEqual('none')
expect(getComputedStyle(element).getPropertyValue('visibility')).not.toMatch(/(hidden|collapsed)/)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomers