1.0.0 • Published 7 years ago
simulate-events v1.0.0
Simulate events
A tiny helper library to simulate any kind of event in non-browser environments like jsdom. Events do work the same as you would exepect them to work in a browser.
Installation
# NPM
npm i -D simulate-events
# Yarn
yarn add --dev simulate-events
Usage
import fire from "simulate-events";
// We assume that jsdom has been correctly set up
const div = document.createElement("div");
document.body.appendChild(div);
div.addEventListener("whatever", () => {
console.log("hey");
});
fire(div, "whatever");
// Logs: "hey"
LICENSE
MIT, see LICENSE.md
1.0.0
7 years ago