Certainty-DOM extends the Certainty assertion library with assertion methods for HTML DOM elements and other HTML Node types.
Example:
import { ensure } from 'certainty';
import 'certainty-dom';
// Assert that the body element has the expected tag name.
ensure(document.body).hasTagName('body');
ensure(someElement).isElement(); // is an element
ensure(someElement).hasTagName(tagName);
ensure(someElement).hasChildCount(count);
ensure(someElement).hasDescendantMatching(query); // uses querySelector()
ensure(someElement).hasAttribute(attrName).withValue(value);
ensure(someElement).hasClass(clsName);
ensure(someElement).doesNotHaveClass(clsName);
// Apply an assertion to all child elements.
ensure(someElement).eachChildElement().hasTagName(tagName);