0.1.0 • Published 5 years ago
jest-hooks-dom v0.1.0
jest-hooks-dom is a collection of hooks for DOM testing with
Jest library.
Hooks
Elements
useHTMLElement(element, container) creates a new HTML element before each test and optionally mounts it to the
container. After each test HTML element is removed from any container.
useSVGElement(element, container) creates a new SVG element.
Mutation Tracking
useDOMMutationTracker() tracks DOM mutations.
Methods and properties tracked:
Document.prototype.createElementDocument.prototype.createElementNSDocument.prototype.createTextNodeNode.prototype.appendChildNode.prototype.insertBeforeNode.prototype.replaceChildNode.prototype.removeChildNode.prototype.textContentNode.prototype.nodeValueElement.prototype.innerHTML
Events
useResetDOMEventListeners() tracks all unregistered event listeners and automatically removes them after each test.
requestAnimationFrame
useRequestAnimationFrame() mocks requestAnimationFrame() and cancelAnimationFrame(), and resets all tasks after
each test.
0.1.0
5 years ago