This package has been deprecated

Author message:

No longer maintained - use Jest.

certainty-dom

1.0.0 • Public • Published

Certainty-DOM

Introduction

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');

Element assertions

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);

Package Sidebar

Install

npm i certainty-dom

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • viridia