@domx/testutils
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

TestUtils · GitHub license Build Status Lines npm

Common testing utility scripts.

Installation

npm install @domx/testutils

fragment

The test fragment can be used to test HTML elements that need to be appended to the DOM.

@import {fixture, html} from  "@domx/testutils";

const el = fixture(html`<my-element></my-element>`);
el.restore();

The html literal is from lit-html which provides for other usage patterns:

@import {fixture, html} from  "@domx/testutils";

const userDetailsEl= userId => html`<user-details user-id="${userId}"></user-details>`;
const el = fixture(userDetailsEl(123));
el.restore();

The fixture supports typing

const el= fixture<UserDetails>(html`<user-details></user-details>`);
console.log(el.userId);
el.restore();

Package Sidebar

Install

npm i @domx/testutils

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

55.2 kB

Total Files

27

Last publish

Collaborators

  • jhorback