Skip to content

Simulates browser behaviour of dom event groups

Notifications You must be signed in to change notification settings

plusnew/simulate-dom-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simulates browser behaviour of dom event groups

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published