@domx/testutils
v1.0.0
Published
Common testing utility scripts
Downloads
4
Readme
TestUtils ·
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();