UNPKG

element-vir

Version:

Heroic. Reactive. Declarative. Type safe. Web components without compromise.

53 lines (52 loc) 1.44 kB
/** * Assigns the given id as a test id attribute to the attached element. * * @category Test * @example * * ```ts * import {html, defineElement, testId} from 'element-vir'; * * const MyElement = defineElement()({ * tagName: 'my-element', * render() { * return html` * <div ${testId('my-test')}>Some div</div> * `; * }, * }); * ``` */ export declare const testId: (this: void, attributeValue: string) => import("lit-html/directive.js").DirectiveResult<{ new (partInfo: import("lit-html/directive.js").PartInfo): { readonly element: Element; render(attributeValue: string): symbol; readonly _$isConnected: boolean; update(_part: import("lit-html").Part, props: Array<unknown>): unknown; }; }>; /** * Construct an attribute selector for the given test id. * * @category Test * @example * * ```ts * import {html, selectTestId} from 'element-vir'; * import {testWeb} from '@augment-vir/test'; * import {assert} from '@augment-vir/assert'; * * const instance = testWeb.render(html` * <${MyElement}></${MyElement}> * `); * assert.instanceOf(instance, MyElement); * instance.shadowRoot.querySelector(selectTestId('my-test')); * ``` */ export declare const testIdSelector: (this: void, attributeValue: string) => string; /** * The test id attribute name. * * @category Test */ export declare const testIdAttributeName: string;