@yunyu/simulate-dom-events
TypeScript icon, indicating that this package has built-in type declarations

0.1.8 • Public • Published

domevents

Simulates browser behaviour of dom event groups

Goal

To have an abstraction layer for testing applications with dom events.

API

  import { click } from '@plusnew/simulate-dom-events';

  const checkboxElement = <input type="checkbox" onclick={() => console.log('click fired')} onchange={() => console.log('change fired!')}/> as HTMLInputElement;

  click(checkboxElement);
  // The mousedown, mouseup, click, input and change event will dispatch synchronously with the correct values
  // In case in the click event a prevendDefault() is called, the input and change event will not occur

Dependencies (0)

    Dev Dependencies (21)

    Package Sidebar

    Install

    npm i @yunyu/simulate-dom-events

    Weekly Downloads

    1

    Version

    0.1.8

    License

    MIT

    Unpacked Size

    69.9 kB

    Total Files

    48

    Last publish

    Collaborators

    • yunyu