You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
toBeEmptyDOMElement is a Jest DOM matcher that asserts the visibility of given element by inspecting whether it contains any child elements.
Adapting it to our case it would assert that given host element does not contain any host children elements. It might contain some composite elements as long as these do not have host descendants. We already have function for getting host children of given element (getHostChildren) so that should be relatively straightforward.
Describe the Feature
toBeEmptyDOMElement
is a Jest DOM matcher that asserts the visibility of given element by inspecting whether it contains any child elements.Adapting it to our case it would assert that given host element does not contain any host children elements. It might contain some composite elements as long as these do not have host descendants. We already have function for getting host children of given element (
getHostChildren
) so that should be relatively straightforward.Possible Implementations
Proposed API:
The matcher should:
getHostChildren
fn)Each matcher should have a fairly comprehensive test suite.
Links
toBeEmptyDOMElement
matcher code from Jest DOM: https://github.com/testing-library/jest-dom/blob/main/src/to-be-empty-dom-element.jstoBeEmptyElement
implementation for Jest Native: https://github.com/testing-library/jest-native/blob/main/src/to-be-empty-element.tsRelated Issues
#1454
The text was updated successfully, but these errors were encountered: