@vielzeug/assay
v26.10.17
Published
Framework-agnostic DOM testing primitives: scoped queries, event dispatch, async waiting
Downloads
1,523
Readme
@vielzeug/assay
Framework-agnostic DOM testing primitives: scoped queries, event dispatch, async waiting
Installation
pnpm add -D @vielzeug/assay
npm install -D @vielzeug/assay
yarn add -D @vielzeug/assayQuick Start
import { dispatch, eventually, within } from '@vielzeug/assay';
const panel = document.querySelector('.panel')!;
const view = within(panel);
dispatch(view.get('button.submit'), new MouseEvent('click', { bubbles: true, cancelable: true }));
await eventually(() => expect(view.get('.status').textContent).toBe('Saved'), {
message: 'save status did not settle',
});Features
walkFlatTree()traverses descendants across slot boundaries in jsdom.installFormInternalsPolyfill()supplies jsdom form-association behavior and returns a cleanup function.within(), event helpers, and async waits work with framework-rendered or vanilla DOM.
Documentation
License
MIT © Helmuth Saatkamp: part of the Vielzeug monorepo.
